3 // Test that the simd_select intrinsic produces ok-ish error
4 // messages when misused.
6 #![feature(repr_simd, platform_intrinsics)]
7 #![allow(non_camel_case_types)]
10 #[derive(Copy, Clone)]
11 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
14 #[derive(Copy, Clone)]
15 pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
18 #[derive(Copy, Clone, PartialEq)]
19 struct b8x4(pub i8, pub i8, pub i8, pub i8);
22 #[derive(Copy, Clone, PartialEq)]
23 struct b8x8(pub i8, pub i8, pub i8, pub i8,
24 pub i8, pub i8, pub i8, pub i8);
26 extern "platform-intrinsic" {
27 fn simd_select<T, U>(x: T, a: U, b: U) -> U;
28 fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U;
32 let m4 = b8x4(0, 0, 0, 0);
33 let m8 = b8x8(0, 0, 0, 0, 0, 0, 0, 0);
34 let x = u32x4(0, 0, 0, 0);
35 let z = f32x4(0.0, 0.0, 0.0, 0.0);
38 simd_select(m4, x, x);
40 simd_select(m8, x, x);
41 //~^ ERROR mismatched lengths: mask length `8` != other vector length `4`
44 //~^ ERROR mask element type is `u32`, expected `i_`
47 //~^ ERROR mask element type is `f32`, expected `i_`
49 simd_select(m4, 0u32, 1u32);
50 //~^ ERROR found non-SIMD `u32`
52 simd_select_bitmask(0u16, x, x);
53 //~^ ERROR mask length `16` != other vector length `4`
55 simd_select_bitmask(0u8, 1u32, 2u32);
56 //~^ ERROR found non-SIMD `u32`
58 simd_select_bitmask(0.0f32, x, x);
59 //~^ ERROR `f32` is not an integral type
61 simd_select_bitmask("x", x, x);
62 //~^ ERROR `&str` is not an integral type