[llvm] 9869f84 - [SLP][NFC]Add a test with the incorrect analysis for UITOFP for signed operand

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 11:28:46 PST 2025


Author: Alexey Bataev
Date: 2025-02-28T11:28:38-08:00
New Revision: 9869f84f7ea3ac10b885931d4ed3dd064819684b

URL: https://github.com/llvm/llvm-project/commit/9869f84f7ea3ac10b885931d4ed3dd064819684b
DIFF: https://github.com/llvm/llvm-project/commit/9869f84f7ea3ac10b885931d4ed3dd064819684b.diff

LOG: [SLP][NFC]Add a test with the incorrect analysis for UITOFP for signed operand

Added: 
    llvm/test/Transforms/SLPVectorizer/X86/uitofp-with-signed-value-bitwidth.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/uitofp-with-signed-value-bitwidth.ll b/llvm/test/Transforms/SLPVectorizer/X86/uitofp-with-signed-value-bitwidth.ll
new file mode 100644
index 0000000000000..de6140f75424b
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/uitofp-with-signed-value-bitwidth.ll
@@ -0,0 +1,43 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+
+define i32 @test(ptr %d, i32 %0) {
+; CHECK-LABEL: define i32 @test(
+; CHECK-SAME: ptr [[D:%.*]], i32 [[TMP0:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[TMP0]], i32 0
+; CHECK-NEXT:    [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[TMP3:%.*]] = uitofp <2 x i32> [[TMP2]] to <2 x double>
+; CHECK-NEXT:    [[TMP4:%.*]] = fdiv <2 x double> [[TMP3]], zeroinitializer
+; CHECK-NEXT:    [[TMP5:%.*]] = fcmp ogt <2 x double> [[TMP4]], zeroinitializer
+; CHECK-NEXT:    [[TMP6:%.*]] = extractelement <2 x i1> [[TMP5]], i32 1
+; CHECK-NEXT:    [[G_0_I_I:%.*]] = select i1 [[TMP6]], double 1.000000e+00, double 0.000000e+00
+; CHECK-NEXT:    [[CONV3_I_I:%.*]] = fptosi double [[G_0_I_I]] to i32
+; CHECK-NEXT:    store i32 [[CONV3_I_I]], ptr [[D]], align 4
+; CHECK-NEXT:    [[TMP7:%.*]] = extractelement <2 x i1> [[TMP5]], i32 0
+; CHECK-NEXT:    br i1 [[TMP7]], label %[[K_EXIT:.*]], label %[[IF_THEN_I:.*]]
+; CHECK:       [[IF_THEN_I]]:
+; CHECK-NEXT:    unreachable
+; CHECK:       [[K_EXIT]]:
+; CHECK-NEXT:    ret i32 0
+;
+entry:
+  %sub.i.i = sext i32 %0 to i64
+  %conv.i.i = uitofp i64 %sub.i.i to double
+  %div.i.i = fdiv double %conv.i.i, 0.000000e+00
+  %cmp.i4.i = fcmp ogt double %div.i.i, 0.000000e+00
+  %g.0.i.i = select i1 %cmp.i4.i, double 1.000000e+00, double 0.000000e+00
+  %conv3.i.i = fptosi double %g.0.i.i to i32
+  %sub.i.i6 = sext i32 %0 to i64
+  %conv.i.i7 = uitofp i64 %sub.i.i6 to double
+  %div.i.i8 = fdiv double %conv.i.i7, 0.000000e+00
+  %cmp.i4.i9 = fcmp ogt double %div.i.i8, 0.000000e+00
+  store i32 %conv3.i.i, ptr %d, align 4
+  br i1 %cmp.i4.i9, label %k.exit, label %if.then.i
+
+if.then.i:
+  unreachable
+
+k.exit:
+  ret i32 0
+}


        


More information about the llvm-commits mailing list