]> git.proxmox.com Git - rustc.git/blame - src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / ui / simd-intrinsic / simd-intrinsic-generic-arithmetic-saturating.rs
CommitLineData
dfeec247 1// build-fail
9fa01778 2// ignore-emscripten
9fa01778
XL
3#![feature(repr_simd, platform_intrinsics)]
4#![allow(non_camel_case_types)]
5#[repr(simd)]
6#[derive(Copy, Clone)]
7pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
8
9#[repr(simd)]
10#[derive(Copy, Clone)]
11pub struct x4<T>(pub T, pub T, pub T, pub T);
12
13#[repr(simd)]
14#[derive(Copy, Clone)]
15pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
16
17extern "platform-intrinsic" {
18 fn simd_saturating_add<T>(x: T, y: T) -> T;
19 fn simd_saturating_sub<T>(x: T, y: T) -> T;
20}
21
22fn main() {
23 let x = i32x4(0, 0, 0, 0);
24 let y = x4(0_usize, 0, 0, 0);
25 let z = f32x4(0.0, 0.0, 0.0, 0.0);
26
27 unsafe {
28 simd_saturating_add(x, x);
29 simd_saturating_add(y, y);
30 simd_saturating_sub(x, x);
31 simd_saturating_sub(y, y);
32
33 simd_saturating_add(z, z);
34 //~^ ERROR expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type
35 simd_saturating_sub(z, z);
36 //~^ ERROR expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type
37 }
38}