summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/cast.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstCombine/cast.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/cast.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll
index b4f14e115b6..4621d33d438 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -371,6 +371,21 @@ define <2 x i1> @test31vec(<2 x i64> %A) {
ret <2 x i1> %D
}
+; Verify that the 'and' was narrowed, the zext was eliminated, and the compare was narrowed
+; even for vectors. Earlier folds should ensure that the icmp(and(zext)) pattern never occurs.
+
+define <2 x i1> @test32vec(<2 x i8> %A) {
+; CHECK-LABEL: @test32vec(
+; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i8> %A, <i8 42, i8 42>
+; CHECK-NEXT: [[D:%.*]] = icmp eq <2 x i8> [[TMP1]], <i8 10, i8 10>
+; CHECK-NEXT: ret <2 x i1> [[D]]
+;
+ %B = zext <2 x i8> %A to <2 x i16>
+ %C = and <2 x i16> %B, <i16 42, i16 42>
+ %D = icmp eq <2 x i16> %C, <i16 10, i16 10>
+ ret <2 x i1> %D
+}
+
define i32 @test33(i32 %c1) {
; CHECK-LABEL: @test33(
; CHECK-NEXT: ret i32 %c1
OpenPOWER on IntegriCloud