Skip to content

Commit 8b62073

Browse files
committed
wasm needs simd to be explicitly enabled
1 parent b5f5f62 commit 8b62073

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

tests/codegen/const-vector.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,20 @@ 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"))]
6545
pub fn do_call() {
6646
unsafe {
6747
// CHECK: call void @test_i8x2(<2 x i8> <i8 32, i8 64>

tests/codegen/repr/transparent.rs

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ 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"))]
142143
pub extern "C" fn test_Vector(_: Vector) -> Vector {
143144
loop {}
144145
}

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

+8
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,63 @@ 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"))]
2425
unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 {
2526
simd_extract_dyn(x, idx)
2627
}
2728

2829
// CHECK-LABEL: literal_dyn_simd_extract
2930
// CHECK: extractelement <16 x i8> %x, i32 7
3031
#[no_mangle]
32+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
3133
unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 {
3234
simd_extract_dyn(x, 7)
3335
}
3436

3537
// CHECK-LABEL: const_dyn_simd_extract
3638
// CHECK: extractelement <16 x i8> %x, i32 7
3739
#[no_mangle]
40+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
3841
unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 {
3942
simd_extract_dyn(x, const { 3 + 4 })
4043
}
4144

4245
// CHECK-LABEL: const_simd_extract
4346
// CHECK: extractelement <16 x i8> %x, i32 7
4447
#[no_mangle]
48+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
4549
unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 {
4650
simd_extract(x, const { 3 + 4 })
4751
}
4852

4953
// CHECK-LABEL: dyn_simd_insert
5054
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx
5155
#[no_mangle]
56+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
5257
unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 {
5358
simd_insert_dyn(x, idx, e)
5459
}
5560

5661
// CHECK-LABEL: literal_dyn_simd_insert
5762
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
5863
#[no_mangle]
64+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
5965
unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
6066
simd_insert_dyn(x, 7, e)
6167
}
6268

6369
// CHECK-LABEL: const_dyn_simd_insert
6470
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
6571
#[no_mangle]
72+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
6673
unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
6774
simd_insert_dyn(x, const { 3 + 4 }, e)
6875
}
6976

7077
// CHECK-LABEL: const_simd_insert
7178
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
7279
#[no_mangle]
80+
#[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
7381
unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 {
7482
simd_insert(x, const { 3 + 4 }, e)
7583
}

0 commit comments

Comments
 (0)