1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s 3 4 declare void @bar() 5 6 define void @test1(i32* nocapture %X) nounwind minsize { 7 ; CHECK-LABEL: test1: 8 ; CHECK: # %bb.0: # %entry 9 ; CHECK-NEXT: cmpb $47, (%rdi) 10 ; CHECK-NEXT: je bar # TAILCALL 11 ; CHECK-NEXT: # %bb.1: # %if.end 12 ; CHECK-NEXT: retq 13 entry: 14 %tmp1 = load i32, i32* %X, align 4 15 %and = and i32 %tmp1, 255 16 %cmp = icmp eq i32 %and, 47 17 br i1 %cmp, label %if.then, label %if.end 18 19 if.then: 20 tail call void @bar() nounwind 21 br label %if.end 22 23 if.end: 24 ret void 25 } 26 27 define void @test2(i32 %X) nounwind minsize { 28 ; CHECK-LABEL: test2: 29 ; CHECK: # %bb.0: # %entry 30 ; CHECK-NEXT: cmpb $47, %dil 31 ; CHECK-NEXT: je bar # TAILCALL 32 ; CHECK-NEXT: # %bb.1: # %if.end 33 ; CHECK-NEXT: retq 34 entry: 35 %and = and i32 %X, 255 36 %cmp = icmp eq i32 %and, 47 37 br i1 %cmp, label %if.then, label %if.end 38 39 if.then: 40 tail call void @bar() nounwind 41 br label %if.end 42 43 if.end: 44 ret void 45 } 46 47 define void @test3(i32 %X) nounwind minsize { 48 ; CHECK-LABEL: test3: 49 ; CHECK: # %bb.0: # %entry 50 ; CHECK-NEXT: cmpb $-1, %dil 51 ; CHECK-NEXT: je bar # TAILCALL 52 ; CHECK-NEXT: # %bb.1: # %if.end 53 ; CHECK-NEXT: retq 54 entry: 55 %and = and i32 %X, 255 56 %cmp = icmp eq i32 %and, 255 57 br i1 %cmp, label %if.then, label %if.end 58 59 if.then: 60 tail call void @bar() nounwind 61 br label %if.end 62 63 if.end: 64 ret void 65 } 66 67 ; PR16083 68 define i1 @test4(i64 %a, i32 %b) { 69 ; CHECK-LABEL: test4: 70 ; CHECK: # %bb.0: # %entry 71 ; CHECK-NEXT: movb $1, %al 72 ; CHECK-NEXT: testl %esi, %esi 73 ; CHECK-NEXT: je .LBB3_1 74 ; CHECK-NEXT: # %bb.2: # %lor.end 75 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 76 ; CHECK-NEXT: retq 77 ; CHECK-NEXT: .LBB3_1: # %lor.rhs 78 ; CHECK-NEXT: xorl %eax, %eax 79 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 80 ; CHECK-NEXT: retq 81 entry: 82 %tobool = icmp ne i32 %b, 0 83 br i1 %tobool, label %lor.end, label %lor.rhs 84 85 lor.rhs: ; preds = %entry 86 %and = and i64 0, %a 87 %tobool1 = icmp ne i64 %and, 0 88 br label %lor.end 89 90 lor.end: ; preds = %lor.rhs, %entry 91 %p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ] 92 ret i1 %p 93 } 94 95 @x = global { i8, i8, i8, i8, i8, i8, i8, i8 } { i8 1, i8 0, i8 0, i8 0, i8 1, i8 0, i8 0, i8 1 }, align 4 96 97 ; PR16551 98 define void @test5(i32 %X) nounwind minsize { 99 ; CHECK-LABEL: test5: 100 ; CHECK: # %bb.0: # %entry 101 ; CHECK-NEXT: movzbl x+{{.*}}(%rip), %eax 102 ; CHECK-NEXT: shll $16, %eax 103 ; CHECK-NEXT: movzwl x+{{.*}}(%rip), %ecx 104 ; CHECK-NEXT: orl %eax, %ecx 105 ; CHECK-NEXT: cmpl $1, %ecx 106 ; CHECK-NEXT: jne bar # TAILCALL 107 ; CHECK-NEXT: # %bb.1: # %if.end 108 ; CHECK-NEXT: retq 109 entry: 110 %bf.load = load i56, i56* bitcast ({ i8, i8, i8, i8, i8, i8, i8, i8 }* @x to i56*), align 4 111 %bf.lshr = lshr i56 %bf.load, 32 112 %bf.cast = trunc i56 %bf.lshr to i32 113 %cmp = icmp ne i32 %bf.cast, 1 114 br i1 %cmp, label %if.then, label %if.end 115 116 if.then: 117 tail call void @bar() nounwind 118 br label %if.end 119 120 if.end: 121 ret void 122 } 123 124 define void @test2_1(i32 %X) nounwind minsize { 125 ; CHECK-LABEL: test2_1: 126 ; CHECK: # %bb.0: # %entry 127 ; CHECK-NEXT: movzbl %dil, %eax 128 ; CHECK-NEXT: cmpl $256, %eax # imm = 0x100 129 ; CHECK-NEXT: je bar # TAILCALL 130 ; CHECK-NEXT: # %bb.1: # %if.end 131 ; CHECK-NEXT: retq 132 entry: 133 %and = and i32 %X, 255 134 %cmp = icmp eq i32 %and, 256 135 br i1 %cmp, label %if.then, label %if.end 136 137 if.then: 138 tail call void @bar() nounwind 139 br label %if.end 140 141 if.end: 142 ret void 143 } 144 145 define void @test_sext_i8_icmp_1(i8 %x) nounwind minsize { 146 ; CHECK-LABEL: test_sext_i8_icmp_1: 147 ; CHECK: # %bb.0: # %entry 148 ; CHECK-NEXT: cmpb $1, %dil 149 ; CHECK-NEXT: je bar # TAILCALL 150 ; CHECK-NEXT: # %bb.1: # %if.end 151 ; CHECK-NEXT: retq 152 entry: 153 %sext = sext i8 %x to i32 154 %cmp = icmp eq i32 %sext, 1 155 br i1 %cmp, label %if.then, label %if.end 156 157 if.then: 158 tail call void @bar() nounwind 159 br label %if.end 160 161 if.end: 162 ret void 163 } 164 165 define void @test_sext_i8_icmp_47(i8 %x) nounwind minsize { 166 ; CHECK-LABEL: test_sext_i8_icmp_47: 167 ; CHECK: # %bb.0: # %entry 168 ; CHECK-NEXT: cmpb $47, %dil 169 ; CHECK-NEXT: je bar # TAILCALL 170 ; CHECK-NEXT: # %bb.1: # %if.end 171 ; CHECK-NEXT: retq 172 entry: 173 %sext = sext i8 %x to i32 174 %cmp = icmp eq i32 %sext, 47 175 br i1 %cmp, label %if.then, label %if.end 176 177 if.then: 178 tail call void @bar() nounwind 179 br label %if.end 180 181 if.end: 182 ret void 183 } 184 185 define void @test_sext_i8_icmp_127(i8 %x) nounwind minsize { 186 ; CHECK-LABEL: test_sext_i8_icmp_127: 187 ; CHECK: # %bb.0: # %entry 188 ; CHECK-NEXT: cmpb $127, %dil 189 ; CHECK-NEXT: je bar # TAILCALL 190 ; CHECK-NEXT: # %bb.1: # %if.end 191 ; CHECK-NEXT: retq 192 entry: 193 %sext = sext i8 %x to i32 194 %cmp = icmp eq i32 %sext, 127 195 br i1 %cmp, label %if.then, label %if.end 196 197 if.then: 198 tail call void @bar() nounwind 199 br label %if.end 200 201 if.end: 202 ret void 203 } 204 205 define void @test_sext_i8_icmp_neg1(i8 %x) nounwind minsize { 206 ; CHECK-LABEL: test_sext_i8_icmp_neg1: 207 ; CHECK: # %bb.0: # %entry 208 ; CHECK-NEXT: cmpb $-1, %dil 209 ; CHECK-NEXT: je bar # TAILCALL 210 ; CHECK-NEXT: # %bb.1: # %if.end 211 ; CHECK-NEXT: retq 212 entry: 213 %sext = sext i8 %x to i32 214 %cmp = icmp eq i32 %sext, -1 215 br i1 %cmp, label %if.then, label %if.end 216 217 if.then: 218 tail call void @bar() nounwind 219 br label %if.end 220 221 if.end: 222 ret void 223 } 224 225 define void @test_sext_i8_icmp_neg2(i8 %x) nounwind minsize { 226 ; CHECK-LABEL: test_sext_i8_icmp_neg2: 227 ; CHECK: # %bb.0: # %entry 228 ; CHECK-NEXT: cmpb $-2, %dil 229 ; CHECK-NEXT: je bar # TAILCALL 230 ; CHECK-NEXT: # %bb.1: # %if.end 231 ; CHECK-NEXT: retq 232 entry: 233 %sext = sext i8 %x to i32 234 %cmp = icmp eq i32 %sext, -2 235 br i1 %cmp, label %if.then, label %if.end 236 237 if.then: 238 tail call void @bar() nounwind 239 br label %if.end 240 241 if.end: 242 ret void 243 } 244 245 define void @test_sext_i8_icmp_neg127(i8 %x) nounwind minsize { 246 ; CHECK-LABEL: test_sext_i8_icmp_neg127: 247 ; CHECK: # %bb.0: # %entry 248 ; CHECK-NEXT: cmpb $-127, %dil 249 ; CHECK-NEXT: je bar # TAILCALL 250 ; CHECK-NEXT: # %bb.1: # %if.end 251 ; CHECK-NEXT: retq 252 entry: 253 %sext = sext i8 %x to i32 254 %cmp = icmp eq i32 %sext, -127 255 br i1 %cmp, label %if.then, label %if.end 256 257 if.then: 258 tail call void @bar() nounwind 259 br label %if.end 260 261 if.end: 262 ret void 263 } 264 265 define void @test_sext_i8_icmp_neg128(i8 %x) nounwind minsize { 266 ; CHECK-LABEL: test_sext_i8_icmp_neg128: 267 ; CHECK: # %bb.0: # %entry 268 ; CHECK-NEXT: cmpb $-128, %dil 269 ; CHECK-NEXT: je bar # TAILCALL 270 ; CHECK-NEXT: # %bb.1: # %if.end 271 ; CHECK-NEXT: retq 272 entry: 273 %sext = sext i8 %x to i32 274 %cmp = icmp eq i32 %sext, -128 275 br i1 %cmp, label %if.then, label %if.end 276 277 if.then: 278 tail call void @bar() nounwind 279 br label %if.end 280 281 if.end: 282 ret void 283 } 284 285 define void @test_sext_i8_icmp_255(i8 %x) nounwind minsize { 286 ; CHECK-LABEL: test_sext_i8_icmp_255: 287 ; CHECK: # %bb.0: # %entry 288 ; CHECK-NEXT: movb $1, %al 289 ; CHECK-NEXT: testb %al, %al 290 ; CHECK-NEXT: je bar # TAILCALL 291 ; CHECK-NEXT: # %bb.1: # %if.end 292 ; CHECK-NEXT: retq 293 entry: 294 %sext = sext i8 %x to i32 295 %cmp = icmp eq i32 %sext, 255 296 br i1 %cmp, label %if.then, label %if.end 297 298 if.then: 299 tail call void @bar() nounwind 300 br label %if.end 301 302 if.end: 303 ret void 304 } 305