[ARM] Better OR's for MVE compares
[llvm-core.git] / test / MC / AArch64 / arm64-branch-encoding.s
blob48c2099012f6820d7eb39b2b5c2934d11a6d9eae
1 ; RUN: llvm-mc -triple arm64-apple-darwin -show-encoding < %s | FileCheck %s
3 foo:
5 ;-----------------------------------------------------------------------------
6 ; Unconditional branch (register) instructions.
7 ;-----------------------------------------------------------------------------
9 ret
10 ; CHECK: encoding: [0xc0,0x03,0x5f,0xd6]
11 ret x1
12 ; CHECK: encoding: [0x20,0x00,0x5f,0xd6]
13 drps
14 ; CHECK: encoding: [0xe0,0x03,0xbf,0xd6]
15 eret
16 ; CHECK: encoding: [0xe0,0x03,0x9f,0xd6]
17 br x5
18 ; CHECK: encoding: [0xa0,0x00,0x1f,0xd6]
19 blr x9
20 ; CHECK: encoding: [0x20,0x01,0x3f,0xd6]
21 bl L1
22 ; CHECK: bl L1 ; encoding: [A,A,A,0b100101AA]
23 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_call26
25 ;-----------------------------------------------------------------------------
26 ; Contitional branch instructions.
27 ;-----------------------------------------------------------------------------
29 b L1
30 ; CHECK: b L1 ; encoding: [A,A,A,0b000101AA]
31 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch26
32 b.eq L1
33 ; CHECK: b.eq L1 ; encoding: [0bAAA00000,A,A,0x54]
34 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
35 b.ne L1
36 ; CHECK: b.ne L1 ; encoding: [0bAAA00001,A,A,0x54]
37 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
38 b.cs L1
39 ; CHECK: b.hs L1 ; encoding: [0bAAA00010,A,A,0x54]
40 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
41 b.cc L1
42 ; CHECK: b.lo L1 ; encoding: [0bAAA00011,A,A,0x54]
43 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
44 b.mi L1
45 ; CHECK: b.mi L1 ; encoding: [0bAAA00100,A,A,0x54]
46 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
47 b.pl L1
48 ; CHECK: b.pl L1 ; encoding: [0bAAA00101,A,A,0x54]
49 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
50 b.vs L1
51 ; CHECK: b.vs L1 ; encoding: [0bAAA00110,A,A,0x54]
52 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
53 b.vc L1
54 ; CHECK: b.vc L1 ; encoding: [0bAAA00111,A,A,0x54]
55 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
56 b.hi L1
57 ; CHECK: b.hi L1 ; encoding: [0bAAA01000,A,A,0x54]
58 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
59 b.ls L1
60 ; CHECK: b.ls L1 ; encoding: [0bAAA01001,A,A,0x54]
61 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
62 b.ge L1
63 ; CHECK: b.ge L1 ; encoding: [0bAAA01010,A,A,0x54]
64 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
65 b.lt L1
66 ; CHECK: b.lt L1 ; encoding: [0bAAA01011,A,A,0x54]
67 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
68 b.gt L1
69 ; CHECK: b.gt L1 ; encoding: [0bAAA01100,A,A,0x54]
70 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
71 b.le L1
72 ; CHECK: b.le L1 ; encoding: [0bAAA01101,A,A,0x54]
73 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
74 b.al L1
75 ; CHECK: b.al L1 ; encoding: [0bAAA01110,A,A,0x54]
76 ; CHECK: fixup A - offset: 0, value: L1, kind: fixup_aarch64_pcrel_branch19
77 L1:
78 b #28
79 ; CHECK: b #28
80 b.lt #28
81 ; CHECK: b.lt #28
82 b.cc #1048572
83 ; CHECK: b.lo #1048572 ; encoding: [0xe3,0xff,0x7f,0x54]
84 b #134217724
85 ; CHECK: b #134217724 ; encoding: [0xff,0xff,0xff,0x15]
86 b #-134217728
87 ; CHECK: b #-134217728 ; encoding: [0x00,0x00,0x00,0x16]
89 ;-----------------------------------------------------------------------------
90 ; Compare-and-branch instructions.
91 ;-----------------------------------------------------------------------------
93 cbz w1, foo
94 ; CHECK: encoding: [0bAAA00001,A,A,0x34]
95 cbz x1, foo
96 ; CHECK: encoding: [0bAAA00001,A,A,0xb4]
97 cbnz w2, foo
98 ; CHECK: encoding: [0bAAA00010,A,A,0x35]
99 cbnz x2, foo
100 ; CHECK: encoding: [0bAAA00010,A,A,0xb5]
101 cbz w1, #28
102 ; CHECK: cbz w1, #28
103 cbz w20, #1048572
104 ; CHECK: cbz w20, #1048572 ; encoding: [0xf4,0xff,0x7f,0x34]
105 cbnz x2, #-1048576
106 ; CHECK: cbnz x2, #-1048576 ; encoding: [0x02,0x00,0x80,0xb5]
109 ;-----------------------------------------------------------------------------
110 ; Bit-test-and-branch instructions.
111 ;-----------------------------------------------------------------------------
113 tbz x1, #3, foo
114 ; CHECK: encoding: [0bAAA00001,A,0b00011AAA,0x36]
115 tbnz x1, #63, foo
116 ; CHECK: encoding: [0bAAA00001,A,0b11111AAA,0xb7]
118 tbz w1, #3, foo
119 ; CHECK: encoding: [0bAAA00001,A,0b00011AAA,0x36]
120 tbnz w1, #31, foo
121 ; CHECK: encoding: [0bAAA00001,A,0b11111AAA,0x37]
123 tbz w1, #3, #28
124 ; CHECK: tbz w1, #3, #28
125 tbz w3, #5, #32764
126 ; CHECK: tbz w3, #5, #32764 ; encoding: [0xe3,0xff,0x2b,0x36]
127 tbnz x3, #8, #-32768
128 ; CHECK: tbnz w3, #8, #-32768 ; encoding: [0x03,0x00,0x44,0x37]
130 ;-----------------------------------------------------------------------------
131 ; Exception generation instructions.
132 ;-----------------------------------------------------------------------------
134 brk #1
135 ; CHECK: encoding: [0x20,0x00,0x20,0xd4]
136 dcps1 #2
137 ; CHECK: encoding: [0x41,0x00,0xa0,0xd4]
138 dcps2 #3
139 ; CHECK: encoding: [0x62,0x00,0xa0,0xd4]
140 dcps3 #4
141 ; CHECK: encoding: [0x83,0x00,0xa0,0xd4]
142 hlt #5
143 ; CHECK: encoding: [0xa0,0x00,0x40,0xd4]
144 hvc #6
145 ; CHECK: encoding: [0xc2,0x00,0x00,0xd4]
146 smc #7
147 ; CHECK: encoding: [0xe3,0x00,0x00,0xd4]
148 svc #8
149 ; CHECK: encoding: [0x01,0x01,0x00,0xd4]
151 ; The immediate defaults to zero for DCPSn
152 dcps1
153 dcps2
154 dcps3
156 ; CHECK: dcps1 ; encoding: [0x01,0x00,0xa0,0xd4]
157 ; CHECK: dcps2 ; encoding: [0x02,0x00,0xa0,0xd4]
158 ; CHECK: dcps3 ; encoding: [0x03,0x00,0xa0,0xd4]