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)]
12 #![allow(non_camel_case_types)]
14 #[derive(Copy, Clone)]
15 pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
18 #[derive(Copy, Clone)]
19 pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
22 #[derive(Copy, Clone)]
23 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
25 extern "platform-intrinsic" {
26 fn simd_add<T>(x: T, y: T) -> T;
27 fn simd_sub<T>(x: T, y: T) -> T;
28 fn simd_mul<T>(x: T, y: T) -> T;
29 fn simd_div<T>(x: T, y: T) -> T;
30 fn simd_shl<T>(x: T, y: T) -> T;
31 fn simd_shr<T>(x: T, y: T) -> T;
32 fn simd_and<T>(x: T, y: T) -> T;
33 fn simd_or<T>(x: T, y: T) -> T;
34 fn simd_xor<T>(x: T, y: T) -> T;
37 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
39 let x = i32x4(0, 0, 0, 0);
40 let y = u32x4(0, 0, 0, 0);
41 let z = f32x4(0.0, 0.0, 0.0, 0.0);
69 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
71 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
73 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
75 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
77 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
79 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
81 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
83 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
85 //~^ ERROR expected SIMD input type, found non-SIMD `i32`
89 //~^ ERROR unsupported operation on `i32x4` with element `i32`
91 //~^ ERROR unsupported operation on `u32x4` with element `u32`
93 //~^ ERROR unsupported operation on `f32x4` with element `f32`
95 //~^ ERROR unsupported operation on `f32x4` with element `f32`
97 //~^ ERROR unsupported operation on `f32x4` with element `f32`
99 //~^ ERROR unsupported operation on `f32x4` with element `f32`
101 //~^ ERROR unsupported operation on `f32x4` with element `f32`