about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-12-14 22:10:21 +0800
committerkennytm <kennytm@gmail.com>2018-12-14 22:17:52 +0800
commit3397b79868cdbfa87b55fef77176a8e8084f04d9 (patch)
treee8b8991b50efee7c164dd85662278936de4f6aac /src/test/codegen
parent4a0ee22bc2fdeb2de198edc5c3916f0066080de9 (diff)
parent5087aef79202e9f1411a0d0a0a74b0e63643a118 (diff)
downloadrust-3397b79868cdbfa87b55fef77176a8e8084f04d9.tar.gz
rust-3397b79868cdbfa87b55fef77176a8e8084f04d9.zip
Rollup merge of #56789 - alexcrichton:simd_select_bitmask, r=rkruppe
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)
+}