summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/cmp.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/X86/cmp.ll')
-rw-r--r--test/CodeGen/X86/cmp.ll31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/CodeGen/X86/cmp.ll b/test/CodeGen/X86/cmp.ll
index eb9a29011428e..d24f27ddf22c7 100644
--- a/test/CodeGen/X86/cmp.ll
+++ b/test/CodeGen/X86/cmp.ll
@@ -49,9 +49,9 @@ define i64 @test3(i64 %x) nounwind {
%r = zext i1 %t to i64
ret i64 %r
; CHECK-LABEL: test3:
+; CHECK: xorl %eax, %eax
; CHECK: testq %rdi, %rdi
; CHECK: sete %al
-; CHECK: movzbl %al, %eax
; CHECK: ret
}
@@ -60,9 +60,9 @@ define i64 @test4(i64 %x) nounwind {
%r = zext i1 %t to i64
ret i64 %r
; CHECK-LABEL: test4:
+; CHECK: xorl %eax, %eax
; CHECK: testq %rdi, %rdi
; CHECK: setle %al
-; CHECK: movzbl %al, %eax
; CHECK: ret
}
@@ -255,3 +255,30 @@ define zeroext i1 @test19(i32 %L) {
; CHECK: testl %edi, %edi
; CHECK: setns %al
}
+
+@d = global i8 0, align 1
+
+; This test failed due to incorrect handling of "shift + icmp" sequence
+define void @test20(i32 %bf.load, i8 %x1, i8* %b_addr) {
+ %bf.shl = shl i32 %bf.load, 8
+ %bf.ashr = ashr exact i32 %bf.shl, 8
+ %tobool4 = icmp ne i32 %bf.ashr, 0
+ %conv = zext i1 %tobool4 to i32
+ %conv6 = zext i8 %x1 to i32
+ %add = add nuw nsw i32 %conv, %conv6
+ %tobool7 = icmp ne i32 %add, 0
+ %frombool = zext i1 %tobool7 to i8
+ store i8 %frombool, i8* %b_addr, align 1
+ %tobool14 = icmp ne i32 %bf.shl, 0
+ %frombool15 = zext i1 %tobool14 to i8
+ store i8 %frombool15, i8* @d, align 1
+ ret void
+
+; CHECK-LABEL: test20
+; CHECK: andl
+; CHECK: setne
+; CHECK: addl
+; CHECK: setne
+; CHECK: testl
+; CHECK: setne
+} \ No newline at end of file