diff options
| author | Ralf Jung <post@ralfj.de> | 2025-04-22 08:48:43 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-04-23 14:01:08 +0200 |
| commit | 216fac3c23c003af77c140ccd4b11168a0ea1da3 (patch) | |
| tree | 0bb2239d755c0bbdcc94b0c569dca6731b57d07c | |
| parent | b5f5f62a8b5890be2fde163ba3f2284f023126ad (diff) | |
| download | rust-216fac3c23c003af77c140ccd4b11168a0ea1da3.tar.gz rust-216fac3c23c003af77c140ccd4b11168a0ea1da3.zip | |
wasm, arm, x86-without-SSE need simd to be explicitly enabled
| -rw-r--r-- | tests/codegen/const-vector.rs | 25 | ||||
| -rw-r--r-- | tests/codegen/repr/transparent.rs | 5 | ||||
| -rw-r--r-- | tests/codegen/simd/extract-insert-dyn.rs | 26 |
3 files changed, 33 insertions, 23 deletions
diff --git a/tests/codegen/const-vector.rs b/tests/codegen/const-vector.rs index 8343594e5d2..1d4edc39b1c 100644 --- a/tests/codegen/const-vector.rs +++ b/tests/codegen/const-vector.rs @@ -8,6 +8,7 @@ #![feature(repr_simd)] #![feature(rustc_attrs)] #![feature(simd_ffi)] +#![feature(arm_target_feature)] #![allow(non_camel_case_types)] // Setting up structs that can be used as const vectors @@ -28,33 +29,12 @@ pub struct Simd<T, const N: usize>([T; N]); extern "unadjusted" { fn test_i8x2(a: i8x2); -} - -extern "unadjusted" { fn test_i8x2_two_args(a: i8x2, b: i8x2); -} - -extern "unadjusted" { fn test_i8x2_mixed_args(a: i8x2, c: i32, b: i8x2); -} - -extern "unadjusted" { fn test_i8x2_arr(a: i8x2); -} - -extern "unadjusted" { fn test_f32x2(a: f32x2); -} - -extern "unadjusted" { fn test_f32x2_arr(a: f32x2); -} - -extern "unadjusted" { fn test_simd(a: Simd<i32, 4>); -} - -extern "unadjusted" { fn test_simd_unaligned(a: Simd<i32, 3>); } @@ -62,6 +42,9 @@ extern "unadjusted" { // if the size is not a power of 2 // CHECK: %"Simd<i32, 3>" = type { [3 x i32] } +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] pub fn do_call() { unsafe { // CHECK: call void @test_i8x2(<2 x i8> <i8 32, i8 64> diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs index e7e4c40a099..5475bfb6b65 100644 --- a/tests/codegen/repr/transparent.rs +++ b/tests/codegen/repr/transparent.rs @@ -9,7 +9,7 @@ // For LoongArch: see codegen/loongarch-abi #![crate_type = "lib"] -#![feature(repr_simd, transparent_unions)] +#![feature(repr_simd, transparent_unions, arm_target_feature)] use std::marker::PhantomData; @@ -139,6 +139,9 @@ pub struct Vector(f32x4); // CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1) #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] pub extern "C" fn test_Vector(_: Vector) -> Vector { loop {} } diff --git a/tests/codegen/simd/extract-insert-dyn.rs b/tests/codegen/simd/extract-insert-dyn.rs index 584e2c7887a..2c64f5d3c09 100644 --- a/tests/codegen/simd/extract-insert-dyn.rs +++ b/tests/codegen/simd/extract-insert-dyn.rs @@ -1,6 +1,6 @@ //@compile-flags: -C opt-level=3 -C no-prepopulate-passes -#![feature(core_intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd, arm_target_feature)] #![no_std] #![crate_type = "lib"] #![allow(non_camel_case_types)] @@ -21,6 +21,9 @@ pub struct i8x16([i8; 16]); // CHECK-LABEL: dyn_simd_extract // CHECK: extractelement <16 x i8> %x, i32 %idx #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 { simd_extract_dyn(x, idx) } @@ -28,6 +31,9 @@ unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 { // CHECK-LABEL: literal_dyn_simd_extract // CHECK: extractelement <16 x i8> %x, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 { simd_extract_dyn(x, 7) } @@ -35,6 +41,9 @@ unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 { // CHECK-LABEL: const_dyn_simd_extract // CHECK: extractelement <16 x i8> %x, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 { simd_extract_dyn(x, const { 3 + 4 }) } @@ -42,6 +51,9 @@ unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 { // CHECK-LABEL: const_simd_extract // CHECK: extractelement <16 x i8> %x, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 { simd_extract(x, const { 3 + 4 }) } @@ -49,6 +61,9 @@ unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 { // CHECK-LABEL: dyn_simd_insert // CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { simd_insert_dyn(x, idx, e) } @@ -56,6 +71,9 @@ unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { // CHECK-LABEL: literal_dyn_simd_insert // CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert_dyn(x, 7, e) } @@ -63,6 +81,9 @@ unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { // CHECK-LABEL: const_dyn_simd_insert // CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert_dyn(x, const { 3 + 4 }, e) } @@ -70,6 +91,9 @@ unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { // CHECK-LABEL: const_simd_insert // CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 #[no_mangle] +#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] +#[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert(x, const { 3 + 4 }, e) } |
