1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect -verify-machineinstrs -regbankselect-fast -o - %s | FileCheck -check-prefix=FAST %s
3 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect -verify-machineinstrs -regbankselect-greedy -o - %s | FileCheck -check-prefix=GREEDY %s
11 liveins: $sgpr0, $sgpr1
13 ; FAST-LABEL: name: smin_s32_ss
14 ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
15 ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
16 ; FAST: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
17 ; FAST: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[COPY]], [[COPY1]]
18 ; GREEDY-LABEL: name: smin_s32_ss
19 ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
20 ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
21 ; GREEDY: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
22 ; GREEDY: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[COPY]], [[COPY1]]
23 %0:_(s32) = COPY $sgpr0
24 %1:_(s32) = COPY $sgpr1
25 %2:_(s32) = G_SMIN %0, %1
34 liveins: $sgpr0, $vgpr0
36 ; FAST-LABEL: name: smin_s32_sv
37 ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
38 ; FAST: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
39 ; FAST: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
40 ; GREEDY-LABEL: name: smin_s32_sv
41 ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
42 ; GREEDY: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
43 ; GREEDY: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
44 %0:_(s32) = COPY $sgpr0
45 %1:_(s32) = COPY $vgpr0
46 %2:_(s32) = G_SMIN %0, %1
55 liveins: $sgpr0, $vgpr0
57 ; FAST-LABEL: name: smin_s32_vs
58 ; FAST: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
59 ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
60 ; FAST: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
61 ; FAST: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY2]]
62 ; GREEDY-LABEL: name: smin_s32_vs
63 ; GREEDY: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
64 ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
65 ; GREEDY: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
66 %0:_(s32) = COPY $vgpr0
67 %1:_(s32) = COPY $sgpr0
68 %2:_(s32) = G_SMIN %0, %1
77 liveins: $vgpr0, $vgpr1
79 ; FAST-LABEL: name: smin_s32_vv
80 ; FAST: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
81 ; FAST: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
82 ; FAST: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
83 ; GREEDY-LABEL: name: smin_s32_vv
84 ; GREEDY: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
85 ; GREEDY: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
86 ; GREEDY: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
87 %0:_(s32) = COPY $vgpr0
88 %1:_(s32) = COPY $vgpr1
89 %2:_(s32) = G_SMIN %0, %1
92 # FIXME: This should use VGPR instruction
94 name: smin_s32_ss_vgpr_use
99 liveins: $sgpr0, $sgpr1
101 ; FAST-LABEL: name: smin_s32_ss_vgpr_use
102 ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
103 ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
104 ; FAST: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
105 ; FAST: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[COPY]], [[COPY1]]
106 ; FAST: $vgpr0 = COPY [[SELECT]](s32)
107 ; GREEDY-LABEL: name: smin_s32_ss_vgpr_use
108 ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
109 ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
110 ; GREEDY: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
111 ; GREEDY: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[COPY]], [[COPY1]]
112 ; GREEDY: $vgpr0 = COPY [[SELECT]](s32)
113 %0:_(s32) = COPY $sgpr0
114 %1:_(s32) = COPY $sgpr1
115 %2:_(s32) = G_SMIN %0, %1
125 liveins: $sgpr0, $sgpr1
127 ; FAST-LABEL: name: smin_s16_ss
128 ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
129 ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
130 ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
131 ; FAST: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
132 ; FAST: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
133 ; FAST: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
134 ; FAST: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[SEXT]](s32), [[SEXT1]]
135 ; FAST: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[SEXT]], [[SEXT1]]
136 ; FAST: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SELECT]](s32)
137 ; GREEDY-LABEL: name: smin_s16_ss
138 ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
139 ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
140 ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
141 ; GREEDY: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
142 ; GREEDY: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
143 ; GREEDY: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
144 ; GREEDY: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[SEXT]](s32), [[SEXT1]]
145 ; GREEDY: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[SEXT]], [[SEXT1]]
146 ; GREEDY: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SELECT]](s32)
147 %0:_(s32) = COPY $sgpr0
148 %1:_(s32) = COPY $sgpr1
149 %2:_(s16) = G_TRUNC %0
150 %3:_(s16) = G_TRUNC %1
151 %4:_(s16) = G_SMIN %2, %3
156 name: smin_s16_ss_vgpr_use
161 liveins: $sgpr0, $sgpr1
163 ; FAST-LABEL: name: smin_s16_ss_vgpr_use
164 ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
165 ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
166 ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
167 ; FAST: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
168 ; FAST: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
169 ; FAST: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
170 ; FAST: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[SEXT]](s32), [[SEXT1]]
171 ; FAST: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[SEXT]], [[SEXT1]]
172 ; FAST: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SELECT]](s32)
173 ; FAST: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
174 ; FAST: $vgpr0 = COPY [[ANYEXT]](s32)
175 ; GREEDY-LABEL: name: smin_s16_ss_vgpr_use
176 ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
177 ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
178 ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
179 ; GREEDY: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
180 ; GREEDY: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
181 ; GREEDY: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
182 ; GREEDY: [[ICMP:%[0-9]+]]:scc(s1) = G_ICMP intpred(slt), [[SEXT]](s32), [[SEXT1]]
183 ; GREEDY: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s1), [[SEXT]], [[SEXT1]]
184 ; GREEDY: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SELECT]](s32)
185 ; GREEDY: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
186 ; GREEDY: $vgpr0 = COPY [[ANYEXT]](s32)
187 %0:_(s32) = COPY $sgpr0
188 %1:_(s32) = COPY $sgpr1
189 %2:_(s16) = G_TRUNC %0
190 %3:_(s16) = G_TRUNC %1
191 %4:_(s16) = G_SMIN %2, %3
192 %5:_(s32) = G_ANYEXT %4