]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/simd-intrinsic-generic-cast.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(repr_simd, platform_intrinsics, rustc_attrs)]
14 #[derive(Copy, Clone)]
15 #[allow(non_camel_case_types)]
16 struct i32x4(i32, i32, i32, i32);
18 #[derive(Copy, Clone)]
19 #[allow(non_camel_case_types)]
20 struct i32x8(i32, i32, i32, i32,
24 #[derive(Copy, Clone)]
25 #[allow(non_camel_case_types)]
26 struct f32x4(f32, f32, f32, f32);
28 #[derive(Copy, Clone)]
29 #[allow(non_camel_case_types)]
30 struct f32x8(f32, f32, f32, f32,
34 extern "platform-intrinsic" {
35 fn simd_cast
<T
, U
>(x
: T
) -> U
;
38 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
40 let x
= i32x4(0, 0, 0, 0);
43 simd_cast
::<i32, i32>(0);
44 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
45 simd_cast
::<i32, i32x4
>(0);
46 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
47 simd_cast
::<i32x4
, i32>(x
);
48 //~^ ERROR expected SIMD return type, found non-SIMD `i32`
49 simd_cast
::<_
, i32x8
>(x
);
50 //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8