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. |
Contributor
|
Thanks! @bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
May 29, 2026
…r=folkertdev Add the `clflushopt` x86 target feature Adds the unstable `clflushopt` x86 target feature, gated behind `#![feature(clflushopt_target_feature)]`. `CLFLUSHOPT` is a standalone x86 CPUID feature (Intel Skylake+ / AMD Excavator+, ~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_clflushopt` intrinsic (rust-lang/stdarch#1456) cannot compile until this target feature exists, so the stdarch PR is blocked on this one merging and syncing into stdarch's pinned toolchain. - Tracking issue: rust-lang#157096 - Unblocks intrinsic: rust-lang/stdarch#1456 This mirrors the existing unstable x86 target features (e.g. `movrs`, `apxf`). `clflushopt` is a standard LLVM x86 feature name, so it maps 1:1 through `to_llvm_features` with no remap entry needed. r? compiler
rust-bors Bot
pushed a commit
that referenced
this pull request
May 29, 2026
…uwer Rollup of 16 pull requests Successful merges: - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error) - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering) - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`) - #157053 (Eagerly resolve delegations in late resolution) - #157068 (NVPTX: Remove the unstable ptx linker flavor) - #157076 (Various proc-macro related code cleanups) - #157106 (add ABI check logic for wasm) - #154835 (std::offload sharedmem) - #157065 (Stabilize `Path::is_empty`) - #157088 (Improve suggestions for malformed deprecated attribute) - #157098 (Add the `clflushopt` x86 target feature) - #157103 (Add reproducibly failing tests for parallel frontend) - #157111 (Update target maintainer for x86_64-unknown-linux-none) - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`) - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`) - #157120 (Cleanups around attribute target checking) Failed merges: - #157100 (Some more per owner things)
rust-bors Bot
pushed a commit
that referenced
this pull request
May 29, 2026
…uwer Rollup of 16 pull requests Successful merges: - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error) - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering) - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`) - #157053 (Eagerly resolve delegations in late resolution) - #157068 (NVPTX: Remove the unstable ptx linker flavor) - #157076 (Various proc-macro related code cleanups) - #157106 (add ABI check logic for wasm) - #154835 (std::offload sharedmem) - #157065 (Stabilize `Path::is_empty`) - #157088 (Improve suggestions for malformed deprecated attribute) - #157098 (Add the `clflushopt` x86 target feature) - #157103 (Add reproducibly failing tests for parallel frontend) - #157111 (Update target maintainer for x86_64-unknown-linux-none) - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`) - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`) - #157120 (Cleanups around attribute target checking) Failed merges: - #157100 (Some more per owner things)
rust-bors Bot
pushed a commit
that referenced
this pull request
May 29, 2026
…uwer Rollup of 16 pull requests Successful merges: - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error) - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering) - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`) - #157053 (Eagerly resolve delegations in late resolution) - #157068 (NVPTX: Remove the unstable ptx linker flavor) - #157076 (Various proc-macro related code cleanups) - #157106 (add ABI check logic for wasm) - #154835 (std::offload sharedmem) - #157065 (Stabilize `Path::is_empty`) - #157088 (Improve suggestions for malformed deprecated attribute) - #157098 (Add the `clflushopt` x86 target feature) - #157103 (Add reproducibly failing tests for parallel frontend) - #157111 (Update target maintainer for x86_64-unknown-linux-none) - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`) - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`) - #157120 (Cleanups around attribute target checking) Failed merges: - #157100 (Some more per owner things)
rust-bors Bot
pushed a commit
that referenced
this pull request
May 29, 2026
…uwer Rollup of 16 pull requests Successful merges: - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error) - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering) - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`) - #157053 (Eagerly resolve delegations in late resolution) - #157068 (NVPTX: Remove the unstable ptx linker flavor) - #157076 (Various proc-macro related code cleanups) - #157106 (add ABI check logic for wasm) - #154835 (std::offload sharedmem) - #157065 (Stabilize `Path::is_empty`) - #157088 (Improve suggestions for malformed deprecated attribute) - #157098 (Add the `clflushopt` x86 target feature) - #157103 (Add reproducibly failing tests for parallel frontend) - #157111 (Update target maintainer for x86_64-unknown-linux-none) - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`) - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`) - #157120 (Cleanups around attribute target checking) Failed merges: - #157100 (Some more per owner things)
rust-bors Bot
pushed a commit
that referenced
this pull request
May 29, 2026
…uwer Rollup of 16 pull requests Successful merges: - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error) - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering) - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`) - #157053 (Eagerly resolve delegations in late resolution) - #157068 (NVPTX: Remove the unstable ptx linker flavor) - #157076 (Various proc-macro related code cleanups) - #157106 (add ABI check logic for wasm) - #154835 (std::offload sharedmem) - #157065 (Stabilize `Path::is_empty`) - #157088 (Improve suggestions for malformed deprecated attribute) - #157098 (Add the `clflushopt` x86 target feature) - #157103 (Add reproducibly failing tests for parallel frontend) - #157111 (Update target maintainer for x86_64-unknown-linux-none) - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`) - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`) - #157120 (Cleanups around attribute target checking) Failed merges: - #157100 (Some more per owner things)
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