Skip to content

Commit

Permalink
Added the target-feature and sha512_sm_x86 feature gate
Browse files Browse the repository at this point in the history
Updated the stdarch submodule
  • Loading branch information
sayantn committed Jul 11, 2024
1 parent bcf1f6d commit bd7b7b7
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub fn from_target_feature(
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature,
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature,
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature,
Some(sym::sha512_sm_x86) => rust_features.sha512_sm_x86,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ declare_features! (
(incomplete, return_type_notation, "1.70.0", Some(109417)),
/// Allows `extern "rust-cold"`.
(unstable, rust_cold_cc, "1.63.0", Some(97544)),
/// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics
(unstable, sha512_sm_x86, "CURRENT_RUSTC_VERSION", Some(126624)),
/// Shortern the tail expression lifetime
(unstable, shorter_tail_lifetimes, "1.79.0", Some(123739)),
/// Allows the use of SIMD types in functions declared in `extern` blocks.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,7 @@ symbols! {
self_in_typedefs,
self_struct_ctor,
semitransparent,
sha512_sm_x86,
shadow_call_stack,
shl,
shl_assign,
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[
("rdseed", Stable),
("rtm", Unstable(sym::rtm_target_feature)),
("sha", Stable),
("sha512", Unstable(sym::sha512_sm_x86)),
("sm3", Unstable(sym::sha512_sm_x86)),
("sm4", Unstable(sym::sha512_sm_x86)),
("sse", Stable),
("sse2", Stable),
("sse3", Stable),
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch
Submodule stdarch updated 84 files
+8 −16 .github/workflows/main.yml
+1 −1 ci/docker/aarch64-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
+1 −1 ci/docker/i586-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/i686-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/mips-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
+1 −1 ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile
+1 −1 ci/docker/mipsel-unknown-linux-musl/Dockerfile
+1 −1 ci/docker/nvptx64-nvidia-cuda/Dockerfile
+1 −1 ci/docker/powerpc-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/s390x-unknown-linux-gnu/Dockerfile
+1 −1 ci/docker/wasm32-wasip1/Dockerfile
+7 −6 ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile
+61 −0 ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def
+1 −1 ci/docker/x86_64-unknown-linux-gnu/Dockerfile
+1,270 −0 crates/core_arch/missing-x86.md
+2 −1 crates/core_arch/src/lib.rs
+12 −0 crates/core_arch/src/mod.rs
+17 −17 crates/core_arch/src/powerpc/altivec.rs
+139 −0 crates/core_arch/src/simd.rs
+1 −1 crates/core_arch/src/wasm32/mod.rs
+90 −50 crates/core_arch/src/wasm32/relaxed_simd.rs
+17 −47 crates/core_arch/src/wasm32/simd128.rs
+9 −3 crates/core_arch/src/x86/adx.rs
+118 −33 crates/core_arch/src/x86/avx.rs
+55 −65 crates/core_arch/src/x86/avx2.rs
+356 −1 crates/core_arch/src/x86/avx512bf16.rs
+19 −36 crates/core_arch/src/x86/avx512bitalg.rs
+2,679 −1,058 crates/core_arch/src/x86/avx512bw.rs
+6 −20 crates/core_arch/src/x86/avx512cd.rs
+10,709 −0 crates/core_arch/src/x86/avx512dq.rs
+3,175 −1,582 crates/core_arch/src/x86/avx512f.rs
+557 −26 crates/core_arch/src/x86/avx512ifma.rs
+24 −12 crates/core_arch/src/x86/avx512vbmi2.rs
+876 −0 crates/core_arch/src/x86/avx512vnni.rs
+19 −42 crates/core_arch/src/x86/avx512vpopcntdq.rs
+253 −0 crates/core_arch/src/x86/avxneconvert.rs
+20 −0 crates/core_arch/src/x86/bmi1.rs
+8 −0 crates/core_arch/src/x86/bt.rs
+0 −86 crates/core_arch/src/x86/cpuid.rs
+8 −0 crates/core_arch/src/x86/f16c.rs
+78 −89 crates/core_arch/src/x86/fma.rs
+1 −1 crates/core_arch/src/x86/fxsr.rs
+21 −21 crates/core_arch/src/x86/gfni.rs
+30 −0 crates/core_arch/src/x86/macros.rs
+34 −5 crates/core_arch/src/x86/mod.rs
+1 −5 crates/core_arch/src/x86/pclmulqdq.rs
+4 −4 crates/core_arch/src/x86/rtm.rs
+21 −45 crates/core_arch/src/x86/sse.rs
+169 −40 crates/core_arch/src/x86/sse2.rs
+31 −10 crates/core_arch/src/x86/sse41.rs
+61 −3 crates/core_arch/src/x86/sse4a.rs
+20 −255 crates/core_arch/src/x86/tbm.rs
+10 −31 crates/core_arch/src/x86/xsave.rs
+9 −3 crates/core_arch/src/x86_64/adx.rs
+21 −1 crates/core_arch/src/x86_64/avx.rs
+0 −48 crates/core_arch/src/x86_64/avx2.rs
+45 −0 crates/core_arch/src/x86_64/avx512bw.rs
+698 −85 crates/core_arch/src/x86_64/avx512f.rs
+8 −0 crates/core_arch/src/x86_64/bt.rs
+1 −1 crates/core_arch/src/x86_64/fxsr.rs
+6 −2 crates/core_arch/src/x86_64/mod.rs
+11 −9 crates/core_arch/src/x86_64/sse2.rs
+1 −1 crates/core_arch/src/x86_64/sse41.rs
+225 −0 crates/core_arch/src/x86_64/tbm.rs
+11 −23 crates/core_arch/src/x86_64/xsave.rs
+41 −0 crates/std_detect/src/detect/arch/x86.rs
+19 −11 crates/std_detect/src/detect/cache.rs
+39 −12 crates/std_detect/src/detect/os/x86.rs
+0 −4 crates/std_detect/src/lib.rs
+13 −0 crates/std_detect/tests/cpu-detection.rs
+45 −19 crates/std_detect/tests/x86-specific.rs
+23 −29 crates/stdarch-test/src/disassembly.rs
+2 −2 crates/stdarch-test/src/lib.rs
+1 −1 crates/stdarch-verify/Cargo.toml
+24 −1 crates/stdarch-verify/src/lib.rs
+1 −0 crates/stdarch-verify/tests/arm.rs
+2 −1 crates/stdarch-verify/tests/mips.rs
+221 −228 crates/stdarch-verify/tests/x86-intel.rs
+178,389 −147,738 crates/stdarch-verify/x86-intel.xml
2 changes: 1 addition & 1 deletion tests/ui/check-cfg/mix.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ warning: unexpected `cfg` condition value: `zebra`
LL | cfg!(target_feature = "zebra");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, and `avxvnniint8` and 191 more
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, and `avxvnniint8` and 193 more
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration

warning: 27 warnings emitted
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/check-cfg/well-known-values.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
LL | target_feature = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sign-ext`, `simd128`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt`
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/feature-gates/feature-gate-sha512_sm_x86.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ only-x86_64
#[target_feature(enable = "sha512")]
//~^ ERROR: currently unstable
unsafe fn foo() {}

fn main() {}
13 changes: 13 additions & 0 deletions tests/ui/feature-gates/feature-gate-sha512_sm_x86.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0658]: the target feature `sha512` is currently unstable
--> $DIR/feature-gate-sha512_sm_x86.rs:2:18
|
LL | #[target_feature(enable = "sha512")]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #126624 <https://github.com/rust-lang/rust/issues/126624> for more information
= help: add `#![feature(sha512_sm_x86)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0658`.

0 comments on commit bd7b7b7

Please sign in to comment.