|
| 1 | +// Copyright 2016 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 | +// compile-flags: -C no-prepopulate-passes |
| 12 | + |
| 13 | +#![crate_type = "lib"] |
| 14 | + |
| 15 | +#![feature(repr_simd, platform_intrinsics)] |
| 16 | +#[allow(non_camel_case_types)] |
| 17 | + |
| 18 | +#[repr(simd)] |
| 19 | +#[derive(Copy, Clone, PartialEq, Debug)] |
| 20 | +pub struct f32x4(pub f32, pub f32, pub f32, pub f32); |
| 21 | + |
| 22 | +#[repr(simd)] |
| 23 | +#[derive(Copy, Clone, PartialEq, Debug)] |
| 24 | +pub struct b8x4(pub i8, pub i8, pub i8, pub i8); |
| 25 | + |
| 26 | +extern "platform-intrinsic" { |
| 27 | + fn simd_select<T, U>(x: T, a: U, b: U) -> U; |
| 28 | +} |
| 29 | + |
| 30 | +// CHECK-LABEL: @select |
| 31 | +#[no_mangle] |
| 32 | +pub unsafe fn select(m: b8x4, a: f32x4, b: f32x4) -> f32x4 { |
| 33 | + // CHECK: select <4 x i1> |
| 34 | + simd_select(m, a, b) |
| 35 | +} |
0 commit comments