Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: tests_lit/llvm2ice_tests/cond-branch.ll

Issue 2275883002: [SubZero] Branch optimization (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Tests added for branch optimization. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/branch-opt.ll ('k') | tests_lit/llvm2ice_tests/uncond_br.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; Tests for conditional branch instructions 1 ; Tests for conditional branch instructions
2 2
3 ; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i \ 3 ; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i \
4 ; RUN: --filetype=asm --target mips32 -i %s --args -O2 --skip-unimplemented \ 4 ; RUN: --filetype=asm --target mips32 -i %s --args -O2 --skip-unimplemented \
5 ; RUN: -allow-externally-defined-symbols \ 5 ; RUN: -allow-externally-defined-symbols \
6 ; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \ 6 ; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \
7 ; RUN: --check-prefix=COMMON --check-prefix=MIPS32 7 ; RUN: --check-prefix=COMMON --check-prefix=MIPS32
8 8
9 ; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i \ 9 ; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i \
10 ; RUN: --filetype=asm --target mips32 -i %s --args -Om1 --skip-unimplemented \ 10 ; RUN: --filetype=asm --target mips32 -i %s --args -Om1 --skip-unimplemented \
11 ; RUN: -allow-externally-defined-symbols \ 11 ; RUN: -allow-externally-defined-symbols \
12 ; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \ 12 ; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \
13 ; RUN: --check-prefix=COMMON --check-prefix=MIPS32-OM1 13 ; RUN: --check-prefix=COMMON --check-prefix=MIPS32-OM1
14 14
15 define internal i32 @cond_br_eq(i32 %arg1, i32 %arg2) { 15 define internal i32 @cond_br_eq(i32 %arg1, i32 %arg2) {
16 entry: 16 entry:
17 %cmp1 = icmp eq i32 %arg1, %arg2 17 %cmp1 = icmp eq i32 %arg1, %arg2
18 br i1 %cmp1, label %branch1, label %branch2 18 br i1 %cmp1, label %branch1, label %branch2
19 branch1: 19 branch1:
20 ret i32 1 20 ret i32 1
21 branch2: 21 branch2:
22 ret i32 2 22 ret i32 2
23 } 23 }
24 ; COMMON-LABEL: cond_br_eq 24 ; COMMON-LABEL: cond_br_eq
25 ; MIPS32: bne 25 ; MIPS32: bne {{.*}} .Lcond_br_eq$branch2
26 ; MIPS32-NEXT: .Lcond_br_eq$branch1
26 ; MIPS32-OM1: xor 27 ; MIPS32-OM1: xor
27 ; MIPS32-OM1: sltiu {{.*}}, {{.*}}, 1 28 ; MIPS32-OM1: sltiu {{.*}}, {{.*}}, 1
28 ; MIPS32-OM1: beqz 29 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_eq$branch2
30 ; MIPS32-OM1-NEXT: b .Lcond_br_eq$branch1
29 31
30 define internal i32 @cond_br_ne(i32 %arg1, i32 %arg2) { 32 define internal i32 @cond_br_ne(i32 %arg1, i32 %arg2) {
31 entry: 33 entry:
32 %cmp1 = icmp ne i32 %arg1, %arg2 34 %cmp1 = icmp ne i32 %arg1, %arg2
33 br i1 %cmp1, label %branch1, label %branch2 35 br i1 %cmp1, label %branch1, label %branch2
34 branch1: 36 branch1:
35 ret i32 1 37 ret i32 1
36 branch2: 38 branch2:
37 ret i32 2 39 ret i32 2
38 } 40 }
39 ; COMMON-LABEL: cond_br_ne 41 ; COMMON-LABEL: cond_br_ne
40 ; MIPS32: beq 42 ; MIPS32: beq {{.*}} .Lcond_br_ne$branch2
43 ; MIPS32-NEXT: .Lcond_br_ne$branch1
41 ; MIPS32-OM1: xor 44 ; MIPS32-OM1: xor
42 ; MIPS32-OM1: sltu {{.*}}, $zero, {{.*}} 45 ; MIPS32-OM1: sltu {{.*}}, $zero, {{.*}}
43 ; MIPS32-OM1: beqz 46 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_ne$branch2
47 ; MIPS32-OM1-NEXT: b .Lcond_br_ne$branch1
44 48
45 define internal i32 @cond_br_slt(i32 %arg1, i32 %arg2) { 49 define internal i32 @cond_br_slt(i32 %arg1, i32 %arg2) {
46 entry: 50 entry:
47 %cmp1 = icmp slt i32 %arg1, %arg2 51 %cmp1 = icmp slt i32 %arg1, %arg2
48 br i1 %cmp1, label %branch1, label %branch2 52 br i1 %cmp1, label %branch1, label %branch2
49 branch1: 53 branch1:
50 ret i32 1 54 ret i32 1
51 branch2: 55 branch2:
52 ret i32 2 56 ret i32 2
53 } 57 }
54 ; COMMON-LABEL: cond_br_slt 58 ; COMMON-LABEL: cond_br_slt
55 ; MIPS32: slt 59 ; MIPS32: slt
56 ; MIPS32: beqz 60 ; MIPS32: beqz {{.*}} .Lcond_br_slt$branch2
61 ; MIPS32-NEXT: .Lcond_br_slt$branch1
57 ; MIPS32-OM1: slt 62 ; MIPS32-OM1: slt
58 ; MIPS32-OM1: beqz 63 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_slt$branch2
64 ; MIPS32-OM1-NEXT: b .Lcond_br_slt$branch1
59 65
60 define internal i32 @cond_br_sle(i32 %arg1, i32 %arg2) { 66 define internal i32 @cond_br_sle(i32 %arg1, i32 %arg2) {
61 entry: 67 entry:
62 %cmp1 = icmp sle i32 %arg1, %arg2 68 %cmp1 = icmp sle i32 %arg1, %arg2
63 br i1 %cmp1, label %branch1, label %branch2 69 br i1 %cmp1, label %branch1, label %branch2
64 branch1: 70 branch1:
65 ret i32 1 71 ret i32 1
66 branch2: 72 branch2:
67 ret i32 2 73 ret i32 2
68 } 74 }
69 ; COMMON-LABEL: cond_br_sle 75 ; COMMON-LABEL: cond_br_sle
70 ; MIPS32: slt 76 ; MIPS32: slt
71 ; MIPS32: bnez 77 ; MIPS32: bnez {{.*}} .Lcond_br_sle$branch2
78 ; MIPS32-NEXT: .Lcond_br_sle$branch1
72 ; MIPS32-OM1: slt 79 ; MIPS32-OM1: slt
73 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1 80 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1
74 ; MIPS32-OM1: beqz 81 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_sle$branch2
82 ; MIPS32-OM1-NEXT: b .Lcond_br_sle$branch1
75 83
76 define internal i32 @cond_br_sgt(i32 %arg1, i32 %arg2) { 84 define internal i32 @cond_br_sgt(i32 %arg1, i32 %arg2) {
77 entry: 85 entry:
78 %cmp1 = icmp sgt i32 %arg1, %arg2 86 %cmp1 = icmp sgt i32 %arg1, %arg2
79 br i1 %cmp1, label %branch1, label %branch2 87 br i1 %cmp1, label %branch1, label %branch2
80 branch1: 88 branch1:
81 ret i32 1 89 ret i32 1
82 branch2: 90 branch2:
83 ret i32 2 91 ret i32 2
84 } 92 }
85 ; COMMON-LABEL: cond_br_sgt 93 ; COMMON-LABEL: cond_br_sgt
86 ; MIPS32: slt 94 ; MIPS32: slt
87 ; MIPS32: beqz 95 ; MIPS32-NEXT: beqz {{.*}} .Lcond_br_sgt$branch2
96 ; MIPS32-NEXT: .Lcond_br_sgt$branch1
88 ; MIPS32-OM1: slt 97 ; MIPS32-OM1: slt
89 ; MIPS32-OM1: beqz 98 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_sgt$branch2
99 ; MIPS32-OM1-NEXT: b .Lcond_br_sgt$branch1
90 100
91 define internal i32 @cond_br_sge(i32 %arg1, i32 %arg2) { 101 define internal i32 @cond_br_sge(i32 %arg1, i32 %arg2) {
92 entry: 102 entry:
93 %cmp1 = icmp sge i32 %arg1, %arg2 103 %cmp1 = icmp sge i32 %arg1, %arg2
94 br i1 %cmp1, label %branch1, label %branch2 104 br i1 %cmp1, label %branch1, label %branch2
95 branch1: 105 branch1:
96 ret i32 1 106 ret i32 1
97 branch2: 107 branch2:
98 ret i32 2 108 ret i32 2
99 } 109 }
100 ; COMMON-LABEL: cond_br_sge 110 ; COMMON-LABEL: cond_br_sge
101 ; MIPS32: slt 111 ; MIPS32: slt
102 ; MIPS32: bnez 112 ; MIPS32: bnez {{.*}} .Lcond_br_sge$branch2
113 ; MIPS32-NEXT: .Lcond_br_sge$branch1
103 ; MIPS32-OM1: slt 114 ; MIPS32-OM1: slt
104 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1 115 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1
105 ; MIPS32-OM1: beqz 116 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_sge$branch2
117 ; MIPS32-OM1-NEXT: b .Lcond_br_sge$branch1
106 118
107 define internal i32 @cond_br_ugt(i32 %arg1, i32 %arg2) { 119 define internal i32 @cond_br_ugt(i32 %arg1, i32 %arg2) {
108 entry: 120 entry:
109 %cmp1 = icmp ugt i32 %arg1, %arg2 121 %cmp1 = icmp ugt i32 %arg1, %arg2
110 br i1 %cmp1, label %branch1, label %branch2 122 br i1 %cmp1, label %branch1, label %branch2
111 branch1: 123 branch1:
112 ret i32 1 124 ret i32 1
113 branch2: 125 branch2:
114 ret i32 2 126 ret i32 2
115 } 127 }
116 ; COMMON-LABEL: cond_br_ugt 128 ; COMMON-LABEL: cond_br_ugt
117 ; MIPS32: sltu 129 ; MIPS32: sltu
118 ; MIPS32: beqz 130 ; MIPS32: beqz {{.*}} .Lcond_br_ugt$branch2
131 ; MIPS32-NEXT: .Lcond_br_ugt$branch1
119 ; MIPS32-OM1: sltu 132 ; MIPS32-OM1: sltu
120 ; MIPS32-OM1: beqz 133 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_ugt$branch2
134 ; MIPS32-OM1-NEXT: b .Lcond_br_ugt$branch1
121 135
122 define internal i32 @cond_br_uge(i32 %arg1, i32 %arg2) { 136 define internal i32 @cond_br_uge(i32 %arg1, i32 %arg2) {
123 entry: 137 entry:
124 %cmp1 = icmp uge i32 %arg1, %arg2 138 %cmp1 = icmp uge i32 %arg1, %arg2
125 br i1 %cmp1, label %branch1, label %branch2 139 br i1 %cmp1, label %branch1, label %branch2
126 branch1: 140 branch1:
127 ret i32 1 141 ret i32 1
128 branch2: 142 branch2:
129 ret i32 2 143 ret i32 2
130 } 144 }
131 ; COMMON-LABEL: cond_br_uge 145 ; COMMON-LABEL: cond_br_uge
132 ; MIPS32: sltu 146 ; MIPS32: sltu
133 ; MIPS32: bnez 147 ; MIPS32: bnez {{.*}} .Lcond_br_uge$branch2
148 ; MIPS32-NEXT: .Lcond_br_uge$branch1
134 ; MIPS32-OM1: sltu 149 ; MIPS32-OM1: sltu
135 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1 150 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1
136 ; MIPS32-OM1: beqz 151 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_uge$branch2
152 ; MIPS32-OM1-NEXT: b .Lcond_br_uge$branch1
137 153
138 define internal i32 @cond_br_ult(i32 %arg1, i32 %arg2) { 154 define internal i32 @cond_br_ult(i32 %arg1, i32 %arg2) {
139 entry: 155 entry:
140 %cmp1 = icmp ult i32 %arg1, %arg2 156 %cmp1 = icmp ult i32 %arg1, %arg2
141 br i1 %cmp1, label %branch1, label %branch2 157 br i1 %cmp1, label %branch1, label %branch2
142 branch1: 158 branch1:
143 ret i32 1 159 ret i32 1
144 branch2: 160 branch2:
145 ret i32 2 161 ret i32 2
146 } 162 }
147 ; COMMON-LABEL: cond_br_ult 163 ; COMMON-LABEL: cond_br_ult
148 ; MIPS32: sltu 164 ; MIPS32: sltu
149 ; MIPS32: beqz 165 ; MIPS32: beqz {{.*}} .Lcond_br_ult$branch2
166 ; MIPS32-NEXT: .Lcond_br_ult$branch1
150 ; MIPS32-OM1: sltu 167 ; MIPS32-OM1: sltu
151 ; MIPS32-OM1: beqz 168 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_ult$branch2
169 ; MIPS32-OM1-NEXT: b .Lcond_br_ult$branch1
152 170
153 define internal i32 @cond_br_ule(i32 %arg1, i32 %arg2) { 171 define internal i32 @cond_br_ule(i32 %arg1, i32 %arg2) {
154 entry: 172 entry:
155 %cmp1 = icmp ule i32 %arg1, %arg2 173 %cmp1 = icmp ule i32 %arg1, %arg2
156 br i1 %cmp1, label %branch1, label %branch2 174 br i1 %cmp1, label %branch1, label %branch2
157 branch1: 175 branch1:
158 ret i32 1 176 ret i32 1
159 branch2: 177 branch2:
160 ret i32 2 178 ret i32 2
161 } 179 }
162 ; COMMON-LABEL: cond_br_ule 180 ; COMMON-LABEL: cond_br_ule
163 ; MIPS32: sltu 181 ; MIPS32: sltu
164 ; MIPS32: bnez 182 ; MIPS32: bnez {{.*}} .Lcond_br_ule$branch2
183 ; MIPS32-NEXT: .Lcond_br_ule$branch1
165 ; MIPS32-OM1: sltu 184 ; MIPS32-OM1: sltu
166 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1 185 ; MIPS32-OM1: xori {{.*}}, {{.*}}, 1
167 ; MIPS32-OM1: beqz 186 ; MIPS32-OM1: beqz {{.*}} .Lcond_br_ule$branch2
187 ; MIPS32-OM1-NEXT: b .Lcond_br_ule$branch1
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/branch-opt.ll ('k') | tests_lit/llvm2ice_tests/uncond_br.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698