1 ; RUN: llc -verify-machineinstrs -mtriple=aarch64 < %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -cgp-verify-bfi-updates=true < %s | FileCheck %s
5 ; CHECK: tbz {{w[0-9]}}, #3, {{.LBB0_3}}
6 ; CHECK: tbz w[[REG1:[0-9]+]], #2, {{.LBB0_3}}
7 ; CHECK-NOT: and x{{[0-9]+}}, x[[REG1]], #0x4
8 ; CHECK-NOT: cbz x{{[0-9]+}}, .LBB0_3
11 define void @test1(i64 %A, i64 %B) {
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
20 if.then2: ; preds = %entry
21 tail call void @foo(i64 %A, i64 %B)
24 if.end3: ; preds = %if.then2, %entry
29 ; CHECK: cbz {{x[0-9]}}, {{.LBB1_3}}
30 ; CHECK: tbz w[[REG1:[0-9]+]], #3, {{.LBB1_3}}
31 ; CHECK-NOT: and x{{[0-9]+}}, x[[REG1]], #0x08
32 ; CHECK-NOT: cbz x{{[0-9]+}}, .LBB1_3
34 define void @test2(i64 %A, ptr readonly %B) #0 {
36 %tobool = icmp eq ptr %B, null
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
42 if.then2: ; preds = %entry
43 %0 = load i64, ptr %B, align 4
44 tail call void @foo(i64 %A, i64 %0)
47 if.end3: ; preds = %entry, %if.then2
51 ; Make sure we use the W variant when log2(mask) is < 32.
53 ; CHECK: tbz {{w[0-9]}}, #3, {{.LBB2_3}}
54 ; CHECK: tbz w[[REG1:[0-9]+]], #28, {{.LBB2_3}}
55 ; CHECK-NOT: and x{{[0-9]+}}, x[[REG1]]
56 ; CHECK-NOT: cbz x{{[0-9]+}}, .LBB2_3
57 define void @test3(i64 %A, i64 %B) {
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
67 if.then2: ; preds = %entry
68 tail call void @foo(i64 %A, i64 %B)
71 if.end3: ; preds = %if.then2, %entry
76 ; CHECK: tbz {{w[0-9]}}, #3, {{.LBB3_3}}
77 ; CHECK: tbz [[REG1:x[0-9]+]], #35, {{.LBB3_3}}
78 ; CHECK-NOT: and x{{[0-9]+}}, x[[REG1]]
79 ; CHECK-NOT: cbz x{{[0-9]+}}, .LBB2_3
80 define void @test4(i64 %A, i64 %B) {
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
90 if.then2: ; preds = %entry
91 tail call void @foo(i64 %A, i64 %B)
94 if.end3: ; preds = %if.then2, %entry
99 declare void @foo(i64, i64)