[llvm] 88cff86 - [InstCombine] Add tests for #113301 (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 08:44:44 PST 2024


Author: Nikita Popov
Date: 2024-11-26T17:44:35+01:00
New Revision: 88cff867a58247d0c1da19e537eb8801a54ed38e

URL: https://github.com/llvm/llvm-project/commit/88cff867a58247d0c1da19e537eb8801a54ed38e
DIFF: https://github.com/llvm/llvm-project/commit/88cff867a58247d0c1da19e537eb8801a54ed38e.diff

LOG: [InstCombine] Add tests for #113301 (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/select-value-equivalence.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/select-value-equivalence.ll b/llvm/test/Transforms/InstCombine/select-value-equivalence.ll
index da2e59d760f96f..d55766ddf40405 100644
--- a/llvm/test/Transforms/InstCombine/select-value-equivalence.ll
+++ b/llvm/test/Transforms/InstCombine/select-value-equivalence.ll
@@ -309,3 +309,28 @@ define <2 x float> @select_fcmp_fadd_une_zero_vec(<2 x float> %x, <2 x float> %y
   %retval = select <2 x i1> %fcmp, <2 x float> %x, <2 x float> %fadd
   ret <2 x float> %retval
 }
+
+define <2 x i8> @select_vec_op_const_no_undef(<2 x i8> %x) {
+; CHECK-LABEL: define <2 x i8> @select_vec_op_const_no_undef(
+; CHECK-SAME: <2 x i8> [[X:%.*]]) {
+; CHECK-NEXT:    [[XZ:%.*]] = icmp eq <2 x i8> [[X]], <i8 1, i8 2>
+; CHECK-NEXT:    [[XR:%.*]] = select <2 x i1> [[XZ]], <2 x i8> <i8 1, i8 2>, <2 x i8> <i8 4, i8 3>
+; CHECK-NEXT:    ret <2 x i8> [[XR]]
+;
+  %xz = icmp eq <2 x i8> %x, <i8 1, i8 2>
+  %xr = select <2 x i1> %xz, <2 x i8> %x, <2 x i8> <i8 4, i8 3>
+  ret <2 x i8> %xr
+}
+
+; FIXME: This is a miscompile.
+define <2 x i8> @select_vec_op_const_undef(<2 x i8> %x) {
+; CHECK-LABEL: define <2 x i8> @select_vec_op_const_undef(
+; CHECK-SAME: <2 x i8> [[X:%.*]]) {
+; CHECK-NEXT:    [[XZ:%.*]] = icmp eq <2 x i8> [[X]], <i8 1, i8 undef>
+; CHECK-NEXT:    [[XR:%.*]] = select <2 x i1> [[XZ]], <2 x i8> <i8 1, i8 undef>, <2 x i8> <i8 4, i8 3>
+; CHECK-NEXT:    ret <2 x i8> [[XR]]
+;
+  %xz = icmp eq <2 x i8> %x, <i8 1, i8 undef>
+  %xr = select <2 x i1> %xz, <2 x i8> %x, <2 x i8> <i8 4, i8 3>
+  ret <2 x i8> %xr
+}


        


More information about the llvm-commits mailing list