Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generated Neon simd_test features. #1367

Merged
merged 3 commits into from
Jan 9, 2023

Conversation

jacobbramley
Copy link
Contributor

The tests can run if and only if the target_features for the corresponding intrinsics are detected at run-time, so make sure that the tests have an appropriate simd_test().

This fixes some failures due to tests running when they shouldn't. For example, some tests would fail on hardware that lacks "fcma".

This decouples the feature names in the generator, since "arm" and "arm64" use different names, and for "arm" the dynamic simd_test features don't match the static target_feature names.

There are several changes to the tests, but changes to the generated intrinsics themselves are minimal, and cosmetic.

@rustbot
Copy link
Collaborator

rustbot commented Jan 6, 2023

r? @Amanieu

(rustbot has picked a reviewer for you, use r? to override)

@jacobbramley
Copy link
Contributor Author

Hmm... ci/style.sh is (now) failing on a file I didn't modify. (It fails on master for me too.)

@Nugine
Copy link
Contributor

Nugine commented Jan 7, 2023

Hmm... ci/style.sh is (now) failing on a file I didn't modify. (It fails on master for me too.)

I accidentally added an invisble space in this line. CI passed in the PR because rustfmt-preview was missing.

stdarch/ci/style.sh

Lines 5 to 9 in 368ba1a

if rustup component add rustfmt-preview ; then
command -v rustfmt
rustfmt -V
cargo fmt --all -- --check
fi

Is the single space worth a PR? 😂

@Amanieu
Copy link
Member

Amanieu commented Jan 7, 2023

As @Nugine said, just remove the extra space in this PR.

"arm" and "aarch64" support different sets of `target_feature` and
`simd_test` arguments, and for "arm", the set of features that can be
dynamically detected is different again. Restructure the generator code
to allow this to be expressed accurately (in future patches).

This implementation preserves the way that target features are specified
for shared intrinsics, because this has an impact on the generated
documentation. In particular, rustdoc cannot look inside
`cfg_attr(target_arch = ...)` tests, so we use unconditional
`target_feature` attributes where possible.
The tests can run if and only if the target_features for the
corresponding intrinsics are detected at run-time, so make sure that the
tests have an appropriate `simd_test()`.

This fixes some failures due to tests running when they shouldn't. For
example, some tests would fail on hardware that lacks "fcma".
@jacobbramley
Copy link
Contributor Author

Done. Sorry about the force-push; the whitespace fix wouldn't apply otherwise.

@Amanieu Amanieu merged commit 3d89e05 into rust-lang:master Jan 9, 2023
@jacobbramley jacobbramley deleted the dev/neon-tgt-ft branch January 13, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants