1 # RUN: llc -O0 -mtriple=aarch64 -run-pass=instruction-select -global-isel-abort=1 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,LINUX-DEFAULT
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 define dso_local void @frame_index() {
11 define dso_local i8* @ptr_mask(i8* %in) { ret i8* undef }
13 @var_local = dso_local global i8 0
14 define dso_local i8* @global_local() { ret i8* undef }
16 @var_got = external dso_local global i8
17 define dso_local i8* @global_got() { ret i8* undef }
19 define dso_local void @icmp() { ret void }
20 define dso_local void @fcmp() { ret void }
22 define dso_local void @phi() { ret void }
24 define dso_local void @select() { ret void }
28 # CHECK-LABEL: name: frame_index
34 # CHECK-NEXT: - { id: 0, class: gpr64sp, preferred-register: '' }
36 - { id: 0, class: gpr }
39 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
42 # CHECK: %0:gpr64sp = ADDXri %stack.0.ptr0, 0, 0
45 %0(p0) = G_FRAME_INDEX %stack.0.ptr0
52 # CHECK-LABEL: name: ptr_mask
58 # CHECK: %2:gpr64sp = ANDXri %0, 8060
63 %const:gpr(s64) = G_CONSTANT i64 -8
64 %1:gpr(p0) = G_PTRMASK %0, %const
69 # Global defined in the same linkage unit so no GOT is needed
70 # CHECK-LABEL: name: global_local
75 - { id: 0, class: gpr }
78 # LINUX-DEFAULT: %0:gpr64common = MOVaddr target-flags(aarch64-page) @var_local, target-flags(aarch64-pageoff, aarch64-nc) @var_local
81 %0(p0) = G_GLOBAL_VALUE @var_local
86 # CHECK-LABEL: name: global_got
91 - { id: 0, class: gpr }
94 # LINUX-DEFAULT: %0:gpr64common = MOVaddr target-flags(aarch64-page) @var_got, target-flags(aarch64-pageoff, aarch64-nc) @var_got
97 %0(p0) = G_GLOBAL_VALUE @var_got
102 # CHECK-LABEL: name: icmp
105 regBankSelected: true
108 # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' }
109 # CHECK-NEXT: - { id: 1, class: gpr32, preferred-register: '' }
110 # CHECK-NEXT: - { id: 2, class: gpr64, preferred-register: '' }
111 # CHECK-NEXT: - { id: 3, class: gpr32, preferred-register: '' }
112 # CHECK-NEXT: - { id: 4, class: gpr64, preferred-register: '' }
113 # CHECK-NEXT: - { id: 5, class: gpr32, preferred-register: '' }
115 - { id: 0, class: gpr }
116 - { id: 1, class: gpr }
117 - { id: 2, class: gpr }
118 - { id: 3, class: gpr }
119 - { id: 4, class: gpr }
120 - { id: 5, class: gpr }
121 - { id: 6, class: gpr }
122 - { id: 7, class: gpr }
123 - { id: 8, class: gpr }
124 - { id: 9, class: gpr }
125 - { id: 10, class: gpr }
126 - { id: 11, class: gpr }
129 # CHECK: SUBSWrr %0, %0, implicit-def $nzcv
130 # CHECK: %1:gpr32 = CSINCWr $wzr, $wzr, 1, implicit $nzcv
132 # CHECK: SUBSXrr %2, %2, implicit-def $nzcv
133 # CHECK: %3:gpr32 = CSINCWr $wzr, $wzr, 3, implicit $nzcv
135 # CHECK: SUBSXrr %4, %4, implicit-def $nzcv
136 # CHECK: %5:gpr32 = CSINCWr $wzr, $wzr, 0, implicit $nzcv
143 %1(s32) = G_ICMP intpred(eq), %0, %0
147 %3(s32) = G_ICMP intpred(uge), %2, %2
151 %5(s32) = G_ICMP intpred(ne), %4, %4
156 # CHECK-LABEL: name: fcmp
159 regBankSelected: true
162 # CHECK-NEXT: - { id: 0, class: fpr32, preferred-register: '' }
163 # CHECK-NEXT: - { id: 1, class: gpr32, preferred-register: '' }
164 # CHECK-NEXT: - { id: 2, class: fpr64, preferred-register: '' }
165 # CHECK-NEXT: - { id: 3, class: gpr32, preferred-register: '' }
166 # CHECK-NEXT: - { id: 4, class: gpr32, preferred-register: '' }
167 # CHECK-NEXT: - { id: 5, class: gpr32, preferred-register: '' }
169 - { id: 0, class: fpr }
170 - { id: 1, class: gpr }
171 - { id: 2, class: fpr }
172 - { id: 3, class: gpr }
175 # CHECK: nofpexcept FCMPSrr %0, %0, implicit-def $nzcv
176 # CHECK: [[TST_MI:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 5, implicit $nzcv
177 # CHECK: [[TST_GT:%[0-9]+]]:gpr32 = CSINCWr $wzr, $wzr, 13, implicit $nzcv
178 # CHECK: %1:gpr32 = ORRWrr [[TST_MI]], [[TST_GT]]
180 # CHECK: nofpexcept FCMPDrr %2, %2, implicit-def $nzcv
181 # CHECK: %3:gpr32 = CSINCWr $wzr, $wzr, 4, implicit $nzcv
188 %1(s32) = G_FCMP floatpred(one), %0, %0
192 %3(s32) = G_FCMP floatpred(uge), %2, %2
198 # CHECK-LABEL: name: phi
201 regBankSelected: true
202 tracksRegLiveness: true
205 # CHECK-NEXT: - { id: 0, class: fpr32, preferred-register: '' }
206 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
207 # CHECK-NEXT: - { id: 2, class: fpr32, preferred-register: '' }
208 # CHECK-NEXT: - { id: 3, class: gpr32, preferred-register: '' }
210 - { id: 0, class: fpr }
211 - { id: 1, class: gpr }
212 - { id: 2, class: fpr }
216 # CHECK: %2:fpr32 = PHI %0, %bb.0, %2, %bb.1
223 %3:gpr(s32) = COPY $w0
226 successors: %bb.1, %bb.2
227 %2(s32) = PHI %0, %bb.0, %2, %bb.1
232 RET_ReallyLR implicit $s0
236 # CHECK-LABEL: name: select
239 regBankSelected: true
240 tracksRegLiveness: true
243 # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' }
244 # CHECK-NEXT: - { id: 1, class: gpr32, preferred-register: '' }
245 # CHECK-NEXT: - { id: 2, class: gpr32, preferred-register: '' }
246 # CHECK-NEXT: - { id: 3, class: gpr32, preferred-register: '' }
247 # CHECK-NEXT: - { id: 4, class: gpr64, preferred-register: '' }
248 # CHECK-NEXT: - { id: 5, class: gpr64, preferred-register: '' }
249 # CHECK-NEXT: - { id: 6, class: gpr64, preferred-register: '' }
250 # CHECK-NEXT: - { id: 7, class: gpr64, preferred-register: '' }
251 # CHECK-NEXT: - { id: 8, class: gpr64, preferred-register: '' }
252 # CHECK-NEXT: - { id: 9, class: gpr64, preferred-register: '' }
254 - { id: 0, class: gpr }
255 - { id: 1, class: gpr }
256 - { id: 2, class: gpr }
257 - { id: 3, class: gpr }
258 - { id: 4, class: gpr }
259 - { id: 5, class: gpr }
260 - { id: 6, class: gpr }
261 - { id: 7, class: gpr }
262 - { id: 8, class: gpr }
263 - { id: 9, class: gpr }
266 # CHECK: ANDSWri %0, 0, implicit-def $nzcv
267 # CHECK: %3:gpr32 = CSELWr %1, %2, 1, implicit $nzcv
268 # CHECK: ANDSWri %0, 0, implicit-def $nzcv
269 # CHECK: %6:gpr64 = CSELXr %4, %5, 1, implicit $nzcv
270 # CHECK: ANDSWri %0, 0, implicit-def $nzcv
271 # CHECK: %9:gpr64 = CSELXr %7, %8, 1, implicit $nzcv
274 liveins: $w0, $w1, $w2
275 %0:gpr(s32) = COPY $w0
279 %3(s32) = G_SELECT %0, %1, %2
284 %6(s64) = G_SELECT %0, %4, %5
289 %9(p0) = G_SELECT %0, %7, %8