1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-apple-darwin -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
9 tracksRegLiveness: true
10 machineFunctionInfo: {}
13 liveins: $s0, $s1, $w0
15 ; CHECK-LABEL: name: select_f32
16 ; CHECK: liveins: $s0, $s1, $w0
18 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
19 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr(s32) = COPY $s0
20 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr(s32) = COPY $s1
21 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:fpr(s32) = G_SELECT [[COPY]](s32), [[COPY1]], [[COPY2]]
22 ; CHECK-NEXT: $s0 = COPY [[SELECT]](s32)
23 ; CHECK-NEXT: RET_ReallyLR implicit $s0
27 %4:_(s32) = G_SELECT %3, %1, %2
29 RET_ReallyLR implicit $s0
36 tracksRegLiveness: true
37 machineFunctionInfo: {}
40 liveins: $d0, $d1, $w0
42 ; CHECK-LABEL: name: select_f64
43 ; CHECK: liveins: $d0, $d1, $w0
45 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
46 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr(s64) = COPY $d0
47 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr(s64) = COPY $d1
48 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:fpr(s64) = G_SELECT [[COPY]](s32), [[COPY1]], [[COPY2]]
49 ; CHECK-NEXT: $d0 = COPY [[SELECT]](s64)
50 ; CHECK-NEXT: RET_ReallyLR implicit $d0
54 %4:_(s64) = G_SELECT %3, %1, %2
56 RET_ReallyLR implicit $d0
60 name: two_fpr_inputs_gpr_output
63 tracksRegLiveness: true
64 machineFunctionInfo: {}
67 liveins: $d0, $d1, $w0
69 ; Verify that the G_SELECT only has FPRs.
70 ; The only difference between fcsel and csel are the register banks. So,
71 ; if we have two FPR inputs and a GPR output, we should do a floating point
72 ; select anyway. This will cost one copy for the output, but that's less
73 ; than doing two to put the inputs on GPRs.
75 ; CHECK-LABEL: name: two_fpr_inputs_gpr_output
76 ; CHECK: liveins: $d0, $d1, $w0
78 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
79 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr(s64) = COPY $d0
80 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr(s64) = COPY $d1
81 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:fpr(s64) = G_SELECT [[COPY]](s32), [[COPY1]], [[COPY2]]
82 ; CHECK-NEXT: $x0 = COPY [[SELECT]](s64)
83 ; CHECK-NEXT: RET_ReallyLR implicit $x0
87 %4:_(s64) = G_SELECT %3, %1, %2
89 RET_ReallyLR implicit $x0
93 name: one_fpr_input_fpr_output
96 tracksRegLiveness: true
97 machineFunctionInfo: {}
100 liveins: $d0, $x1, $w0
102 ; Same idea as the above test. If the output is an FPR, and one of the
103 ; inputs is an FPR, then it's fewer copies to just do a FCSEL.
105 ; CHECK-LABEL: name: one_fpr_input_fpr_output
106 ; CHECK: liveins: $d0, $x1, $w0
108 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr(s64) = COPY $d0
110 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr(s64) = COPY $x1
111 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr(s64) = COPY [[COPY2]](s64)
112 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:fpr(s64) = G_SELECT [[COPY]](s32), [[COPY1]], [[COPY3]]
113 ; CHECK-NEXT: $d0 = COPY [[SELECT]](s64)
114 ; CHECK-NEXT: RET_ReallyLR implicit $d0
118 %4:_(s64) = G_SELECT %3, %1, %2
120 RET_ReallyLR implicit $d0
124 name: one_fpr_input_gpr_output
127 tracksRegLiveness: true
128 machineFunctionInfo: {}
131 liveins: $d0, $x1, $w0
133 ; Now we have more GPR registers on the G_SELECT. It's cheaper here to put
136 ; CHECK-LABEL: name: one_fpr_input_gpr_output
137 ; CHECK: liveins: $d0, $x1, $w0
139 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
140 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr(s64) = COPY $d0
141 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr(s64) = COPY $x1
142 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr(s64) = COPY [[COPY1]](s64)
143 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:gpr(s64) = G_SELECT [[COPY]](s32), [[COPY3]], [[COPY2]]
144 ; CHECK-NEXT: $x0 = COPY [[SELECT]](s64)
145 ; CHECK-NEXT: RET_ReallyLR implicit $x0
149 %4:_(s64) = G_SELECT %3, %1, %2
151 RET_ReallyLR implicit $x0
155 name: two_gpr_input_fpr_output
158 tracksRegLiveness: true
159 machineFunctionInfo: {}
162 liveins: $x0, $x1, $w0
164 ; Same as above. The G_SELECT should get all GPRS.
166 ; CHECK-LABEL: name: two_gpr_input_fpr_output
167 ; CHECK: liveins: $x0, $x1, $w0
169 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY $w0
170 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr(s64) = COPY $x0
171 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr(s64) = COPY $x1
172 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:gpr(s64) = G_SELECT [[COPY]](s32), [[COPY1]], [[COPY2]]
173 ; CHECK-NEXT: $d0 = COPY [[SELECT]](s64)
174 ; CHECK-NEXT: RET_ReallyLR implicit $d0
178 %4:_(s64) = G_SELECT %3, %1, %2
180 RET_ReallyLR implicit $d0