Skip to content

Commit 5875605

Browse files
committed
wasm, arm need simd to be explicitly enabled
1 parent b5f5f62 commit 5875605

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

tests/codegen/const-vector.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,21 @@ pub struct Simd<T, const N: usize>([T; N]);
2828

2929
extern "unadjusted" {
3030
fn test_i8x2(a: i8x2);
31-
}
32-
33-
extern "unadjusted" {
3431
fn test_i8x2_two_args(a: i8x2, b: i8x2);
35-
}
36-
37-
extern "unadjusted" {
3832
fn test_i8x2_mixed_args(a: i8x2, c: i32, b: i8x2);
39-
}
40-
41-
extern "unadjusted" {
4233
fn test_i8x2_arr(a: i8x2);
43-
}
44-
45-
extern "unadjusted" {
4634
fn test_f32x2(a: f32x2);
47-
}
48-
49-
extern "unadjusted" {
5035
fn test_f32x2_arr(a: f32x2);
51-
}
52-
53-
extern "unadjusted" {
5436
fn test_simd(a: Simd<i32, 4>);
55-
}
56-
57-
extern "unadjusted" {
5837
fn test_simd_unaligned(a: Simd<i32, 3>);
5938
}
6039

6140
// Ensure the packed variant of the simd struct does not become a const vector
6241
// if the size is not a power of 2
6342
// CHECK: %"Simd<i32, 3>" = type { [3 x i32] }
6443

44+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
45+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
6546
pub fn do_call() {
6647
unsafe {
6748
// CHECK: call void @test_i8x2(<2 x i8> <i8 32, i8 64>

tests/codegen/repr/transparent.rs

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ pub struct Vector(f32x4);
139139

140140
// CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1)
141141
#[no_mangle]
142+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
143+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
142144
pub extern "C" fn test_Vector(_: Vector) -> Vector {
143145
loop {}
144146
}

tests/codegen/simd/extract-insert-dyn.rs

+16
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,71 @@ pub struct i8x16([i8; 16]);
2121
// CHECK-LABEL: dyn_simd_extract
2222
// CHECK: extractelement <16 x i8> %x, i32 %idx
2323
#[no_mangle]
24+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
25+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
2426
unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 {
2527
simd_extract_dyn(x, idx)
2628
}
2729

2830
// CHECK-LABEL: literal_dyn_simd_extract
2931
// CHECK: extractelement <16 x i8> %x, i32 7
3032
#[no_mangle]
33+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
34+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
3135
unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 {
3236
simd_extract_dyn(x, 7)
3337
}
3438

3539
// CHECK-LABEL: const_dyn_simd_extract
3640
// CHECK: extractelement <16 x i8> %x, i32 7
3741
#[no_mangle]
42+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
43+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
3844
unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 {
3945
simd_extract_dyn(x, const { 3 + 4 })
4046
}
4147

4248
// CHECK-LABEL: const_simd_extract
4349
// CHECK: extractelement <16 x i8> %x, i32 7
4450
#[no_mangle]
51+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
52+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
4553
unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 {
4654
simd_extract(x, const { 3 + 4 })
4755
}
4856

4957
// CHECK-LABEL: dyn_simd_insert
5058
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx
5159
#[no_mangle]
60+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
61+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
5262
unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 {
5363
simd_insert_dyn(x, idx, e)
5464
}
5565

5666
// CHECK-LABEL: literal_dyn_simd_insert
5767
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
5868
#[no_mangle]
69+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
70+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
5971
unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
6072
simd_insert_dyn(x, 7, e)
6173
}
6274

6375
// CHECK-LABEL: const_dyn_simd_insert
6476
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
6577
#[no_mangle]
78+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
79+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
6680
unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
6781
simd_insert_dyn(x, const { 3 + 4 }, e)
6882
}
6983

7084
// CHECK-LABEL: const_simd_insert
7185
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
7286
#[no_mangle]
87+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
88+
#[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
7389
unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 {
7490
simd_insert(x, const { 3 + 4 }, e)
7591
}

0 commit comments

Comments
 (0)