[llvm] 8f465a0 - [SLP][NFC]Add tests for constants/undefs used in insertelements, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 11:53:29 PDT 2021


Author: Alexey Bataev
Date: 2021-08-04T11:52:46-07:00
New Revision: 8f465a0cfb7b2596768f749839dd53ab6a5e8dd3

URL: https://github.com/llvm/llvm-project/commit/8f465a0cfb7b2596768f749839dd53ab6a5e8dd3
DIFF: https://github.com/llvm/llvm-project/commit/8f465a0cfb7b2596768f749839dd53ab6a5e8dd3.diff

LOG: [SLP][NFC]Add tests for constants/undefs used in insertelements, NFC.

Added: 
    

Modified: 
    llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll b/llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll
index 5cec75d85fea..17e19d36ff40 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/sitofp.ll
@@ -1096,6 +1096,40 @@ define <4 x double> @sitofp_4xi32_4f64(i32 %a0, i32 %a1, i32 %a2, i32 %a3) #0 {
   ret <4 x double> %res3
 }
 
+define <4 x double> @sitofp_with_const_4xi32_4f64(i32 %a2, i32 %a3) #0 {
+; CHECK-LABEL: @sitofp_with_const_4xi32_4f64(
+; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[A2:%.*]], i32 0
+; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[A3:%.*]], i32 1
+; CHECK-NEXT:    [[TMP3:%.*]] = sitofp <2 x i32> [[TMP2]] to <2 x double>
+; CHECK-NEXT:    [[RES0:%.*]] = insertelement <4 x double> undef, double 1.000000e+00, i32 3
+; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
+; CHECK-NEXT:    [[RES31:%.*]] = shufflevector <4 x double> [[RES0]], <4 x double> [[TMP4]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
+; CHECK-NEXT:    ret <4 x double> [[RES31]]
+;
+  %cvt2 = sitofp i32 %a2 to double
+  %cvt3 = sitofp i32 %a3 to double
+  %res0 = insertelement <4 x double> undef, double 1.0, i32 3
+  %res2 = insertelement <4 x double> %res0, double %cvt2, i32 0
+  %res3 = insertelement <4 x double> %res2, double %cvt3, i32 1
+  ret <4 x double> %res3
+}
+
+define <4 x double> @sitofp_with_undef_4xi32_4f64(i32 %a2, i32 %a3) #0 {
+; CHECK-LABEL: @sitofp_with_undef_4xi32_4f64(
+; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[A2:%.*]], i32 0
+; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[A3:%.*]], i32 1
+; CHECK-NEXT:    [[TMP3:%.*]] = sitofp <2 x i32> [[TMP2]] to <2 x double>
+; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
+; CHECK-NEXT:    [[RES31:%.*]] = shufflevector <4 x double> undef, <4 x double> [[TMP4]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
+; CHECK-NEXT:    ret <4 x double> [[RES31]]
+;
+  %cvt2 = sitofp i32 %a2 to double
+  %cvt3 = sitofp i32 %a3 to double
+  %res2 = insertelement <4 x double> undef, double %cvt2, i32 0
+  %res3 = insertelement <4 x double> %res2, double %cvt3, i32 1
+  ret <4 x double> %res3
+}
+
 define <4 x float> @sitofp_4xi32_4f32(i32 %a0, i32 %a1, i32 %a2, i32 %a3) #0 {
 ; CHECK-LABEL: @sitofp_4xi32_4f32(
 ; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <4 x i32> poison, i32 [[A0:%.*]], i32 0


        


More information about the llvm-commits mailing list