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