summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/zext.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstCombine/zext.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/zext.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/zext.ll b/llvm/test/Transforms/InstCombine/zext.ll
index d431dbdfde1..2420393bfb1 100644
--- a/llvm/test/Transforms/InstCombine/zext.ll
+++ b/llvm/test/Transforms/InstCombine/zext.ll
@@ -46,3 +46,30 @@ define <2 x i64> @test4(<2 x i64> %A) {
ret <2 x i64> %zext
}
+; FIXME: If the xor was done in the smaller type, the back-to-back zexts would get combined.
+
+define i64 @fold_xor_zext_sandwich(i1 %a) {
+; CHECK-LABEL: @fold_xor_zext_sandwich(
+; CHECK-NEXT: [[ZEXT1:%.*]] = zext i1 %a to i32
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[ZEXT1]], 1
+; CHECK-NEXT: [[ZEXT2:%.*]] = zext i32 [[XOR]] to i64
+; CHECK-NEXT: ret i64 [[ZEXT2]]
+;
+ %zext1 = zext i1 %a to i32
+ %xor = xor i32 %zext1, 1
+ %zext2 = zext i32 %xor to i64
+ ret i64 %zext2
+}
+
+define <2 x i64> @fold_xor_zext_sandwich_vec(<2 x i1> %a) {
+; CHECK-LABEL: @fold_xor_zext_sandwich_vec(
+; CHECK-NEXT: [[ZEXT1:%.*]] = zext <2 x i1> %a to <2 x i64>
+; CHECK-NEXT: [[XOR:%.*]] = xor <2 x i64> [[ZEXT1]], <i64 1, i64 1>
+; CHECK-NEXT: ret <2 x i64> [[XOR]]
+;
+ %zext1 = zext <2 x i1> %a to <2 x i32>
+ %xor = xor <2 x i32> %zext1, <i32 1, i32 1>
+ %zext2 = zext <2 x i32> %xor to <2 x i64>
+ ret <2 x i64> %zext2
+}
+
OpenPOWER on IntegriCloud