11//@compile-flags: -C opt-level=3 -C no-prepopulate-passes
22
3- #![ feature( core_intrinsics, repr_simd) ]
3+ #![ feature( core_intrinsics, repr_simd, arm_target_feature ) ]
44#![ no_std]
55#![ crate_type = "lib" ]
66#![ allow( non_camel_case_types) ]
@@ -21,55 +21,79 @@ 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" ) ) ]
26+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
2427unsafe extern "C" fn dyn_simd_extract ( x : i8x16 , idx : u32 ) -> i8 {
2528 simd_extract_dyn ( x, idx)
2629}
2730
2831// CHECK-LABEL: literal_dyn_simd_extract
2932// CHECK: extractelement <16 x i8> %x, i32 7
3033#[ no_mangle]
34+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
35+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
36+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
3137unsafe extern "C" fn literal_dyn_simd_extract ( x : i8x16 ) -> i8 {
3238 simd_extract_dyn ( x, 7 )
3339}
3440
3541// CHECK-LABEL: const_dyn_simd_extract
3642// CHECK: extractelement <16 x i8> %x, i32 7
3743#[ no_mangle]
44+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
45+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
46+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
3847unsafe extern "C" fn const_dyn_simd_extract ( x : i8x16 ) -> i8 {
3948 simd_extract_dyn ( x, const { 3 + 4 } )
4049}
4150
4251// CHECK-LABEL: const_simd_extract
4352// CHECK: extractelement <16 x i8> %x, i32 7
4453#[ no_mangle]
54+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
55+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
56+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
4557unsafe extern "C" fn const_simd_extract ( x : i8x16 ) -> i8 {
4658 simd_extract ( x, const { 3 + 4 } )
4759}
4860
4961// CHECK-LABEL: dyn_simd_insert
5062// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx
5163#[ no_mangle]
64+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
65+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
66+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
5267unsafe extern "C" fn dyn_simd_insert ( x : i8x16 , e : i8 , idx : u32 ) -> i8x16 {
5368 simd_insert_dyn ( x, idx, e)
5469}
5570
5671// CHECK-LABEL: literal_dyn_simd_insert
5772// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
5873#[ no_mangle]
74+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
75+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
76+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
5977unsafe extern "C" fn literal_dyn_simd_insert ( x : i8x16 , e : i8 ) -> i8x16 {
6078 simd_insert_dyn ( x, 7 , e)
6179}
6280
6381// CHECK-LABEL: const_dyn_simd_insert
6482// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
6583#[ no_mangle]
84+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
85+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
86+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
6687unsafe extern "C" fn const_dyn_simd_insert ( x : i8x16 , e : i8 ) -> i8x16 {
6788 simd_insert_dyn ( x, const { 3 + 4 } , e)
6889}
6990
7091// CHECK-LABEL: const_simd_insert
7192// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7
7293#[ no_mangle]
94+ #[ cfg_attr( target_family = "wasm" , target_feature( enable = "simd128" ) ) ]
95+ #[ cfg_attr( target_arch = "arm" , target_feature( enable = "neon" ) ) ]
96+ #[ cfg_attr( target_arch = "x86" , target_feature( enable = "sse" ) ) ]
7397unsafe extern "C" fn const_simd_insert ( x : i8x16 , e : i8 ) -> i8x16 {
7498 simd_insert ( x, const { 3 + 4 } , e)
7599}
0 commit comments