1428 Commits

Author SHA1 Message Date
sayantn
a635da83d7 Make assert_instr stricter 2024-12-21 10:12:32 +00:00
Martin Liska
728b35dfbb Remove buffers in tests for {f,}xsave{c,}{64,}
Fixes: #1672
2024-12-13 15:07:48 +00:00
Sayantan Chakraborty
5d3879f558 assert_instr for AMX 2024-12-12 16:56:01 +00:00
Sayantan Chakraborty
139b2ad3e3 Use core::intrinsics::fmaf16 instead of LLVM intrinsic 2024-12-12 16:56:01 +00:00
Sayantan Chakraborty
0b0b7e6fe1 Cleanup: remove redundant target features
Make target feature verification stricter
2024-12-12 16:56:01 +00:00
daxpedda
69efcbdb54 Add numeric instructions for Wasm not available in core 2024-12-12 16:53:36 +00:00
aaishwarymishra@gmail.com
b3bdc662d8 Fix incorrect documentation for _mm_loadu_si64 function 2024-12-09 03:02:48 +00:00
Alex Crichton
745ebd5362 wasm: Add missing #[target_feature] to simd ctors
This is a resubmission of #1609 which was ruled optional but not
necessary at the time but it's now necessary. These weren't originally
applied as they weren't allowed in a `const` context but that's no
longer applicable. At the same time though be sure to add some small
tests to ensure that these intrinsics can be used in a `const` context.
2024-12-02 16:28:24 +00:00
Martin Liska
a1e78aca2f Fix test-case 2024-11-30 23:07:21 +00:00
Martin Liska
0601aa385b Fix and document _mmX_alignr_epiX family of intrinsics 2024-11-30 23:07:21 +00:00
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
Asuna
2f608b514b Fix RISC-V Packed SIMD intrinsics compilation 2024-11-27 09:07:39 +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
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
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
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
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
Taiki Endo
720973b1b4 std_detect: Use elf_aux_info on FreeBSD 2024-09-18 05:07:32 -04:00
Mads Marquart
8a511191a0 Enable feature detection on all Apple/Darwin targets
Tested in the simulator and on the device I had lying around, a 1st
generation iPad Mini (which isn't Aarch64, but shows that the
`sysctlbyname` calls still work even there, even if they return false).

`sysctlbyname` _should_ be safe to use without causing rejections from
the app store, as its usage is documented in:
https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics

Also, the standard library will use these soon anyhow, so this shouldn't
affect the situation:
https://github.com/rust-lang/rust/pull/129019
2024-09-14 04:25:01 +01:00
Ralf Jung
4eed3c8a23 simd_extract, simd_insert: use absolute path in macro 2024-08-28 14:55:57 +01:00