]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/AMDGPU/VOP3Instructions.td
Merge ^/head r318658 through r318963.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / AMDGPU / VOP3Instructions.td
1 //===-- VOP3Instructions.td - Vector Instruction Defintions ---------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 //===----------------------------------------------------------------------===//
11 // VOP3 Classes
12 //===----------------------------------------------------------------------===//
13
14 class getVOP3ModPat<VOPProfile P, SDPatternOperator node> {
15   list<dag> ret3 = [(set P.DstVT:$vdst,
16     (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
17           (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
18           (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))))];
19
20   list<dag> ret2 = [(set P.DstVT:$vdst,
21     (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
22           (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))];
23
24   list<dag> ret1 = [(set P.DstVT:$vdst,
25     (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod))))];
26
27   list<dag> ret = !if(!eq(P.NumSrcArgs, 3), ret3,
28                   !if(!eq(P.NumSrcArgs, 2), ret2,
29                   ret1));
30 }
31
32 class getVOP3PModPat<VOPProfile P, SDPatternOperator node> {
33   list<dag> ret3 = [(set P.DstVT:$vdst,
34     (node (P.Src0VT !if(P.HasClamp, (VOP3PMods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp),
35                                     (VOP3PMods P.Src0VT:$src0, i32:$src0_modifiers))),
36           (P.Src1VT (VOP3PMods P.Src1VT:$src1, i32:$src1_modifiers)),
37           (P.Src2VT (VOP3PMods P.Src2VT:$src2, i32:$src2_modifiers))))];
38
39   list<dag> ret2 = [(set P.DstVT:$vdst,
40     (node !if(P.HasClamp, (P.Src0VT (VOP3PMods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp)),
41                           (P.Src0VT (VOP3PMods P.Src0VT:$src0, i32:$src0_modifiers))),
42           (P.Src1VT (VOP3PMods P.Src1VT:$src1, i32:$src1_modifiers))))];
43
44   list<dag> ret1 = [(set P.DstVT:$vdst,
45     (node (P.Src0VT (VOP3PMods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp))))];
46
47   list<dag> ret = !if(!eq(P.NumSrcArgs, 3), ret3,
48                   !if(!eq(P.NumSrcArgs, 2), ret2,
49                   ret1));
50 }
51
52 class getVOP3Pat<VOPProfile P, SDPatternOperator node> {
53   list<dag> ret3 = [(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1, P.Src2VT:$src2))];
54   list<dag> ret2 = [(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))];
55   list<dag> ret1 = [(set P.DstVT:$vdst, (node P.Src0VT:$src0))];
56   list<dag> ret = !if(!eq(P.NumSrcArgs, 3), ret3,
57                   !if(!eq(P.NumSrcArgs, 2), ret2,
58                   ret1));
59 }
60
61 class VOP3Inst<string OpName, VOPProfile P, SDPatternOperator node = null_frag, bit VOP3Only = 0> :
62   VOP3_Pseudo<OpName, P,
63     !if(P.HasModifiers, getVOP3ModPat<P, node>.ret, getVOP3Pat<P, node>.ret),
64     VOP3Only>;
65
66 // Special case for v_div_fmas_{f32|f64}, since it seems to be the
67 // only VOP instruction that implicitly reads VCC.
68 let Asm64 = " $vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$omod" in {
69 def VOP_F32_F32_F32_F32_VCC : VOPProfile<[f32, f32, f32, f32]> {
70   let Outs64 = (outs DstRC.RegClass:$vdst);
71 }
72 def VOP_F64_F64_F64_F64_VCC : VOPProfile<[f64, f64, f64, f64]> {
73   let Outs64 = (outs DstRC.RegClass:$vdst);
74 }
75 }
76
77 class getVOP3VCC<VOPProfile P, SDPatternOperator node> {
78   list<dag> ret =
79     [(set P.DstVT:$vdst,
80       (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
81             (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
82             (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers)),
83             (i1 VCC)))];
84 }
85
86 class VOP3_Profile<VOPProfile P> : VOPProfile<P.ArgVT> {
87   // FIXME: Hack to stop printing _e64
88   let Outs64 = (outs DstRC.RegClass:$vdst);
89   let Asm64 = " " # P.Asm64;
90 }
91
92 class VOP3b_Profile<ValueType vt> : VOPProfile<[vt, vt, vt, vt]> {
93   // v_div_scale_{f32|f64} do not support input modifiers.
94   let HasModifiers = 0;
95   let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
96   let Asm64 = " $vdst, $sdst, $src0, $src1, $src2";
97 }
98
99 def VOP3b_F32_I1_F32_F32_F32 : VOP3b_Profile<f32> {
100   // FIXME: Hack to stop printing _e64
101   let DstRC = RegisterOperand<VGPR_32>;
102 }
103
104 def VOP3b_F64_I1_F64_F64_F64 : VOP3b_Profile<f64> {
105   // FIXME: Hack to stop printing _e64
106   let DstRC = RegisterOperand<VReg_64>;
107 }
108
109 def VOP3b_I64_I1_I32_I32_I64 : VOPProfile<[i64, i32, i32, i64]> {
110   // FIXME: Hack to stop printing _e64
111   let DstRC = RegisterOperand<VReg_64>;
112
113   let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
114   let Asm64 = " $vdst, $sdst, $src0, $src1, $src2";
115 }
116
117 //===----------------------------------------------------------------------===//
118 // VOP3 Instructions
119 //===----------------------------------------------------------------------===//
120
121 let isCommutable = 1 in {
122
123 def V_MAD_LEGACY_F32 : VOP3Inst <"v_mad_legacy_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>;
124 def V_MAD_F32 : VOP3Inst <"v_mad_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, fmad>;
125 def V_MAD_I32_I24 : VOP3Inst <"v_mad_i32_i24", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUmad_i24>;
126 def V_MAD_U32_U24 : VOP3Inst <"v_mad_u32_u24", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUmad_u24>;
127 def V_FMA_F32 : VOP3Inst <"v_fma_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, fma>;
128 def V_FMA_F64 : VOP3Inst <"v_fma_f64", VOP3_Profile<VOP_F64_F64_F64_F64>, fma>;
129 def V_LERP_U8 : VOP3Inst <"v_lerp_u8", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_lerp>;
130
131 let SchedRW = [WriteDoubleAdd] in {
132 def V_ADD_F64 : VOP3Inst <"v_add_f64", VOP3_Profile<VOP_F64_F64_F64>, fadd, 1>;
133 def V_MUL_F64 : VOP3Inst <"v_mul_f64", VOP3_Profile<VOP_F64_F64_F64>, fmul, 1>;
134 def V_MIN_F64 : VOP3Inst <"v_min_f64", VOP3_Profile<VOP_F64_F64_F64>, fminnum, 1>;
135 def V_MAX_F64 : VOP3Inst <"v_max_f64", VOP3_Profile<VOP_F64_F64_F64>, fmaxnum, 1>;
136 } // End SchedRW = [WriteDoubleAdd]
137
138 let SchedRW = [WriteQuarterRate32] in {
139 def V_MUL_LO_U32 : VOP3Inst <"v_mul_lo_u32", VOP3_Profile<VOP_I32_I32_I32>>;
140 def V_MUL_HI_U32 : VOP3Inst <"v_mul_hi_u32", VOP3_Profile<VOP_I32_I32_I32>, mulhu>;
141 def V_MUL_LO_I32 : VOP3Inst <"v_mul_lo_i32", VOP3_Profile<VOP_I32_I32_I32>>;
142 def V_MUL_HI_I32 : VOP3Inst <"v_mul_hi_i32", VOP3_Profile<VOP_I32_I32_I32>, mulhs>;
143 } // End SchedRW = [WriteQuarterRate32]
144
145 let Uses = [VCC, EXEC] in {
146 // v_div_fmas_f32:
147 //   result = src0 * src1 + src2
148 //   if (vcc)
149 //     result *= 2^32
150 //
151 def V_DIV_FMAS_F32 : VOP3_Pseudo <"v_div_fmas_f32", VOP_F32_F32_F32_F32_VCC,
152   getVOP3VCC<VOP_F32_F32_F32_F32_VCC, AMDGPUdiv_fmas>.ret> {
153   let SchedRW = [WriteFloatFMA];
154 }
155 // v_div_fmas_f64:
156 //   result = src0 * src1 + src2
157 //   if (vcc)
158 //     result *= 2^64
159 //
160 def V_DIV_FMAS_F64 : VOP3_Pseudo <"v_div_fmas_f64", VOP_F64_F64_F64_F64_VCC,
161   getVOP3VCC<VOP_F64_F64_F64_F64_VCC, AMDGPUdiv_fmas>.ret> {
162   let SchedRW = [WriteDouble];
163 }
164 } // End Uses = [VCC, EXEC]
165
166 } // End isCommutable = 1
167
168 def V_CUBEID_F32 : VOP3Inst <"v_cubeid_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubeid>;
169 def V_CUBESC_F32 : VOP3Inst <"v_cubesc_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubesc>;
170 def V_CUBETC_F32 : VOP3Inst <"v_cubetc_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubetc>;
171 def V_CUBEMA_F32 : VOP3Inst <"v_cubema_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubema>;
172 def V_BFE_U32 : VOP3Inst <"v_bfe_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfe_u32>;
173 def V_BFE_I32 : VOP3Inst <"v_bfe_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfe_i32>;
174 def V_BFI_B32 : VOP3Inst <"v_bfi_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfi>;
175 def V_ALIGNBIT_B32 : VOP3Inst <"v_alignbit_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
176 def V_ALIGNBYTE_B32 : VOP3Inst <"v_alignbyte_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
177 def V_MIN3_F32 : VOP3Inst <"v_min3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmin3>;
178 def V_MIN3_I32 : VOP3Inst <"v_min3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmin3>;
179 def V_MIN3_U32 : VOP3Inst <"v_min3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumin3>;
180 def V_MAX3_F32 : VOP3Inst <"v_max3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmax3>;
181 def V_MAX3_I32 : VOP3Inst <"v_max3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmax3>;
182 def V_MAX3_U32 : VOP3Inst <"v_max3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumax3>;
183 def V_MED3_F32 : VOP3Inst <"v_med3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmed3>;
184 def V_MED3_I32 : VOP3Inst <"v_med3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmed3>;
185 def V_MED3_U32 : VOP3Inst <"v_med3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumed3>;
186 def V_SAD_U8 : VOP3Inst <"v_sad_u8", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_sad_u8>;
187 def V_SAD_HI_U8 : VOP3Inst <"v_sad_hi_u8", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_sad_hi_u8>;
188 def V_SAD_U16 : VOP3Inst <"v_sad_u16", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_sad_u16>;
189 def V_SAD_U32 : VOP3Inst <"v_sad_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
190 def V_CVT_PK_U8_F32 : VOP3Inst<"v_cvt_pk_u8_f32", VOP3_Profile<VOP_I32_F32_I32_I32>, int_amdgcn_cvt_pk_u8_f32>;
191 def V_DIV_FIXUP_F32 : VOP3Inst <"v_div_fixup_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUdiv_fixup>;
192
193 let SchedRW = [WriteDoubleAdd] in {
194 def V_DIV_FIXUP_F64 : VOP3Inst <"v_div_fixup_f64", VOP3_Profile<VOP_F64_F64_F64_F64>, AMDGPUdiv_fixup>;
195 def V_LDEXP_F64 : VOP3Inst <"v_ldexp_f64", VOP3_Profile<VOP_F64_F64_I32>, AMDGPUldexp, 1>;
196 } // End SchedRW = [WriteDoubleAdd]
197
198 def V_DIV_SCALE_F32 : VOP3_Pseudo <"v_div_scale_f32", VOP3b_F32_I1_F32_F32_F32, [], 1> {
199   let SchedRW = [WriteFloatFMA, WriteSALU];
200   let hasExtraSrcRegAllocReq = 1;
201   let AsmMatchConverter = "";
202 }
203
204 // Double precision division pre-scale.
205 def V_DIV_SCALE_F64 : VOP3_Pseudo <"v_div_scale_f64", VOP3b_F64_I1_F64_F64_F64, [], 1> {
206   let SchedRW = [WriteDouble, WriteSALU];
207   let hasExtraSrcRegAllocReq = 1;
208   let AsmMatchConverter = "";
209 }
210
211 def V_MSAD_U8 : VOP3Inst <"v_msad_u8", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_msad_u8>;
212 def V_MQSAD_PK_U16_U8 : VOP3Inst <"v_mqsad_pk_u16_u8", VOP3_Profile<VOP_I64_I64_I32_I64>, int_amdgcn_mqsad_pk_u16_u8>;
213
214 def V_TRIG_PREOP_F64 : VOP3Inst <"v_trig_preop_f64", VOP3_Profile<VOP_F64_F64_I32>, AMDGPUtrig_preop> {
215   let SchedRW = [WriteDouble];
216 }
217
218 // These instructions only exist on SI and CI
219 let SubtargetPredicate = isSICI in {
220 def V_LSHL_B64 : VOP3Inst <"v_lshl_b64", VOP3_Profile<VOP_I64_I64_I32>>;
221 def V_LSHR_B64 : VOP3Inst <"v_lshr_b64", VOP3_Profile<VOP_I64_I64_I32>>;
222 def V_ASHR_I64 : VOP3Inst <"v_ashr_i64", VOP3_Profile<VOP_I64_I64_I32>>;
223 def V_MULLIT_F32 : VOP3Inst <"v_mullit_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>;
224 } // End SubtargetPredicate = isSICI
225
226 let SubtargetPredicate = isVI in {
227 def V_LSHLREV_B64 : VOP3Inst <"v_lshlrev_b64", VOP3_Profile<VOP_I64_I32_I64>>;
228 def V_LSHRREV_B64 : VOP3Inst <"v_lshrrev_b64", VOP3_Profile<VOP_I64_I32_I64>>;
229 def V_ASHRREV_I64 : VOP3Inst <"v_ashrrev_i64", VOP3_Profile<VOP_I64_I32_I64>>;
230 } // End SubtargetPredicate = isVI
231
232
233 let SubtargetPredicate = isCIVI in {
234
235 def V_QSAD_PK_U16_U8 : VOP3Inst <"v_qsad_pk_u16_u8", VOP3_Profile<VOP_I64_I64_I32_I64>, int_amdgcn_qsad_pk_u16_u8>;
236 def V_MQSAD_U32_U8 : VOP3Inst <"v_mqsad_u32_u8", VOP3_Profile<VOP_V4I32_I64_I32_V4I32>, int_amdgcn_mqsad_u32_u8>;
237
238 let isCommutable = 1 in {
239 def V_MAD_U64_U32 : VOP3Inst <"v_mad_u64_u32", VOP3b_I64_I1_I32_I32_I64>;
240 def V_MAD_I64_I32 : VOP3Inst <"v_mad_i64_i32", VOP3b_I64_I1_I32_I32_I64>;
241 } // End isCommutable = 1
242
243 } // End SubtargetPredicate = isCIVI
244
245
246 let SubtargetPredicate = isVI in {
247
248 let isCommutable = 1 in {
249
250 def V_DIV_FIXUP_F16   : VOP3Inst <"v_div_fixup_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, AMDGPUdiv_fixup>;
251 def V_FMA_F16         : VOP3Inst <"v_fma_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, fma>;
252 def V_INTERP_P1LL_F16 : VOP3Inst <"v_interp_p1ll_f16", VOP3_Profile<VOP_F32_F32_F16>>;
253 def V_INTERP_P1LV_F16 : VOP3Inst <"v_interp_p1lv_f16", VOP3_Profile<VOP_F32_F32_F16_F16>>;
254 def V_INTERP_P2_F16   : VOP3Inst <"v_interp_p2_f16", VOP3_Profile<VOP_F16_F32_F16_F32>>;
255 def V_MAD_F16         : VOP3Inst <"v_mad_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, fmad>;
256
257 def V_MAD_U16 : VOP3Inst <"v_mad_u16", VOP3_Profile<VOP_I16_I16_I16_I16>>;
258 def V_MAD_I16 : VOP3Inst <"v_mad_i16", VOP3_Profile<VOP_I16_I16_I16_I16>>;
259
260 }  // End isCommutable = 1
261
262 def V_PERM_B32 : VOP3Inst <"v_perm_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
263
264 } // End SubtargetPredicate = isVI
265
266 let Predicates = [isVI] in {
267
268 multiclass Ternary_i16_Pats <SDPatternOperator op1, SDPatternOperator op2,
269                              Instruction inst, SDPatternOperator op3> {
270 def : Pat<
271   (op2 (op1 i16:$src0, i16:$src1), i16:$src2),
272   (inst i16:$src0, i16:$src1, i16:$src2)
273 >;
274
275 def : Pat<
276   (i32 (op3 (op2 (op1 i16:$src0, i16:$src1), i16:$src2))),
277   (inst i16:$src0, i16:$src1, i16:$src2)
278 >;
279
280 def : Pat<
281   (i64 (op3 (op2 (op1 i16:$src0, i16:$src1), i16:$src2))),
282    (REG_SEQUENCE VReg_64,
283      (inst i16:$src0, i16:$src1, i16:$src2), sub0,
284      (V_MOV_B32_e32 (i32 0)), sub1)
285 >;
286 }
287
288 defm: Ternary_i16_Pats<mul, add, V_MAD_U16, zext>;
289 defm: Ternary_i16_Pats<mul, add, V_MAD_I16, sext>;
290
291 } // End Predicates = [isVI]
292
293 let SubtargetPredicate = isGFX9 in {
294 def V_PACK_B32_F16 : VOP3Inst <"v_pack_b32_f16", VOP3_Profile<VOP_B32_F16_F16>>;
295 def V_LSHL_ADD_U32 : VOP3Inst <"v_lshl_add_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
296 def V_ADD_LSHL_U32 : VOP3Inst <"v_add_lshl_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
297 def V_ADD3_U32 : VOP3Inst <"v_add3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
298 def V_LSHL_OR_B32 : VOP3Inst <"v_lshl_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
299 def V_AND_OR_B32 : VOP3Inst <"v_and_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
300 def V_OR3_B32 : VOP3Inst <"v_or3_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
301
302 def V_XAD_U32 : VOP3Inst <"v_xad_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>;
303
304 def V_MED3_F16 : VOP3Inst <"v_med3_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, AMDGPUfmed3>;
305 def V_MED3_I16 : VOP3Inst <"v_med3_i16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUsmed3>;
306 def V_MED3_U16 : VOP3Inst <"v_med3_u16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUumed3>;
307
308 def V_MIN3_F16 : VOP3Inst <"v_min3_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, AMDGPUfmin3>;
309 def V_MIN3_I16 : VOP3Inst <"v_min3_i16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUsmin3>;
310 def V_MIN3_U16 : VOP3Inst <"v_min3_u16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUumin3>;
311
312 def V_MAX3_F16 : VOP3Inst <"v_max3_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, AMDGPUfmax3>;
313 def V_MAX3_I16 : VOP3Inst <"v_max3_i16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUsmax3>;
314 def V_MAX3_U16 : VOP3Inst <"v_max3_u16", VOP3_Profile<VOP_I16_I16_I16_I16>, AMDGPUumax3>;
315 } // End SubtargetPredicate = isGFX9
316
317
318 //===----------------------------------------------------------------------===//
319 // Target
320 //===----------------------------------------------------------------------===//
321
322 //===----------------------------------------------------------------------===//
323 // SI
324 //===----------------------------------------------------------------------===//
325
326 let AssemblerPredicates = [isSICI], DecoderNamespace = "SICI" in {
327
328 multiclass VOP3_Real_si<bits<9> op> {
329   def _si : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.SI>,
330             VOP3e_si <op, !cast<VOP3_Pseudo>(NAME).Pfl>;
331 }
332
333 multiclass VOP3be_Real_si<bits<9> op> {
334   def _si : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.SI>,
335             VOP3be_si <op, !cast<VOP3_Pseudo>(NAME).Pfl>;
336 }
337
338 } // End AssemblerPredicates = [isSICI], DecoderNamespace = "SICI"
339
340 defm V_MAD_LEGACY_F32   : VOP3_Real_si <0x140>;
341 defm V_MAD_F32          : VOP3_Real_si <0x141>;
342 defm V_MAD_I32_I24      : VOP3_Real_si <0x142>;
343 defm V_MAD_U32_U24      : VOP3_Real_si <0x143>;
344 defm V_CUBEID_F32       : VOP3_Real_si <0x144>;
345 defm V_CUBESC_F32       : VOP3_Real_si <0x145>;
346 defm V_CUBETC_F32       : VOP3_Real_si <0x146>;
347 defm V_CUBEMA_F32       : VOP3_Real_si <0x147>;
348 defm V_BFE_U32          : VOP3_Real_si <0x148>;
349 defm V_BFE_I32          : VOP3_Real_si <0x149>;
350 defm V_BFI_B32          : VOP3_Real_si <0x14a>;
351 defm V_FMA_F32          : VOP3_Real_si <0x14b>;
352 defm V_FMA_F64          : VOP3_Real_si <0x14c>;
353 defm V_LERP_U8          : VOP3_Real_si <0x14d>;
354 defm V_ALIGNBIT_B32     : VOP3_Real_si <0x14e>;
355 defm V_ALIGNBYTE_B32    : VOP3_Real_si <0x14f>;
356 defm V_MULLIT_F32       : VOP3_Real_si <0x150>;
357 defm V_MIN3_F32         : VOP3_Real_si <0x151>;
358 defm V_MIN3_I32         : VOP3_Real_si <0x152>;
359 defm V_MIN3_U32         : VOP3_Real_si <0x153>;
360 defm V_MAX3_F32         : VOP3_Real_si <0x154>;
361 defm V_MAX3_I32         : VOP3_Real_si <0x155>;
362 defm V_MAX3_U32         : VOP3_Real_si <0x156>;
363 defm V_MED3_F32         : VOP3_Real_si <0x157>;
364 defm V_MED3_I32         : VOP3_Real_si <0x158>;
365 defm V_MED3_U32         : VOP3_Real_si <0x159>;
366 defm V_SAD_U8           : VOP3_Real_si <0x15a>;
367 defm V_SAD_HI_U8        : VOP3_Real_si <0x15b>;
368 defm V_SAD_U16          : VOP3_Real_si <0x15c>;
369 defm V_SAD_U32          : VOP3_Real_si <0x15d>;
370 defm V_CVT_PK_U8_F32    : VOP3_Real_si <0x15e>;
371 defm V_DIV_FIXUP_F32    : VOP3_Real_si <0x15f>;
372 defm V_DIV_FIXUP_F64    : VOP3_Real_si <0x160>;
373 defm V_LSHL_B64         : VOP3_Real_si <0x161>;
374 defm V_LSHR_B64         : VOP3_Real_si <0x162>;
375 defm V_ASHR_I64         : VOP3_Real_si <0x163>;
376 defm V_ADD_F64          : VOP3_Real_si <0x164>;
377 defm V_MUL_F64          : VOP3_Real_si <0x165>;
378 defm V_MIN_F64          : VOP3_Real_si <0x166>;
379 defm V_MAX_F64          : VOP3_Real_si <0x167>;
380 defm V_LDEXP_F64        : VOP3_Real_si <0x168>;
381 defm V_MUL_LO_U32       : VOP3_Real_si <0x169>;
382 defm V_MUL_HI_U32       : VOP3_Real_si <0x16a>;
383 defm V_MUL_LO_I32       : VOP3_Real_si <0x16b>;
384 defm V_MUL_HI_I32       : VOP3_Real_si <0x16c>;
385 defm V_DIV_SCALE_F32    : VOP3be_Real_si <0x16d>;
386 defm V_DIV_SCALE_F64    : VOP3be_Real_si <0x16e>;
387 defm V_DIV_FMAS_F32     : VOP3_Real_si <0x16f>;
388 defm V_DIV_FMAS_F64     : VOP3_Real_si <0x170>;
389 defm V_MSAD_U8          : VOP3_Real_si <0x171>;
390 defm V_MQSAD_PK_U16_U8  : VOP3_Real_si <0x173>;
391 defm V_TRIG_PREOP_F64   : VOP3_Real_si <0x174>;
392
393 //===----------------------------------------------------------------------===//
394 // CI
395 //===----------------------------------------------------------------------===//
396
397 multiclass VOP3_Real_ci<bits<9> op> {
398   def _ci : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.SI>,
399             VOP3e_si <op, !cast<VOP3_Pseudo>(NAME).Pfl> {
400     let AssemblerPredicates = [isCIOnly];
401     let DecoderNamespace = "CI";
402   }
403 }
404
405 multiclass VOP3be_Real_ci<bits<9> op> {
406   def _ci : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.SI>,
407             VOP3be_si <op, !cast<VOP3_Pseudo>(NAME).Pfl> {
408     let AssemblerPredicates = [isCIOnly];
409     let DecoderNamespace = "CI";
410   }
411 }
412
413 defm V_QSAD_PK_U16_U8   : VOP3_Real_ci <0x172>;
414 defm V_MQSAD_U32_U8     : VOP3_Real_ci <0x175>;
415 defm V_MAD_U64_U32      : VOP3be_Real_ci <0x176>;
416 defm V_MAD_I64_I32      : VOP3be_Real_ci <0x177>;
417
418 //===----------------------------------------------------------------------===//
419 // VI
420 //===----------------------------------------------------------------------===//
421
422 let AssemblerPredicates = [isVI], DecoderNamespace = "VI" in {
423
424 multiclass VOP3_Real_vi<bits<10> op> {
425   def _vi : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.VI>,
426             VOP3e_vi <op, !cast<VOP3_Pseudo>(NAME).Pfl>;
427 }
428
429 multiclass VOP3be_Real_vi<bits<10> op> {
430   def _vi : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.VI>,
431             VOP3be_vi <op, !cast<VOP3_Pseudo>(NAME).Pfl>;
432 }
433
434 } // End AssemblerPredicates = [isVI], DecoderNamespace = "VI"
435
436 defm V_MAD_U64_U32      : VOP3be_Real_vi <0x1E8>;
437 defm V_MAD_I64_I32      : VOP3be_Real_vi <0x1E9>;
438
439 defm V_MAD_LEGACY_F32   : VOP3_Real_vi <0x1c0>;
440 defm V_MAD_F32          : VOP3_Real_vi <0x1c1>;
441 defm V_MAD_I32_I24      : VOP3_Real_vi <0x1c2>;
442 defm V_MAD_U32_U24      : VOP3_Real_vi <0x1c3>;
443 defm V_CUBEID_F32       : VOP3_Real_vi <0x1c4>;
444 defm V_CUBESC_F32       : VOP3_Real_vi <0x1c5>;
445 defm V_CUBETC_F32       : VOP3_Real_vi <0x1c6>;
446 defm V_CUBEMA_F32       : VOP3_Real_vi <0x1c7>;
447 defm V_BFE_U32          : VOP3_Real_vi <0x1c8>;
448 defm V_BFE_I32          : VOP3_Real_vi <0x1c9>;
449 defm V_BFI_B32          : VOP3_Real_vi <0x1ca>;
450 defm V_FMA_F32          : VOP3_Real_vi <0x1cb>;
451 defm V_FMA_F64          : VOP3_Real_vi <0x1cc>;
452 defm V_LERP_U8          : VOP3_Real_vi <0x1cd>;
453 defm V_ALIGNBIT_B32     : VOP3_Real_vi <0x1ce>;
454 defm V_ALIGNBYTE_B32    : VOP3_Real_vi <0x1cf>;
455 defm V_MIN3_F32         : VOP3_Real_vi <0x1d0>;
456 defm V_MIN3_I32         : VOP3_Real_vi <0x1d1>;
457 defm V_MIN3_U32         : VOP3_Real_vi <0x1d2>;
458 defm V_MAX3_F32         : VOP3_Real_vi <0x1d3>;
459 defm V_MAX3_I32         : VOP3_Real_vi <0x1d4>;
460 defm V_MAX3_U32         : VOP3_Real_vi <0x1d5>;
461 defm V_MED3_F32         : VOP3_Real_vi <0x1d6>;
462 defm V_MED3_I32         : VOP3_Real_vi <0x1d7>;
463 defm V_MED3_U32         : VOP3_Real_vi <0x1d8>;
464 defm V_SAD_U8           : VOP3_Real_vi <0x1d9>;
465 defm V_SAD_HI_U8        : VOP3_Real_vi <0x1da>;
466 defm V_SAD_U16          : VOP3_Real_vi <0x1db>;
467 defm V_SAD_U32          : VOP3_Real_vi <0x1dc>;
468 defm V_CVT_PK_U8_F32    : VOP3_Real_vi <0x1dd>;
469 defm V_DIV_FIXUP_F32    : VOP3_Real_vi <0x1de>;
470 defm V_DIV_FIXUP_F64    : VOP3_Real_vi <0x1df>;
471 defm V_DIV_SCALE_F32    : VOP3be_Real_vi <0x1e0>;
472 defm V_DIV_SCALE_F64    : VOP3be_Real_vi <0x1e1>;
473 defm V_DIV_FMAS_F32     : VOP3_Real_vi <0x1e2>;
474 defm V_DIV_FMAS_F64     : VOP3_Real_vi <0x1e3>;
475 defm V_MSAD_U8          : VOP3_Real_vi <0x1e4>;
476 defm V_QSAD_PK_U16_U8   : VOP3_Real_vi <0x1e5>;
477 defm V_MQSAD_PK_U16_U8  : VOP3_Real_vi <0x1e6>;
478 defm V_MQSAD_U32_U8     : VOP3_Real_vi <0x1e7>;
479
480 defm V_MAD_F16          : VOP3_Real_vi <0x1ea>;
481 defm V_MAD_U16          : VOP3_Real_vi <0x1eb>;
482 defm V_MAD_I16          : VOP3_Real_vi <0x1ec>;
483
484 defm V_PERM_B32         : VOP3_Real_vi <0x1ed>;
485
486 defm V_FMA_F16          : VOP3_Real_vi <0x1ee>;
487 defm V_DIV_FIXUP_F16    : VOP3_Real_vi <0x1ef>;
488
489 defm V_INTERP_P1LL_F16  : VOP3_Real_vi <0x274>;
490 defm V_INTERP_P1LV_F16  : VOP3_Real_vi <0x275>;
491 defm V_INTERP_P2_F16    : VOP3_Real_vi <0x276>;
492 defm V_ADD_F64          : VOP3_Real_vi <0x280>;
493 defm V_MUL_F64          : VOP3_Real_vi <0x281>;
494 defm V_MIN_F64          : VOP3_Real_vi <0x282>;
495 defm V_MAX_F64          : VOP3_Real_vi <0x283>;
496 defm V_LDEXP_F64        : VOP3_Real_vi <0x284>;
497 defm V_MUL_LO_U32       : VOP3_Real_vi <0x285>;
498
499 // removed from VI as identical to V_MUL_LO_U32
500 let isAsmParserOnly = 1 in {
501 defm V_MUL_LO_I32       : VOP3_Real_vi <0x285>;
502 }
503
504 defm V_MUL_HI_U32       : VOP3_Real_vi <0x286>;
505 defm V_MUL_HI_I32       : VOP3_Real_vi <0x287>;
506
507 defm V_LSHLREV_B64      : VOP3_Real_vi <0x28f>;
508 defm V_LSHRREV_B64      : VOP3_Real_vi <0x290>;
509 defm V_ASHRREV_I64      : VOP3_Real_vi <0x291>;
510 defm V_TRIG_PREOP_F64   : VOP3_Real_vi <0x292>;
511
512 defm V_LSHL_ADD_U32 : VOP3_Real_vi <0x1fd>;
513 defm V_ADD_LSHL_U32 : VOP3_Real_vi <0x1fe>;
514 defm V_ADD3_U32 : VOP3_Real_vi <0x1ff>;
515 defm V_LSHL_OR_B32 : VOP3_Real_vi <0x200>;
516 defm V_AND_OR_B32 : VOP3_Real_vi <0x201>;
517 defm V_OR3_B32 : VOP3_Real_vi <0x202>;
518 defm V_PACK_B32_F16 : VOP3_Real_vi <0x2a0>;
519
520 defm V_XAD_U32 : VOP3_Real_vi <0x1f3>;
521
522 defm V_MIN3_F16 : VOP3_Real_vi <0x1f4>;
523 defm V_MIN3_I16 : VOP3_Real_vi <0x1f5>;
524 defm V_MIN3_U16 : VOP3_Real_vi <0x1f6>;
525
526 defm V_MAX3_F16 : VOP3_Real_vi <0x1f7>;
527 defm V_MAX3_I16 : VOP3_Real_vi <0x1f8>;
528 defm V_MAX3_U16 : VOP3_Real_vi <0x1f9>;
529
530 defm V_MED3_F16 : VOP3_Real_vi <0x1fa>;
531 defm V_MED3_I16 : VOP3_Real_vi <0x1fb>;
532 defm V_MED3_U16 : VOP3_Real_vi <0x1fc>;