From 431bb12d06bf46c96c9992a0ca75e67ef562eb0e Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 22 Mar 2019 16:39:04 +0000 Subject: [PATCH] [Tests] Add masked.gather tests for non-constant masks + speculation possibilities git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356782 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../InstCombine/masked_intrinsics.ll | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/Transforms/InstCombine/masked_intrinsics.ll b/test/Transforms/InstCombine/masked_intrinsics.ll index 77189da8cc2..22d3f11d8a5 100644 --- a/test/Transforms/InstCombine/masked_intrinsics.ll +++ b/test/Transforms/InstCombine/masked_intrinsics.ll @@ -187,6 +187,43 @@ define <2 x double> @gather_lane0(double* %base, double %pt) { ret <2 x double> %res } +define <2 x double> @gather_lane0_maybe(double* %base, double %pt, +; CHECK-LABEL: @gather_lane0_maybe( +; CHECK-NEXT: [[PTRS:%.*]] = getelementptr double, double* [[BASE:%.*]], <2 x i64> +; CHECK-NEXT: [[PT_V1:%.*]] = insertelement <2 x double> undef, double [[PT:%.*]], i64 0 +; CHECK-NEXT: [[PT_V2:%.*]] = shufflevector <2 x double> [[PT_V1]], <2 x double> undef, <2 x i32> zeroinitializer +; CHECK-NEXT: [[MASK2:%.*]] = insertelement <2 x i1> [[MASK:%.*]], i1 false, i64 1 +; CHECK-NEXT: [[RES:%.*]] = call <2 x double> @llvm.masked.gather.v2f64.v2p0f64(<2 x double*> [[PTRS]], i32 4, <2 x i1> [[MASK2]], <2 x double> [[PT_V2]]) +; CHECK-NEXT: ret <2 x double> [[RES]] +; + <2 x i1> %mask) { + %ptrs = getelementptr double, double *%base, <2 x i64> + %pt_v1 = insertelement <2 x double> undef, double %pt, i64 0 + %pt_v2 = insertelement <2 x double> %pt_v1, double %pt, i64 1 + %mask2 = insertelement <2 x i1> %mask, i1 false, i64 1 + %res = call <2 x double> @llvm.masked.gather.v2f64.v2p0f64(<2 x double*> %ptrs, i32 4, <2 x i1> %mask2, <2 x double> %pt_v2) + ret <2 x double> %res +} + +define <2 x double> @gather_lane0_maybe_spec(double* %base, double %pt, +; CHECK-LABEL: @gather_lane0_maybe_spec( +; CHECK-NEXT: [[PTRS:%.*]] = getelementptr double, double* [[BASE:%.*]], <2 x i64> +; CHECK-NEXT: [[PT_V1:%.*]] = insertelement <2 x double> undef, double [[PT:%.*]], i64 0 +; CHECK-NEXT: [[PT_V2:%.*]] = shufflevector <2 x double> [[PT_V1]], <2 x double> undef, <2 x i32> zeroinitializer +; CHECK-NEXT: [[MASK2:%.*]] = insertelement <2 x i1> [[MASK:%.*]], i1 false, i64 1 +; CHECK-NEXT: [[RES:%.*]] = call <2 x double> @llvm.masked.gather.v2f64.v2p0f64(<2 x double*> [[PTRS]], i32 4, <2 x i1> [[MASK2]], <2 x double> [[PT_V2]]) +; CHECK-NEXT: ret <2 x double> [[RES]] +; + <2 x i1> %mask) { + %ptrs = getelementptr double, double *%base, <2 x i64> + %pt_v1 = insertelement <2 x double> undef, double %pt, i64 0 + %pt_v2 = insertelement <2 x double> %pt_v1, double %pt, i64 1 + %mask2 = insertelement <2 x i1> %mask, i1 false, i64 1 + %res = call <2 x double> @llvm.masked.gather.v2f64.v2p0f64(<2 x double*> %ptrs, i32 4, <2 x i1> %mask2, <2 x double> %pt_v2) + ret <2 x double> %res +} + + define void @scatter_zeromask(<2 x double*> %ptrs, <2 x double> %val) { ; CHECK-LABEL: @scatter_zeromask( ; CHECK-NEXT: ret void -- 2.40.0