3 // compile-flags: -C no-prepopulate-passes
7 #![feature(repr_simd, platform_intrinsics)]
8 #![allow(non_camel_case_types)]
11 #[derive(Copy, Clone, PartialEq, Debug)]
12 pub struct Vec2<T>(pub T, pub T);
15 #[derive(Copy, Clone, PartialEq, Debug)]
16 pub struct Vec4<T>(pub T, pub T, pub T, pub T);
18 extern "platform-intrinsic" {
19 fn simd_gather<T, P, M>(value: T, pointers: P, mask: M) -> T;
22 // CHECK-LABEL: @gather_f32x2
24 pub unsafe fn gather_f32x2(pointers: Vec2<*const f32>, mask: Vec2<i32>,
25 values: Vec2<f32>) -> Vec2<f32> {
26 // CHECK: call <2 x float> @llvm.masked.gather.v2f32.{{.+}}(<2 x {{float\*|ptr}}> {{.*}}, i32 {{.*}}, <2 x i1> {{.*}}, <2 x float> {{.*}})
27 simd_gather(values, pointers, mask)
30 // CHECK-LABEL: @gather_pf32x2
32 pub unsafe fn gather_pf32x2(pointers: Vec2<*const *const f32>, mask: Vec2<i32>,
33 values: Vec2<*const f32>) -> Vec2<*const f32> {
34 // CHECK: call <2 x {{float\*|ptr}}> @llvm.masked.gather.{{.+}}(<2 x {{float\*\*|ptr}}> {{.*}}, i32 {{.*}}, <2 x i1> {{.*}}, <2 x {{float\*|ptr}}> {{.*}})
35 simd_gather(values, pointers, mask)