Commit graph

2076 commits

Author SHA1 Message Date
Martin Liska
1d10adfa38 Fix implementation of _mm256_alignr_epi8<16>
The function is supposed to return first argument for IMM8 == 8.
2024-11-30 23:07:21 +00:00
Martin Liska
6d24a9f72b Fix signature of _mm512_store{u,}_si512.
Simiarly to other functions for `mm` and `mm256` register widths, the
first argument should be a pointer to the pointer type. See e.g.
`_mm256_store_si256` function.
2024-11-30 21:35:13 +00:00
Ralf Jung
358aee539b remove rustc_allow_const_fn_unstable feature gate 2024-11-30 21:34:02 +00:00
Nicholas Nethercote
ddf10db1a3 Fix the features macro.
The first rule of the `features` macro looks like this:
```
macro_rules! features {
    (
      @TARGET: $target:ident;
      @CFG: $cfg:meta;
      @MACRO_NAME: $macro_name:ident;
      @MACRO_ATTRS: $(#[$macro_attrs:meta])*
      $(@BIND_FEATURE_NAME: $bind_feature:tt; $feature_impl:tt; $(#[$deprecate_attr:meta];)?)*
      $(@NO_RUNTIME_DETECTION: $nort_feature:tt; )*
      $(@FEATURE: #[$stability_attr:meta] $feature:ident: $feature_lit:tt;
          $(without cfg check: $feature_cfg_check:literal;)?
          $(implied by target_features: [$($target_feature_lit:tt),*];)?
          $(#[$feature_comment:meta])*)*
    ) => {
```
Notice all the `tt` specifiers. They are used because they are forwarded
to another macro. Only `ident`, `lifetime`, and `tt` specifiers can be
forwarded this way.

But there is an exception: `$feature_lit:tt`, which was added recently.
In theory it should cause an error like this:
```
error: no rules expected `literal` metavariable
   --> /home/njn/dev/rust3/library/stdarch/crates/std_detect/src/detect/macros.rs:54:91
    |
51  | /         macro_rules! $macro_name {
52  | |             $(
53  | |                 ($feature_lit) => {
54  | |                     $crate::detect_feature!($feature, $feature_lit $(, without cfg check: $feature_cfg_check)? ...
    | |                                                                                           ^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
...   |
88  | |             };
89  | |         }
    | |_________- in this expansion of `is_x86_feature_detected!`
    |
   ::: std/tests/run-time-detect.rs:145:27
    |
145 |       println!("tsc: {:?}", is_x86_feature_detected!("tsc"));
    |                             ------------------------------- in this macro invocation
    |
note: while trying to match keyword `true`
   --> /home/njn/dev/rust3/library/stdarch/crates/std_detect/src/detect/macros.rs:12:55
    |
12  |     ($feature:tt, $feature_lit:tt, without cfg check: true) => {
    |                                                       ^^^^
    = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
    = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
```
(The URL at the end of the error has more details about this forwarding
limitation.)

In practice it doesn't cause this error. I'm not sure why, but the
existing macro implementation in rustc is far from perfect, so it's
believable that it does the wrong thing here.

Why does this matter? Because https://github.com/rust-lang/rust/pull/124141
is modifying the macro implementation, and when that PR is applied the
error *does* occur. (It's one of several cases I have found where the
existing compiler accepts code it shouldn't, but #124141 causes that
code to be rejected.)

Fortunately the fix is simple: replace the `literal` specifier with `tt`.
2024-11-30 21:32:50 +00:00
Tobias Decking
4d2911ba4b Rework SIMD zeroing 2024-11-30 00:05:40 +00:00
Urgau
91c0dabca3 Enable without cfg check test in std_detect 2024-11-30 00:01:44 +00:00
Eduardo Sánchez Muñoz
21300c20e4 Simplify some code in examples 2024-11-29 23:37:33 +00:00
MarcoIeni
f1cadfda0c remove docs publishing 2024-11-28 15:24:24 +00:00
MarcoIeni
5f434100eb add conclusion job 2024-11-28 15:24:24 +00:00
MarcoIeni
60249f87f6 use merge queue 2024-11-28 15:24:24 +00:00
Asuna
ecf58b32ff Recommend using run-docker.sh instead of run.sh in CONTRIBUTING.md 2024-11-27 09:30:19 +08:00
Asuna
2f608b514b Fix RISC-V Packed SIMD intrinsics compilation 2024-11-27 09:07:39 +08:00
Amanieu d'Antras
7bb6e1978a Disable loongarch and wasm in CI due to fallout from SIMD ABI checking 2024-11-27 07:06:17 +08:00
Amanieu d'Antras
8d563dd6f9 Fix types for ARM SIMD32 intrinsics
These were previously defined using vector types which is incorrect.
Instead, `{u}int{8x4,16x2}_t` are aliases for `i32` and `u32`.

This also fixes CI since these types don't need to be passed in NEON
registers and this was triggering a newly added compiler warning.
2024-11-27 07:06:17 +08:00
Ralf Jung
889a29248b move wasm comment to a better place 2024-11-10 21:49:11 +08:00
Ralf Jung
2d925a2908 remove test --skip that references a long-closed issue 2024-11-10 21:49:11 +08:00
Eduardo Sánchez Muñoz
4c6bf3801f Fix asm! options for _mm_mask_load_sh and _mm_maskz_load_sh
These functions read from a pointer, so `readonly` has to be used instead of `nomem`.
2024-11-10 08:20:24 +08:00
Eduardo Sánchez Muñoz
a552144515 Fix duplicated doc comment line and empty line after doc comment 2024-11-10 07:58:04 +08:00
Urgau
7956142f92 Add compile-time tests against unexpected target features cfgs 2024-11-08 06:17:06 +08:00
Urgau
f62e1daa2d Mark feature with missing corresponding target feature cfgs as such
Computed by diffing of:
$ rg "[ ]+@FEATURE: .*: \"(.*)\";" -r '$1' --no-filename \
  crates/std_detect/src/detect/ | sort | uniq

