1; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnueabi < %s | FileCheck %s 2 3; CHECK-LABEL: test1 4; CHECK: tbz {{w[0-9]}}, #3, {{.LBB0_3}} 5; CHECK: tbz w[[REG1:[0-9]+]], #2, {{.LBB0_3}} 6; CHECK-NOT: and [[REG2:x[0-9]+]], x[[REG1]], #0x4 7; CHECK-NOT: cbz [[REG2]], {{.LBB0_3}} 8 9; CHECK: b 10define void @test1(i64 %A, i64 %B) { 11entry: 12 %and = and i64 %A, 4 13 %notlhs = icmp eq i64 %and, 0 14 %and.1 = and i64 %B, 8 15 %0 = icmp eq i64 %and.1, 0 16 %1 = or i1 %0, %notlhs 17 br i1 %1, label %if.end3, label %if.then2 18 19if.then2: ; preds = %entry 20 tail call void @foo(i64 %A, i64 %B) 21 br label %if.end3 22 23if.end3: ; preds = %if.then2, %entry 24 ret void 25} 26 27; CHECK-LABEL: test2 28; CHECK: cbz {{x[0-9]}}, {{.LBB1_3}} 29; CHECK: tbz w[[REG1:[0-9]+]], #3, {{.LBB1_3}} 30; CHECK-NOT: and [REG2:x[0-9]+], x[[REG1]], #0x08 31; CHECK-NOT: cbz [[REG2]], {{.LBB1_3}} 32 33define void @test2(i64 %A, i64* readonly %B) #0 { 34entry: 35 %tobool = icmp eq i64* %B, null 36 %and = and i64 %A, 8 37 %tobool1 = icmp eq i64 %and, 0 38 %or.cond = or i1 %tobool, %tobool1 39 br i1 %or.cond, label %if.end3, label %if.then2 40 41if.then2: ; preds = %entry 42 %0 = load i64, i64* %B, align 4 43 tail call void @foo(i64 %A, i64 %0) 44 br label %if.end3 45 46if.end3: ; preds = %entry, %if.then2 47 ret void 48} 49 50; Make sure we use the W variant when log2(mask) is < 32. 51; CHECK-LABEL: test3 52; CHECK: tbz {{w[0-9]}}, #3, {{.LBB2_3}} 53; CHECK: tbz w[[REG1:[0-9]+]], #28, {{.LBB2_3}} 54; CHECK-NOT: and [[REG2:x[0-9]+]], x[[REG1]] 55; CHECK-NOT: cbz [[REG2]], {{.LBB2_3}} 56define void @test3(i64 %A, i64 %B) { 57entry: 58 %shift = shl i64 1, 28 59 %and = and i64 %A, %shift 60 %notlhs = icmp eq i64 %and, 0 61 %and.1 = and i64 %B, 8 62 %0 = icmp eq i64 %and.1, 0 63 %1 = or i1 %0, %notlhs 64 br i1 %1, label %if.then2, label %if.end3 65 66if.then2: ; preds = %entry 67 tail call void @foo(i64 %A, i64 %B) 68 br label %if.end3 69 70if.end3: ; preds = %if.then2, %entry 71 ret void 72} 73 74; CHECK-LABEL: test4 75; CHECK: tbz {{w[0-9]}}, #3, {{.LBB3_3}} 76; CHECK: tbz [[REG1:x[0-9]+]], #35, {{.LBB3_3}} 77; CHECK-NOT: and [[REG2:x[0-9]+]], x[[REG1]] 78; CHECK-NOT: cbz [[REG2]], {{.LBB2_3}} 79define void @test4(i64 %A, i64 %B) { 80entry: 81 %shift = shl i64 1, 35 82 %and = and i64 %A, %shift 83 %notlhs = icmp eq i64 %and, 0 84 %and.1 = and i64 %B, 8 85 %0 = icmp eq i64 %and.1, 0 86 %1 = or i1 %0, %notlhs 87 br i1 %1, label %if.then2, label %if.end3 88 89if.then2: ; preds = %entry 90 tail call void @foo(i64 %A, i64 %B) 91 br label %if.end3 92 93if.end3: ; preds = %if.then2, %entry 94 ret void 95} 96 97 98declare void @foo(i64, i64) 99