[llvm] e5d9831 - [InstCombine] add more tests for vector cmp-bitcast; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 11:48:27 PDT 2021


Author: Sanjay Patel
Date: 2021-07-30T14:48:11-04:00
New Revision: e5d9831cf292df6ec8179aaec05a61fbd7349930

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

LOG: [InstCombine] add more tests for vector cmp-bitcast; NFC

D107170

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp-vec.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-vec.ll b/llvm/test/Transforms/InstCombine/icmp-vec.ll
index 2acb8e083e30..9e3ec69e5c1a 100644
--- a/llvm/test/Transforms/InstCombine/icmp-vec.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-vec.ll
@@ -478,6 +478,47 @@ define i1 @slt_cast_ne-1(<2 x i4> %x, <2 x i4> %y) {
   ret i1 %r
 }
 
+define i1 @ueq_cast_eq-1(<3 x float> %x, <3 x float> %y) {
+; CHECK-LABEL: @ueq_cast_eq-1(
+; CHECK-NEXT:    [[FC:%.*]] = fcmp ueq <3 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[B:%.*]] = bitcast <3 x i1> [[FC]] to i3
+; CHECK-NEXT:    [[R:%.*]] = icmp eq i3 [[B]], -1
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %fc = fcmp ueq <3 x float> %x, %y
+  %b = bitcast <3 x i1> %fc to i3
+  %r = icmp eq i3 %b, -1
+  ret i1 %r
+}
+
+define i1 @not_cast_ne-1(<3 x i1> %x) {
+; CHECK-LABEL: @not_cast_ne-1(
+; CHECK-NEXT:    [[NOT:%.*]] = xor <3 x i1> [[X:%.*]], <i1 true, i1 true, i1 true>
+; CHECK-NEXT:    [[B:%.*]] = bitcast <3 x i1> [[NOT]] to i3
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i3 [[B]], -1
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %not = xor <3 x i1> %x, <i1 -1, i1 -1, i1 -1>
+  %b = bitcast <3 x i1> %not to i3
+  %r = icmp ne i3 %b, -1
+  ret i1 %r
+}
+
+define i1 @not_cast_ne-1_uses(<3 x i2> %x, <3 x i2>* %p) {
+; CHECK-LABEL: @not_cast_ne-1_uses(
+; CHECK-NEXT:    [[NOT:%.*]] = xor <3 x i2> [[X:%.*]], <i2 -1, i2 -1, i2 -1>
+; CHECK-NEXT:    store <3 x i2> [[NOT]], <3 x i2>* [[P:%.*]], align 4
+; CHECK-NEXT:    [[B:%.*]] = bitcast <3 x i2> [[NOT]] to i6
+; CHECK-NEXT:    [[R:%.*]] = icmp ne i6 [[B]], -1
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  %not = xor <3 x i2> %x, <i2 -1, i2 -1, i2 -1>
+  store <3 x i2> %not, <3 x i2>* %p
+  %b = bitcast <3 x i2> %not to i6
+  %r = icmp ne i6 %b, -1
+  ret i1 %r
+}
+
 define i1 @eq_cast_sgt-1(<3 x i4> %x, <3 x i4> %y) {
 ; CHECK-LABEL: @eq_cast_sgt-1(
 ; CHECK-NEXT:    [[IC:%.*]] = icmp eq <3 x i4> [[X:%.*]], [[Y:%.*]]


        


More information about the llvm-commits mailing list