With (from the main Rust repo[^1]):
$ rg "target_feature" tests/ui/check-cfg/well-known-values.stderr

[^1]: e8c698bb3b/tests/ui/check-cfg/well-known-values.stderr (L177)
2024-11-08 06:17:06 +08:00
Urgau
a6a49cfd90 Add ability to declare a feature without cfg checking
This is necessary to avoid `unexpected_cfgs` warnings for unexpected/
missing target features, in user code.
2024-11-08 06:17:06 +08:00
David Wood
d3fe1b7c21 ci: fix matrix usage 2024-11-07 06:08:33 +08:00
David Wood
aaad388be1 ci: add debug testing
Previous changes in Rust and LLVM have caused stdarch to be broken in
debug, so add testing to ensure that this is caught.
2024-11-07 06:08:33 +08:00
WANG Rui
b08aea9ec0 ci: Use distro toolchain for loongarch64-unknown-linux-gnu 2024-11-03 01:27:20 +08:00
Noa
281fe5f474 Use C-unwind abi for the llvm.wasm.throw intrinsic 2024-11-01 20:17:42 +08:00
Jens Reidel
89caa7798f core_arch: powerpc: Fix documentation for vec_ctu
Like the name suggests, this converts to unsigned integers rather than
signed. I assume this was copy pasted from vec_cts.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-01 06:07:58 +08:00
Ralf Jung
73c15a0c93 cleanup wasm const fn 2024-10-28 15:48:52 +08:00
Kajetan Puchalski
168479a4a5 std_detect: Add pauth-lr aarch64 target feature
Add feature detection for aarch64 FEAT_PAuth_LR.
There is currently no Linux cpuinfo support so the OS-specific lines are
commented out.
2024-10-27 02:59:49 +08:00
WANG Rui
49e52f3657 core_arch: Add LoongArch frecipe intrinsics 2024-10-14 14:24:33 +02:00
WANG Rui
2d56d53f81 stdarch-gen: Add LoongArch frecipe intrinsics 2024-10-14 14:24:33 +02:00
Ralf Jung
07d24af3ac avoid rustc_const_stable on internal function 2024-10-10 16:24:24 +02:00
Yuri Astrakhan
442e492d1f Clean up examples, make it more "Rusty" 2024-10-01 04:40:25 -04:00
Amanieu d'Antras
14e3cd7b1d Fix __crc32d and __crc32cd not showing up in standard library docs 2024-09-30 15:01:50 -04:00
Yuri Astrakhan
11f975e51d Add all crates to workspace
I am not certain why some crates are missing - it might be by accident or on purpose, so feel free to reject.  This makes sure no crate is missed by accident,
and also removed the non-existent `wasm-assert-instr-tests` crate.

P.S. Also, added some crate-level lints, but perhaps these should be added to all crates in the workspace?
2024-09-30 13:23:20 -04:00
Yuri Astrakhan
0760ed6ca7 Minor linting 2024-09-30 13:00:24 -04:00
Yuri Astrakhan
8a68450e25 Clean up docs, fixing indentation and formatting 2024-09-28 20:14:36 -04:00
Yuri Astrakhan
196843736d Improve stdarch-gen-arm a bit
Minor nits in the code, like usage of `&Option<str>`
2024-09-28 19:50:10 -04:00
Martin Liska
6a75539815 Simplify code related to testing of xtest 2024-09-23 10:19:11 -04:00
Sayantan Chakraborty
d9430d094b Upgrade Intel SDE to v9.44
Re-enabled `assert_instr`
2024-09-22 18:19:47 -04:00
Sayantan Chakraborty
959c49f0d0 Use Cargo.toml lints instead of a build script 2024-09-22 18:19:47 -04:00
Martin Liska
63603fd41f Add space in order to fix rendering of Rounding options 2024-09-22 17:57:31 -04:00
Martin Liska
f319d8c5d9 Make documentation about __mm_$op_ps more precise 2024-09-22 11:55:20 -04:00
Martin Liska
8376fbe34f Provide link for rounding parameters - SSE 2024-09-22 11:32:58 -04:00
Martin Liska
f8813384e7 Provide link for rounding parameters 2024-09-22 11:32:58 -04:00
Martin Liska
fcf6e95c90 Change markdown for ROUNDING params in f16c.rs 2024-09-22 11:32:58 -04:00
Martin Liska
04f4ca9680 Ignore XSTATE_BV when comparing XTEST XsaveArea 2024-09-22 07:56:46 -04:00
Sayantan Chakraborty
d6f40ec495 Fixes the shrd bug 2024-09-22 07:33:16 -04:00
Kajetan Puchalski
485ded6369 std_detect: Add sme-b16b16 as an explicit aarch64 target feature
LLVM 20 split out what used to be called b16b16 and correspond to aarch64
FEAT_SVE_B16B16 into sve-b16b16 and sme-b16b16.
Add sme-b16b16 as an explicit feature and update the detection accordingly.
2024-09-18 12:48:54 -04:00
Taiki Endo
24b5e3c99e Use C string literal 2024-09-18 05:58:40 -04:00
Taiki Endo
9e5b3f5c8c std_detect: Fix link in mips.rs 2024-09-18 05:30:10 -04:00