]> git.lizzy.rs Git - rust.git/blob - src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs
Various minor/cosmetic improvements to code
[rust.git] / src / test / ui / simd-intrinsic / simd-intrinsic-single-nominal-type.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.
4 //
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.
10
11 #![feature(repr_simd, platform_intrinsics)]
12
13 #[repr(simd)]
14 struct A(i16, i16, i16, i16, i16, i16, i16, i16);
15 #[repr(simd)]
16 struct B(i16, i16, i16, i16, i16, i16, i16, i16);
17
18 // each intrinsic definition has to use the same nominal type for any
19 // vector structure throughout that declaration (i.e., every instance
20 // of i16x8 in each `fn ...;` needs to be either A or B)
21
22 extern "platform-intrinsic" {
23     fn x86_mm_adds_epi16(x: A, y: A) -> B;
24     //~^ ERROR intrinsic return value has wrong type: found `B`, expected `A`
25     fn x86_mm_subs_epi16(x: A, y: B) -> A;
26     //~^ ERROR intrinsic argument 2 has wrong type: found `B`, expected `A`
27
28     // ok:
29     fn x86_mm_max_epi16(x: B, y: B) -> B;
30     fn x86_mm_min_epi16(x: A, y: A) -> A;
31 }
32
33 fn main() {}