about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-12-13 12:50:42 -0800
committerAlex Crichton <alex@alexcrichton.com>2018-12-13 14:05:12 -0800
commit5087aef79202e9f1411a0d0a0a74b0e63643a118 (patch)
treec698acf4b9af6e33b6165340583a4d1588ca7007 /src/test/codegen
parentf4a421ee3cf1259f0750ac7fabd19da1d8551e4c (diff)
downloadrust-5087aef79202e9f1411a0d0a0a74b0e63643a118.tar.gz
rust-5087aef79202e9f1411a0d0a0a74b0e63643a118.zip
rustc: Add an unstable `simd_select_bitmask` intrinsic
This is going to be required for binding a number of AVX-512 intrinsics
in the `stdsimd` repository, and this intrinsic is the same as
`simd_select` except that it takes a bitmask as the first argument
instead of a SIMD vector. This bitmask is then transmuted into a `<NN x
i8>` argument, depending on how many bits it is.

cc rust-lang-nursery/stdsimd#310
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/simd-intrinsic-generic-select.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/codegen/simd-intrinsic-generic-select.rs b/src/test/codegen/simd-intrinsic-generic-select.rs
index 8a64d7437d8..24a4b2b1b05 100644
--- a/src/test/codegen/simd-intrinsic-generic-select.rs
+++ b/src/test/codegen/simd-intrinsic-generic-select.rs
@@ -21,10 +21,15 @@ pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
 
 #[repr(simd)]
 #[derive(Copy, Clone, PartialEq, Debug)]
+pub struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32);
+
+#[repr(simd)]
+#[derive(Copy, Clone, PartialEq, Debug)]
 pub struct b8x4(pub i8, pub i8, pub i8, pub i8);
 
 extern "platform-intrinsic" {
     fn simd_select<T, U>(x: T, a: U, b: U) -> U;
+    fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U;
 }
 
 // CHECK-LABEL: @select
@@ -33,3 +38,10 @@ pub unsafe fn select(m: b8x4, a: f32x4, b: f32x4) -> f32x4 {
     // CHECK: select <4 x i1>
     simd_select(m, a, b)
 }
+
+// CHECK-LABEL: @select_bitmask
+#[no_mangle]
+pub unsafe fn select_bitmask(m: i8, a: f32x8, b: f32x8) -> f32x8 {
+    // CHECK: select <8 x i1>
+    simd_select_bitmask(m, a, b)
+}