Add the clflushopt x86 target feature#157098
Open
jlpetz wants to merge 3 commits into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
This was referenced May 29, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
`CLFLUSHOPT` is a standalone x86 CPUID feature (Intel Skylake+ / AMD Excavator+, ~2015) not part of any psABI microarchitecture level, so it needs its own unstable target feature, gated behind `clflushopt_target_feature`. This is the compiler half of exposing the `_mm_clflushopt` intrinsic; the stdarch half is blocked on this landing. Also bless two UI test references (check-cfg/target_feature and target-feature/invalid-attribute) that enumerate the full set of valid target features, since `clflushopt` is now part of that list.
1c1d8ea to
0980491
Compare
Contributor
|
r? me |
folkertdev
reviewed
May 29, 2026
Contributor
There was a problem hiding this comment.
Could you also add the feature to the is_x86_feature_detected! macro defined at
https://github.com/rust-lang/rust/blob/main/library/std_detect/src/detect/arch/x86.rs
and add a test for it in library/std_detect/tests/x86-specific.rs?
This comment has been minimized.
This comment has been minimized.
Wire up runtime detection for the `clflushopt` feature: add it to the `is_x86_feature_detected!` feature list (gated on `clflushopt_target_feature`), enable it from CPUID leaf 7 EBX bit 23, and add it to the std_detect x86-specific dump test.
Collaborator
|
Some changes occurred in cc @Amanieu, @folkertdev, @sayantn |
Author
Thanks for the feedback, I've tried to address it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the unstable
clflushoptx86 target feature, gated behind#![feature(clflushopt_target_feature)].CLFLUSHOPTis a standalone x86 CPUID feature (Intel Skylake+ / AMDExcavator+, ~2015) that is not part of any psABI microarchitecture level, so it
needs its own feature flag.
This is the compiler half of a two-PR feature and is a hard dependency for the
stdarch side. The
_mm_clflushoptintrinsic (rust-lang/stdarch#1456) cannotcompile until this target feature exists, so the stdarch PR is blocked on this
one merging and syncing into stdarch's pinned toolchain.
clflushopt_target_feature#157096_mm_clflushoptstdarch#1456This mirrors the existing unstable x86 target features (e.g.
movrs,apxf).clflushoptis a standard LLVM x86 feature name, so it maps 1:1 throughto_llvm_featureswith no remap entry needed.r? compiler