1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
4 define i32 @test1(i32 %a, i32 %b) nounwind readnone {
7 ; CHECK-NEXT: movl %esi, %eax
8 ; CHECK-NEXT: cmpl $1, %edi
9 ; CHECK-NEXT: sbbl $-1, %eax
11 %not.cmp = icmp ne i32 %a, 0
12 %inc = zext i1 %not.cmp to i32
13 %retval.0 = add i32 %inc, %b
17 define i32 @test1_commute(i32 %a, i32 %b) nounwind readnone {
18 ; CHECK-LABEL: test1_commute:
20 ; CHECK-NEXT: movl %esi, %eax
21 ; CHECK-NEXT: cmpl $1, %edi
22 ; CHECK-NEXT: sbbl $-1, %eax
24 %cmp = icmp ne i32 %a, 0
25 %inc = zext i1 %cmp to i32
26 %ret = add i32 %b, %inc
30 define i32 @test2(i32 %a, i32 %b) nounwind readnone {
33 ; CHECK-NEXT: movl %esi, %eax
34 ; CHECK-NEXT: cmpl $1, %edi
35 ; CHECK-NEXT: adcl $0, %eax
37 %cmp = icmp eq i32 %a, 0
38 %inc = zext i1 %cmp to i32
39 %retval.0 = add i32 %inc, %b
43 define i32 @test3(i32 %a, i32 %b) nounwind readnone {
46 ; CHECK-NEXT: movl %esi, %eax
47 ; CHECK-NEXT: cmpl $1, %edi
48 ; CHECK-NEXT: adcl $0, %eax
50 %cmp = icmp eq i32 %a, 0
51 %inc = zext i1 %cmp to i32
52 %retval.0 = add i32 %inc, %b
56 define i32 @test4(i32 %a, i32 %b) nounwind readnone {
59 ; CHECK-NEXT: movl %esi, %eax
60 ; CHECK-NEXT: cmpl $1, %edi
61 ; CHECK-NEXT: sbbl $-1, %eax
63 %not.cmp = icmp ne i32 %a, 0
64 %inc = zext i1 %not.cmp to i32
65 %retval.0 = add i32 %inc, %b
69 define i32 @test5(i32 %a, i32 %b) nounwind readnone {
72 ; CHECK-NEXT: movl %esi, %eax
73 ; CHECK-NEXT: cmpl $1, %edi
74 ; CHECK-NEXT: adcl $-1, %eax
76 %not.cmp = icmp ne i32 %a, 0
77 %inc = zext i1 %not.cmp to i32
78 %retval.0 = sub i32 %b, %inc
82 define i32 @test6(i32 %a, i32 %b) nounwind readnone {
85 ; CHECK-NEXT: movl %esi, %eax
86 ; CHECK-NEXT: cmpl $1, %edi
87 ; CHECK-NEXT: sbbl $0, %eax
89 %cmp = icmp eq i32 %a, 0
90 %inc = zext i1 %cmp to i32
91 %retval.0 = sub i32 %b, %inc
95 define i32 @test7(i32 %a, i32 %b) nounwind readnone {
98 ; CHECK-NEXT: movl %esi, %eax
99 ; CHECK-NEXT: cmpl $1, %edi
100 ; CHECK-NEXT: sbbl $0, %eax
102 %cmp = icmp eq i32 %a, 0
103 %inc = zext i1 %cmp to i32
104 %retval.0 = sub i32 %b, %inc
108 define i32 @test8(i32 %a, i32 %b) nounwind readnone {
109 ; CHECK-LABEL: test8:
111 ; CHECK-NEXT: movl %esi, %eax
112 ; CHECK-NEXT: cmpl $1, %edi
113 ; CHECK-NEXT: adcl $-1, %eax
115 %not.cmp = icmp ne i32 %a, 0
116 %inc = zext i1 %not.cmp to i32
117 %retval.0 = sub i32 %b, %inc