1 ; RUN: llc < %s -march=x86-64 | FileCheck %s 2 3 declare void @bar() 4 5 define void @test1(i32* nocapture %X) nounwind { 6 entry: 7 %tmp1 = load i32* %X, align 4 8 %and = and i32 %tmp1, 255 9 %cmp = icmp eq i32 %and, 47 10 br i1 %cmp, label %if.then, label %if.end 11 12 if.then: 13 tail call void @bar() nounwind 14 br label %if.end 15 16 if.end: 17 ret void 18 ; CHECK-LABEL: test1: 19 ; CHECK: cmpb $47, (%{{rdi|rcx}}) 20 } 21 22 define void @test2(i32 %X) nounwind { 23 entry: 24 %and = and i32 %X, 255 25 %cmp = icmp eq i32 %and, 47 26 br i1 %cmp, label %if.then, label %if.end 27 28 if.then: 29 tail call void @bar() nounwind 30 br label %if.end 31 32 if.end: 33 ret void 34 ; CHECK-LABEL: test2: 35 ; CHECK: cmpb $47, %{{dil|cl}} 36 } 37 38 define void @test3(i32 %X) nounwind { 39 entry: 40 %and = and i32 %X, 255 41 %cmp = icmp eq i32 %and, 255 42 br i1 %cmp, label %if.then, label %if.end 43 44 if.then: 45 tail call void @bar() nounwind 46 br label %if.end 47 48 if.end: 49 ret void 50 ; CHECK-LABEL: test3: 51 ; CHECK: cmpb $-1, %{{dil|cl}} 52 } 53 54 ; PR16083 55 define i1 @test4(i64 %a, i32 %b) { 56 entry: 57 %tobool = icmp ne i32 %b, 0 58 br i1 %tobool, label %lor.end, label %lor.rhs 59 60 lor.rhs: ; preds = %entry 61 %and = and i64 0, %a 62 %tobool1 = icmp ne i64 %and, 0 63 br label %lor.end 64 65 lor.end: ; preds = %lor.rhs, %entry 66 %p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ] 67 ret i1 %p 68 } 69 70 @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 71 72 ; PR16551 73 define void @test5(i32 %X) nounwind { 74 entry: 75 %bf.load = load i56* bitcast ({ i8, i8, i8, i8, i8, i8, i8, i8 }* @x to i56*), align 4 76 %bf.lshr = lshr i56 %bf.load, 32 77 %bf.cast = trunc i56 %bf.lshr to i32 78 %cmp = icmp ne i32 %bf.cast, 1 79 br i1 %cmp, label %if.then, label %if.end 80 81 if.then: 82 tail call void @bar() nounwind 83 br label %if.end 84 85 if.end: 86 ret void 87 88 ; CHECK-LABEL: test5: 89 ; CHECK-NOT: cmpl $1,{{.*}}x+4 90 ; CHECK: ret 91 } 92