1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
8 tracksRegLiveness: true
12 liveins: $vgpr0, $vgpr1, $vgpr2
14 ; GCN-LABEL: name: fmed3_s32_vvvv
15 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
17 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
18 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
19 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
20 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
21 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
22 %0:vgpr(s32) = COPY $vgpr0
23 %1:vgpr(s32) = COPY $vgpr1
24 %2:vgpr(s32) = COPY $vgpr2
25 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %2
26 S_ENDPGM 0, implicit %3
33 tracksRegLiveness: true
37 liveins: $sgpr0, $vgpr0, $vgpr1
39 ; GCN-LABEL: name: fmed3_s32_vsvv
40 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
42 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
43 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
44 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1
45 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
46 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
47 %0:sgpr(s32) = COPY $sgpr0
48 %1:vgpr(s32) = COPY $vgpr0
49 %2:vgpr(s32) = COPY $vgpr1
50 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %2
51 S_ENDPGM 0, implicit %3
58 tracksRegLiveness: true
62 liveins: $sgpr0, $vgpr0, $vgpr1
64 ; GCN-LABEL: name: fmed3_s32_vvsv
65 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
67 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
68 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
69 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1
70 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
71 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
72 %0:vgpr(s32) = COPY $vgpr0
73 %1:sgpr(s32) = COPY $sgpr0
74 %2:vgpr(s32) = COPY $vgpr1
75 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %2
76 S_ENDPGM 0, implicit %3
83 tracksRegLiveness: true
87 liveins: $sgpr0, $vgpr0, $vgpr1
89 ; GCN-LABEL: name: fmed3_s32_vvvs
90 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
92 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
93 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
94 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr0
95 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
96 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
97 %0:vgpr(s32) = COPY $vgpr0
98 %1:vgpr(s32) = COPY $vgpr0
99 %2:sgpr(s32) = COPY $sgpr0
100 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %2
101 S_ENDPGM 0, implicit %3
105 # Same SGPR used, so doesn't violate the constant bus restriction.
109 regBankSelected: true
110 tracksRegLiveness: true
114 liveins: $sgpr0, $vgpr0
116 ; GCN-LABEL: name: fmed3_s32_vssv
117 ; GCN: liveins: $sgpr0, $vgpr0
119 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
120 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
121 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
122 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
123 %0:sgpr(s32) = COPY $sgpr0
124 %1:vgpr(s32) = COPY $vgpr0
125 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %0, %1
126 S_ENDPGM 0, implicit %2
132 regBankSelected: true
133 tracksRegLiveness: true
137 liveins: $sgpr0, $vgpr0
139 ; GCN-LABEL: name: fmed3_s32_vsvs
140 ; GCN: liveins: $sgpr0, $vgpr0
142 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
143 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
144 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
145 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
146 %0:sgpr(s32) = COPY $sgpr0
147 %1:vgpr(s32) = COPY $vgpr0
148 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %0
149 S_ENDPGM 0, implicit %2
155 regBankSelected: true
156 tracksRegLiveness: true
160 liveins: $sgpr0, $vgpr0
162 ; GCN-LABEL: name: fmed3_s32_vvss
163 ; GCN: liveins: $sgpr0, $vgpr0
165 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
166 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
167 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
168 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
169 %0:sgpr(s32) = COPY $sgpr0
170 %1:vgpr(s32) = COPY $vgpr0
171 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %1, %0, %0
172 S_ENDPGM 0, implicit %2
178 regBankSelected: true
179 tracksRegLiveness: true
183 liveins: $sgpr0, $vgpr0
185 ; GCN-LABEL: name: fmed3_s32_vsss
186 ; GCN: liveins: $sgpr0, $vgpr0
188 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
189 ; GCN-NEXT: [[V_MED3_F32_e64_:%[0-9]+]]:vgpr_32 = V_MED3_F32_e64 0, [[COPY]], 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
190 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MED3_F32_e64_]]
191 %0:sgpr(s32) = COPY $sgpr0
192 %1:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %0, %0
193 S_ENDPGM 0, implicit %1
197 # FIXME: This should probably have been fixed by RegBankSelect, but we should fail to select it.
199 # name: fmed3_s32_vssv_constant_bus_violation
201 # regBankSelected: true
202 # tracksRegLiveness: true
206 # liveins: $sgpr0, $sgpr1, $vgpr0
208 # %0:sgpr(s32) = COPY $sgpr0
209 # %1:sgpr(s32) = COPY $sgpr1
210 # %2:vgpr(s32) = COPY $vgpr0
211 # %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmed3), %0, %1, %2
212 # S_ENDPGM 0, implicit %3