| Age | Commit message (Collapse) | Author | Lines |
|
Fixes: #1672
|
|
|
|
|
|
|
|
Make target feature verification stricter
|
|
|
|
|
|
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.
|
|
|
|
|
|
The function is supposed to return first argument for IMM8 == 8.
|
|
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.
|
|
|
|
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`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
These functions read from a pointer, so `readonly` has to be used instead of `nomem`.
|
|
|
|
|
|
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]: https://github.com/rust-lang/rust/blob/e8c698bb3bdc121ac7f65919bd16d22f6567a3f1/tests/ui/check-cfg/well-known-values.stderr#L177
|
|
This is necessary to avoid `unexpected_cfgs` warnings for unexpected/
missing target features, in user code.
|
|
|
|
Previous changes in Rust and LLVM have caused stdarch to be broken in
debug, so add testing to ensure that this is caught.
|
|
|
|
|
|
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>
|
|
|
|
Add feature detection for aarch64 FEAT_PAuth_LR.
There is currently no Linux cpuinfo support so the OS-specific lines are
commented out.
|
|
|
|
|
|
|
|
|
|
|
|
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?
|
|
|
|
|
|
Minor nits in the code, like usage of `&Option<str>`
|
|
|
|
Re-enabled `assert_instr`
|
|
|