]> git.proxmox.com Git - rustc.git/blame - src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs
New upstream version 1.33.0+dfsg1
[rustc.git] / src / test / ui / simd-intrinsic / simd-intrinsic-generic-comparison.rs
CommitLineData
a7813a04 1#![feature(repr_simd, platform_intrinsics)]
e9174d1e
SL
2
3#[repr(simd)]
4#[derive(Copy, Clone)]
5#[allow(non_camel_case_types)]
6struct i32x4(i32, i32, i32, i32);
7#[repr(simd)]
8#[derive(Copy, Clone)]
9#[allow(non_camel_case_types)]
10struct i16x8(i16, i16, i16, i16,
11 i16, i16, i16, i16);
12
13extern "platform-intrinsic" {
14 fn simd_eq<T, U>(x: T, y: T) -> U;
15 fn simd_ne<T, U>(x: T, y: T) -> U;
16 fn simd_lt<T, U>(x: T, y: T) -> U;
17 fn simd_le<T, U>(x: T, y: T) -> U;
18 fn simd_gt<T, U>(x: T, y: T) -> U;
19 fn simd_ge<T, U>(x: T, y: T) -> U;
20}
21
22fn main() {
23 let x = i32x4(0, 0, 0, 0);
24
25 unsafe {
26 simd_eq::<i32, i32>(0, 0);
27 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
28 simd_ne::<i32, i32>(0, 0);
29 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
30 simd_lt::<i32, i32>(0, 0);
31 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
32 simd_le::<i32, i32>(0, 0);
33 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
34 simd_gt::<i32, i32>(0, 0);
35 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
36 simd_ge::<i32, i32>(0, 0);
37 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
38
39 simd_eq::<_, i32>(x, x);
40 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
41 simd_ne::<_, i32>(x, x);
42 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
43 simd_lt::<_, i32>(x, x);
44 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
45 simd_le::<_, i32>(x, x);
46 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
47 simd_gt::<_, i32>(x, x);
48 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
49 simd_ge::<_, i32>(x, x);
50 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
51
52 simd_eq::<_, i16x8>(x, x);
53//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
54 simd_ne::<_, i16x8>(x, x);
55//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
56 simd_lt::<_, i16x8>(x, x);
57//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
58 simd_le::<_, i16x8>(x, x);
59//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
60 simd_gt::<_, i16x8>(x, x);
61//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
62 simd_ge::<_, i16x8>(x, x);
63//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
64 }
65}