]> git.lizzy.rs Git - rust.git/blob - tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs
Auto merge of #106660 - saethlin:destprop-move-codegen, r=tmiasko
[rust.git] / tests / codegen / simd-intrinsic / simd-intrinsic-generic-select.rs
1 // compile-flags: -C no-prepopulate-passes
2
3 #![crate_type = "lib"]
4
5 #![feature(repr_simd, platform_intrinsics)]
6 #[allow(non_camel_case_types)]
7
8 #[repr(simd)]
9 #[derive(Copy, Clone, PartialEq, Debug)]
10 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
11
12 #[repr(simd)]
13 #[derive(Copy, Clone, PartialEq, Debug)]
14 pub struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32);
15
16 #[repr(simd)]
17 #[derive(Copy, Clone, PartialEq, Debug)]
18 pub struct b8x4(pub i8, pub i8, pub i8, pub i8);
19
20 extern "platform-intrinsic" {
21     fn simd_select<T, U>(x: T, a: U, b: U) -> U;
22     fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U;
23 }
24
25 // CHECK-LABEL: @select
26 #[no_mangle]
27 pub unsafe fn select(m: b8x4, a: f32x4, b: f32x4) -> f32x4 {
28     // CHECK: select <4 x i1>
29     simd_select(m, a, b)
30 }
31
32 // CHECK-LABEL: @select_bitmask
33 #[no_mangle]
34 pub unsafe fn select_bitmask(m: i8, a: f32x8, b: f32x8) -> f32x8 {
35     // CHECK: select <8 x i1>
36     simd_select_bitmask(m, a, b)
37 }