1 ; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnueabi < %s | FileCheck %s
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}}
10 define void @test1(i64 %A, i64 %B) {
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
19 if.then2: ; preds = %entry
20 tail call void @foo(i64 %A, i64 %B)
23 if.end3: ; preds = %if.then2, %entry
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}}
33 define void @test2(i64 %A, i64* readonly %B) #0 {
35 %tobool = icmp eq i64* %B, null
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
41 if.then2: ; preds = %entry
42 %0 = load i64, i64* %B, align 4
43 tail call void @foo(i64 %A, i64 %0)
46 if.end3: ; preds = %entry, %if.then2
50 ; Make sure we use the W variant when log2(mask) is < 32.
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}}
56 define void @test3(i64 %A, i64 %B) {
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
66 if.then2: ; preds = %entry
67 tail call void @foo(i64 %A, i64 %B)
70 if.end3: ; preds = %if.then2, %entry
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}}
79 define void @test4(i64 %A, i64 %B) {
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
89 if.then2: ; preds = %entry
90 tail call void @foo(i64 %A, i64 %B)
93 if.end3: ; preds = %if.then2, %entry
98 declare void @foo(i64, i64)