1 //===-- VOP1Instructions.td - Vector Instruction Defintions ---------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 class VOP1e <bits<8> op, VOPProfile P> : Enc32 {
17 let Inst{8-0} = !if(P.HasSrc0, src0{8-0}, ?);
19 let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
20 let Inst{31-25} = 0x3f; //encoding
23 class VOP1_SDWAe <bits<8> op, VOPProfile P> : VOP_SDWAe <P> {
26 let Inst{8-0} = 0xf9; // sdwa
28 let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
29 let Inst{31-25} = 0x3f; // encoding
32 class VOP1_SDWA9Ae <bits<8> op, VOPProfile P> : VOP_SDWA9Ae <P> {
35 let Inst{8-0} = 0xf9; // sdwa
37 let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
38 let Inst{31-25} = 0x3f; // encoding
41 class VOP1_Pseudo <string opName, VOPProfile P, list<dag> pattern=[], bit VOP1Only = 0> :
42 VOP_Pseudo <opName, !if(VOP1Only, "", "_e32"), P, P.Outs32, P.Ins32, "", pattern> {
44 let AsmOperands = P.Asm32;
49 let hasSideEffects = 0;
55 let AsmVariantName = AMDGPUAsmVariants.Default;
58 class VOP1_Real <VOP1_Pseudo ps, int EncodingFamily> :
59 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
60 SIMCInstr <ps.PseudoInstr, EncodingFamily> {
63 let isCodeGenOnly = 0;
65 let Constraints = ps.Constraints;
66 let DisableEncoding = ps.DisableEncoding;
68 // copy relevant pseudo op flags
69 let SubtargetPredicate = ps.SubtargetPredicate;
70 let AsmMatchConverter = ps.AsmMatchConverter;
71 let AsmVariantName = ps.AsmVariantName;
72 let Constraints = ps.Constraints;
73 let DisableEncoding = ps.DisableEncoding;
74 let TSFlags = ps.TSFlags;
75 let UseNamedOperandTable = ps.UseNamedOperandTable;
80 class VOP1_SDWA_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
81 VOP_SDWA_Pseudo <OpName, P, pattern> {
82 let AsmMatchConverter = "cvtSdwaVOP1";
85 class VOP1_DPP_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
86 VOP_DPP_Pseudo <OpName, P, pattern> {
89 class getVOP1Pat64 <SDPatternOperator node, VOPProfile P> : LetDummies {
92 [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
94 i1:$clamp, i32:$omod))))],
96 [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3OMods P.Src0VT:$src0,
97 i1:$clamp, i32:$omod))))],
98 [(set P.DstVT:$vdst, (node P.Src0VT:$src0))]
103 multiclass VOP1Inst <string opName, VOPProfile P,
104 SDPatternOperator node = null_frag> {
105 def _e32 : VOP1_Pseudo <opName, P>;
106 def _e64 : VOP3_Pseudo <opName, P, getVOP1Pat64<node, P>.ret>;
108 foreach _ = BoolToList<P.HasExtSDWA>.ret in
109 def _sdwa : VOP1_SDWA_Pseudo <opName, P>;
111 foreach _ = BoolToList<P.HasExtDPP>.ret in
112 def _dpp : VOP1_DPP_Pseudo <opName, P>;
114 def : MnemonicAlias<opName#"_e32", opName>, LetDummies;
115 def : MnemonicAlias<opName#"_e64", opName>, LetDummies;
117 foreach _ = BoolToList<P.HasExtSDWA>.ret in
118 def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies;
120 foreach _ = BoolToList<P.HasExtDPP>.ret in
121 def : MnemonicAlias<opName#"_dpp", opName>, LetDummies;
124 // Special profile for instructions which have clamp
125 // and output modifiers (but have no input modifiers)
126 class VOPProfileI2F<ValueType dstVt, ValueType srcVt> :
127 VOPProfile<[dstVt, srcVt, untyped, untyped]> {
129 let Ins64 = (ins Src0RC64:$src0, clampmod:$clamp, omod:$omod);
130 let Asm64 = "$vdst, $src0$clamp$omod";
132 let HasModifiers = 0;
137 def VOP1_F64_I32 : VOPProfileI2F <f64, i32>;
138 def VOP1_F32_I32 : VOPProfileI2F <f32, i32>;
139 def VOP1_F16_I16 : VOPProfileI2F <f16, i16>;
141 //===----------------------------------------------------------------------===//
143 //===----------------------------------------------------------------------===//
145 let VOPAsmPrefer32Bit = 1 in {
146 defm V_NOP : VOP1Inst <"v_nop", VOP_NONE>;
149 let isMoveImm = 1, isReMaterializable = 1, isAsCheapAsAMove = 1 in {
150 defm V_MOV_B32 : VOP1Inst <"v_mov_b32", VOP_I32_I32>;
151 } // End isMoveImm = 1
153 // FIXME: Specify SchedRW for READFIRSTLANE_B32
154 // TODO: Make profile for this, there is VOP3 encoding also
155 def V_READFIRSTLANE_B32 :
156 InstSI <(outs SReg_32:$vdst),
157 (ins VRegOrLds_32:$src0),
158 "v_readfirstlane_b32 $vdst, $src0",
159 [(set i32:$vdst, (int_amdgcn_readfirstlane i32:$src0))]>,
162 let isCodeGenOnly = 0;
163 let UseNamedOperandTable = 1;
168 let hasSideEffects = 0;
173 let isConvergent = 1;
178 let Inst{8-0} = src0;
179 let Inst{16-9} = 0x2;
180 let Inst{24-17} = vdst;
181 let Inst{31-25} = 0x3f; //encoding
184 let SchedRW = [WriteDoubleCvt] in {
185 defm V_CVT_I32_F64 : VOP1Inst <"v_cvt_i32_f64", VOP_I32_F64, fp_to_sint>;
186 defm V_CVT_F64_I32 : VOP1Inst <"v_cvt_f64_i32", VOP1_F64_I32, sint_to_fp>;
187 defm V_CVT_F32_F64 : VOP1Inst <"v_cvt_f32_f64", VOP_F32_F64, fpround>;
188 defm V_CVT_F64_F32 : VOP1Inst <"v_cvt_f64_f32", VOP_F64_F32, fpextend>;
189 defm V_CVT_U32_F64 : VOP1Inst <"v_cvt_u32_f64", VOP_I32_F64, fp_to_uint>;
190 defm V_CVT_F64_U32 : VOP1Inst <"v_cvt_f64_u32", VOP1_F64_I32, uint_to_fp>;
191 } // End SchedRW = [WriteDoubleCvt]
193 let SchedRW = [WriteQuarterRate32] in {
194 defm V_CVT_F32_I32 : VOP1Inst <"v_cvt_f32_i32", VOP1_F32_I32, sint_to_fp>;
195 defm V_CVT_F32_U32 : VOP1Inst <"v_cvt_f32_u32", VOP1_F32_I32, uint_to_fp>;
196 defm V_CVT_U32_F32 : VOP1Inst <"v_cvt_u32_f32", VOP_I32_F32, fp_to_uint>;
197 defm V_CVT_I32_F32 : VOP1Inst <"v_cvt_i32_f32", VOP_I32_F32, fp_to_sint>;
198 let FPDPRounding = 1 in {
199 defm V_CVT_F16_F32 : VOP1Inst <"v_cvt_f16_f32", VOP_F16_F32, fpround>;
200 } // End FPDPRounding = 1
201 defm V_CVT_F32_F16 : VOP1Inst <"v_cvt_f32_f16", VOP_F32_F16, fpextend>;
202 defm V_CVT_RPI_I32_F32 : VOP1Inst <"v_cvt_rpi_i32_f32", VOP_I32_F32, cvt_rpi_i32_f32>;
203 defm V_CVT_FLR_I32_F32 : VOP1Inst <"v_cvt_flr_i32_f32", VOP_I32_F32, cvt_flr_i32_f32>;
204 defm V_CVT_OFF_F32_I4 : VOP1Inst <"v_cvt_off_f32_i4", VOP1_F32_I32>;
205 } // End SchedRW = [WriteQuarterRate32]
207 defm V_CVT_F32_UBYTE0 : VOP1Inst <"v_cvt_f32_ubyte0", VOP1_F32_I32, AMDGPUcvt_f32_ubyte0>;
208 defm V_CVT_F32_UBYTE1 : VOP1Inst <"v_cvt_f32_ubyte1", VOP1_F32_I32, AMDGPUcvt_f32_ubyte1>;
209 defm V_CVT_F32_UBYTE2 : VOP1Inst <"v_cvt_f32_ubyte2", VOP1_F32_I32, AMDGPUcvt_f32_ubyte2>;
210 defm V_CVT_F32_UBYTE3 : VOP1Inst <"v_cvt_f32_ubyte3", VOP1_F32_I32, AMDGPUcvt_f32_ubyte3>;
212 defm V_FRACT_F32 : VOP1Inst <"v_fract_f32", VOP_F32_F32, AMDGPUfract>;
213 defm V_TRUNC_F32 : VOP1Inst <"v_trunc_f32", VOP_F32_F32, ftrunc>;
214 defm V_CEIL_F32 : VOP1Inst <"v_ceil_f32", VOP_F32_F32, fceil>;
215 defm V_RNDNE_F32 : VOP1Inst <"v_rndne_f32", VOP_F32_F32, frint>;
216 defm V_FLOOR_F32 : VOP1Inst <"v_floor_f32", VOP_F32_F32, ffloor>;
218 let SchedRW = [WriteQuarterRate32] in {
219 defm V_EXP_F32 : VOP1Inst <"v_exp_f32", VOP_F32_F32, fexp2>;
220 defm V_LOG_F32 : VOP1Inst <"v_log_f32", VOP_F32_F32, flog2>;
221 defm V_RCP_F32 : VOP1Inst <"v_rcp_f32", VOP_F32_F32, AMDGPUrcp>;
222 defm V_RCP_IFLAG_F32 : VOP1Inst <"v_rcp_iflag_f32", VOP_F32_F32, AMDGPUrcp_iflag>;
223 defm V_RSQ_F32 : VOP1Inst <"v_rsq_f32", VOP_F32_F32, AMDGPUrsq>;
224 defm V_SQRT_F32 : VOP1Inst <"v_sqrt_f32", VOP_F32_F32, fsqrt>;
225 } // End SchedRW = [WriteQuarterRate32]
227 let SchedRW = [WriteDouble] in {
228 defm V_RCP_F64 : VOP1Inst <"v_rcp_f64", VOP_F64_F64, AMDGPUrcp>;
229 defm V_RSQ_F64 : VOP1Inst <"v_rsq_f64", VOP_F64_F64, AMDGPUrsq>;
230 } // End SchedRW = [WriteDouble];
232 let SchedRW = [WriteDouble] in {
233 defm V_SQRT_F64 : VOP1Inst <"v_sqrt_f64", VOP_F64_F64, fsqrt>;
234 } // End SchedRW = [WriteDouble]
236 let SchedRW = [WriteQuarterRate32] in {
237 defm V_SIN_F32 : VOP1Inst <"v_sin_f32", VOP_F32_F32, AMDGPUsin>;
238 defm V_COS_F32 : VOP1Inst <"v_cos_f32", VOP_F32_F32, AMDGPUcos>;
239 } // End SchedRW = [WriteQuarterRate32]
241 defm V_NOT_B32 : VOP1Inst <"v_not_b32", VOP_I32_I32>;
242 defm V_BFREV_B32 : VOP1Inst <"v_bfrev_b32", VOP_I32_I32, bitreverse>;
243 defm V_FFBH_U32 : VOP1Inst <"v_ffbh_u32", VOP_I32_I32, AMDGPUffbh_u32>;
244 defm V_FFBL_B32 : VOP1Inst <"v_ffbl_b32", VOP_I32_I32>;
245 defm V_FFBH_I32 : VOP1Inst <"v_ffbh_i32", VOP_I32_I32, AMDGPUffbh_i32>;
247 let SchedRW = [WriteDoubleAdd] in {
248 defm V_FREXP_EXP_I32_F64 : VOP1Inst <"v_frexp_exp_i32_f64", VOP_I32_F64, int_amdgcn_frexp_exp>;
249 defm V_FREXP_MANT_F64 : VOP1Inst <"v_frexp_mant_f64", VOP_F64_F64, int_amdgcn_frexp_mant>;
250 let FPDPRounding = 1 in {
251 defm V_FRACT_F64 : VOP1Inst <"v_fract_f64", VOP_F64_F64, AMDGPUfract>;
252 } // End FPDPRounding = 1
253 } // End SchedRW = [WriteDoubleAdd]
255 defm V_FREXP_EXP_I32_F32 : VOP1Inst <"v_frexp_exp_i32_f32", VOP_I32_F32, int_amdgcn_frexp_exp>;
256 defm V_FREXP_MANT_F32 : VOP1Inst <"v_frexp_mant_f32", VOP_F32_F32, int_amdgcn_frexp_mant>;
258 let VOPAsmPrefer32Bit = 1 in {
259 defm V_CLREXCP : VOP1Inst <"v_clrexcp", VOP_NO_EXT<VOP_NONE>>;
262 // Restrict src0 to be VGPR
263 def VOP_I32_VI32_NO_EXT : VOPProfile<[i32, i32, untyped, untyped]> {
264 let Src0RC32 = VRegSrc_32;
265 let Src0RC64 = VRegSrc_32;
273 // Special case because there are no true output operands. Hack vdst
274 // to be a src operand. The custom inserter must add a tied implicit
275 // def and use of the super register since there seems to be no way to
276 // add an implicit def of a virtual register in tablegen.
277 def VOP_MOVRELD : VOPProfile<[untyped, i32, untyped, untyped]> {
278 let Src0RC32 = VOPDstOperand<VGPR_32>;
279 let Src0RC64 = VOPDstOperand<VGPR_32>;
282 let Ins32 = (ins Src0RC32:$vdst, VSrc_b32:$src0);
283 let Ins64 = (ins Src0RC64:$vdst, VSrc_b32:$src0);
284 let InsDPP = (ins DstRC:$vdst, DstRC:$old, Src0RC32:$src0,
285 dpp_ctrl:$dpp_ctrl, row_mask:$row_mask,
286 bank_mask:$bank_mask, bound_ctrl:$bound_ctrl);
287 let InsDPP16 = !con(InsDPP, (ins FI:$fi));
289 let InsSDWA = (ins Src0RC32:$vdst, Src0ModSDWA:$src0_modifiers, Src0SDWA:$src0,
290 clampmod:$clamp, omod:$omod, dst_sel:$dst_sel, dst_unused:$dst_unused,
293 let Asm32 = getAsm32<1, 1>.ret;
294 let Asm64 = getAsm64<1, 1, 0, 0, 1>.ret;
295 let AsmDPP = getAsmDPP<1, 1, 0>.ret;
296 let AsmDPP16 = getAsmDPP16<1, 1, 0>.ret;
297 let AsmSDWA = getAsmSDWA<1, 1>.ret;
298 let AsmSDWA9 = getAsmSDWA9<1, 0, 1>.ret;
306 let EmitDst = 1; // force vdst emission
309 let SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in {
310 // v_movreld_b32 is a special case because the destination output
311 // register is really a source. It isn't actually read (but may be
312 // written), and is only to provide the base register to start
313 // indexing from. Tablegen seems to not let you define an implicit
314 // virtual register output for the super register being written into,
315 // so this must have an implicit def of the register added to it.
316 defm V_MOVRELD_B32 : VOP1Inst <"v_movreld_b32", VOP_MOVRELD>;
317 defm V_MOVRELS_B32 : VOP1Inst <"v_movrels_b32", VOP_I32_VI32_NO_EXT>;
318 defm V_MOVRELSD_B32 : VOP1Inst <"v_movrelsd_b32", VOP_NO_EXT<VOP_I32_I32>>;
319 } // End Uses = [M0, EXEC]
321 defm V_MOV_FED_B32 : VOP1Inst <"v_mov_fed_b32", VOP_I32_I32>;
323 let SubtargetPredicate = isGFX6GFX7 in {
324 let SchedRW = [WriteQuarterRate32] in {
325 defm V_LOG_CLAMP_F32 :
326 VOP1Inst<"v_log_clamp_f32", VOP_F32_F32, int_amdgcn_log_clamp>;
327 defm V_RCP_CLAMP_F32 :
328 VOP1Inst<"v_rcp_clamp_f32", VOP_F32_F32>;
329 defm V_RCP_LEGACY_F32 :
330 VOP1Inst<"v_rcp_legacy_f32", VOP_F32_F32, AMDGPUrcp_legacy>;
331 defm V_RSQ_CLAMP_F32 :
332 VOP1Inst<"v_rsq_clamp_f32", VOP_F32_F32, AMDGPUrsq_clamp>;
333 defm V_RSQ_LEGACY_F32 :
334 VOP1Inst<"v_rsq_legacy_f32", VOP_F32_F32, AMDGPUrsq_legacy>;
335 } // End SchedRW = [WriteQuarterRate32]
337 let SchedRW = [WriteDouble] in {
338 defm V_RCP_CLAMP_F64 :
339 VOP1Inst<"v_rcp_clamp_f64", VOP_F64_F64>;
340 defm V_RSQ_CLAMP_F64 :
341 VOP1Inst<"v_rsq_clamp_f64", VOP_F64_F64, AMDGPUrsq_clamp>;
342 } // End SchedRW = [WriteDouble]
343 } // End SubtargetPredicate = isGFX6GFX7
345 let SubtargetPredicate = isGFX7GFX8GFX9 in {
346 let SchedRW = [WriteQuarterRate32] in {
347 defm V_LOG_LEGACY_F32 : VOP1Inst<"v_log_legacy_f32", VOP_F32_F32>;
348 defm V_EXP_LEGACY_F32 : VOP1Inst<"v_exp_legacy_f32", VOP_F32_F32>;
349 } // End SchedRW = [WriteQuarterRate32]
350 } // End SubtargetPredicate = isGFX7GFX8GFX9
352 let SubtargetPredicate = isGFX7Plus in {
353 let SchedRW = [WriteDoubleAdd] in {
354 defm V_TRUNC_F64 : VOP1Inst<"v_trunc_f64", VOP_F64_F64, ftrunc>;
355 defm V_CEIL_F64 : VOP1Inst<"v_ceil_f64", VOP_F64_F64, fceil>;
356 defm V_RNDNE_F64 : VOP1Inst<"v_rndne_f64", VOP_F64_F64, frint>;
357 defm V_FLOOR_F64 : VOP1Inst<"v_floor_f64", VOP_F64_F64, ffloor>;
358 } // End SchedRW = [WriteDoubleAdd]
359 } // End SubtargetPredicate = isGFX7Plus
361 let SubtargetPredicate = Has16BitInsts in {
363 let FPDPRounding = 1 in {
364 defm V_CVT_F16_U16 : VOP1Inst <"v_cvt_f16_u16", VOP1_F16_I16, uint_to_fp>;
365 defm V_CVT_F16_I16 : VOP1Inst <"v_cvt_f16_i16", VOP1_F16_I16, sint_to_fp>;
366 } // End FPDPRounding = 1
367 defm V_CVT_U16_F16 : VOP1Inst <"v_cvt_u16_f16", VOP_I16_F16, fp_to_uint>;
368 defm V_CVT_I16_F16 : VOP1Inst <"v_cvt_i16_f16", VOP_I16_F16, fp_to_sint>;
369 let SchedRW = [WriteQuarterRate32] in {
370 defm V_RCP_F16 : VOP1Inst <"v_rcp_f16", VOP_F16_F16, AMDGPUrcp>;
371 defm V_SQRT_F16 : VOP1Inst <"v_sqrt_f16", VOP_F16_F16, fsqrt>;
372 defm V_RSQ_F16 : VOP1Inst <"v_rsq_f16", VOP_F16_F16, AMDGPUrsq>;
373 defm V_LOG_F16 : VOP1Inst <"v_log_f16", VOP_F16_F16, flog2>;
374 defm V_EXP_F16 : VOP1Inst <"v_exp_f16", VOP_F16_F16, fexp2>;
375 defm V_SIN_F16 : VOP1Inst <"v_sin_f16", VOP_F16_F16, AMDGPUsin>;
376 defm V_COS_F16 : VOP1Inst <"v_cos_f16", VOP_F16_F16, AMDGPUcos>;
377 } // End SchedRW = [WriteQuarterRate32]
378 defm V_FREXP_MANT_F16 : VOP1Inst <"v_frexp_mant_f16", VOP_F16_F16, int_amdgcn_frexp_mant>;
379 defm V_FREXP_EXP_I16_F16 : VOP1Inst <"v_frexp_exp_i16_f16", VOP_I16_F16, int_amdgcn_frexp_exp>;
380 defm V_FLOOR_F16 : VOP1Inst <"v_floor_f16", VOP_F16_F16, ffloor>;
381 defm V_CEIL_F16 : VOP1Inst <"v_ceil_f16", VOP_F16_F16, fceil>;
382 defm V_TRUNC_F16 : VOP1Inst <"v_trunc_f16", VOP_F16_F16, ftrunc>;
383 defm V_RNDNE_F16 : VOP1Inst <"v_rndne_f16", VOP_F16_F16, frint>;
384 let FPDPRounding = 1 in {
385 defm V_FRACT_F16 : VOP1Inst <"v_fract_f16", VOP_F16_F16, AMDGPUfract>;
386 } // End FPDPRounding = 1
390 let OtherPredicates = [Has16BitInsts] in {
393 (f32 (f16_to_fp i16:$src)),
394 (V_CVT_F32_F16_e32 $src)
398 (i16 (AMDGPUfp_to_f16 f32:$src)),
399 (V_CVT_F16_F32_e32 $src)
404 def VOP_SWAP_I32 : VOPProfile<[i32, i32, i32, untyped]> {
405 let Outs32 = (outs VGPR_32:$vdst, VGPR_32:$vdst1);
406 let Ins32 = (ins VGPR_32:$src0, VGPR_32:$src1);
408 let Asm32 = " $vdst, $src0";
413 let SubtargetPredicate = isGFX9Plus in {
414 def V_SWAP_B32 : VOP1_Pseudo<"v_swap_b32", VOP_SWAP_I32, [], 1> {
415 let Constraints = "$vdst = $src1, $vdst1 = $src0";
416 let DisableEncoding = "$vdst1,$src1";
417 let SchedRW = [Write64Bit, Write64Bit];
420 defm V_SAT_PK_U8_I16 : VOP1Inst<"v_sat_pk_u8_i16", VOP_I32_I32>;
421 defm V_CVT_NORM_I16_F16 : VOP1Inst<"v_cvt_norm_i16_f16", VOP_I16_F16>;
422 defm V_CVT_NORM_U16_F16 : VOP1Inst<"v_cvt_norm_u16_f16", VOP_I16_F16>;
423 } // End SubtargetPredicate = isGFX9Plus
425 let SubtargetPredicate = isGFX9Only in {
426 defm V_SCREEN_PARTITION_4SE_B32 : VOP1Inst <"v_screen_partition_4se_b32", VOP_I32_I32>;
427 } // End SubtargetPredicate = isGFX9Only
429 let SubtargetPredicate = isGFX10Plus in {
430 defm V_PIPEFLUSH : VOP1Inst<"v_pipeflush", VOP_NONE>;
433 // FIXME-GFX10: Should V_MOVRELSD_2_B32 be VOP_NO_EXT?
434 defm V_MOVRELSD_2_B32 :
435 VOP1Inst<"v_movrelsd_2_b32", VOP_NO_EXT<VOP_I32_I32>>;
437 def V_SWAPREL_B32 : VOP1_Pseudo<"v_swaprel_b32", VOP_SWAP_I32, [], 1> {
438 let Constraints = "$vdst = $src1, $vdst1 = $src0";
439 let DisableEncoding = "$vdst1,$src1";
440 let SchedRW = [Write64Bit, Write64Bit];
443 } // End SubtargetPredicate = isGFX10Plus
445 //===----------------------------------------------------------------------===//
446 // Target-specific instruction encodings.
447 //===----------------------------------------------------------------------===//
449 class VOP1_DPP<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl, bit isDPP16 = 0> :
450 VOP_DPP<ps.OpName, p, isDPP16> {
451 let hasSideEffects = ps.hasSideEffects;
453 let SchedRW = ps.SchedRW;
457 let Inst{8-0} = 0xfa;
459 let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
460 let Inst{31-25} = 0x3f;
463 class VOP1_DPP16<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl> :
464 VOP1_DPP<op, ps, p, 1>,
465 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.GFX10> {
466 let AssemblerPredicate = !if(p.HasExt, HasDPP16, DisableInst);
467 let SubtargetPredicate = HasDPP16;
470 class VOP1_DPP8<bits<8> op, VOP1_Pseudo ps, VOPProfile p = ps.Pfl> :
471 VOP_DPP8<ps.OpName, p> {
472 let hasSideEffects = ps.hasSideEffects;
474 let SchedRW = ps.SchedRW;
480 let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
481 let Inst{31-25} = 0x3f;
483 let AssemblerPredicate = !if(p.HasExt, HasDPP8, DisableInst);
484 let SubtargetPredicate = HasDPP8;
487 //===----------------------------------------------------------------------===//
489 //===----------------------------------------------------------------------===//
491 let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
492 multiclass VOP1Only_Real_gfx10<bits<9> op> {
494 VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.GFX10>,
495 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
497 multiclass VOP1_Real_e32_gfx10<bits<9> op> {
499 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.GFX10>,
500 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
502 multiclass VOP1_Real_e64_gfx10<bits<9> op> {
504 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>,
505 VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
507 multiclass VOP1_Real_sdwa_gfx10<bits<9> op> {
508 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
510 VOP_SDWA10_Real<!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
511 VOP1_SDWA9Ae<op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
512 let DecoderNamespace = "SDWA10";
515 multiclass VOP1_Real_dpp_gfx10<bits<9> op> {
516 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
517 def _dpp_gfx10 : VOP1_DPP16<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")> {
518 let DecoderNamespace = "SDWA10";
521 multiclass VOP1_Real_dpp8_gfx10<bits<9> op> {
522 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
523 def _dpp8_gfx10 : VOP1_DPP8<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32")> {
524 let DecoderNamespace = "DPP8";
527 } // End AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10"
529 multiclass VOP1_Real_gfx10_no_dpp<bits<9> op> :
530 VOP1_Real_e32_gfx10<op>, VOP1_Real_e64_gfx10<op>,
531 VOP1_Real_sdwa_gfx10<op>;
533 multiclass VOP1_Real_gfx10_no_dpp8<bits<9> op> :
534 VOP1_Real_e32_gfx10<op>, VOP1_Real_e64_gfx10<op>,
535 VOP1_Real_sdwa_gfx10<op>, VOP1_Real_dpp_gfx10<op>;
537 multiclass VOP1_Real_gfx10<bits<9> op> :
538 VOP1_Real_gfx10_no_dpp8<op>, VOP1_Real_dpp8_gfx10<op>;
540 defm V_PIPEFLUSH : VOP1_Real_gfx10<0x01b>;
541 defm V_MOVRELSD_2_B32 : VOP1_Real_gfx10<0x048>;
542 defm V_CVT_F16_U16 : VOP1_Real_gfx10<0x050>;
543 defm V_CVT_F16_I16 : VOP1_Real_gfx10<0x051>;
544 defm V_CVT_U16_F16 : VOP1_Real_gfx10<0x052>;
545 defm V_CVT_I16_F16 : VOP1_Real_gfx10<0x053>;
546 defm V_RCP_F16 : VOP1_Real_gfx10<0x054>;
547 defm V_SQRT_F16 : VOP1_Real_gfx10<0x055>;
548 defm V_RSQ_F16 : VOP1_Real_gfx10<0x056>;
549 defm V_LOG_F16 : VOP1_Real_gfx10<0x057>;
550 defm V_EXP_F16 : VOP1_Real_gfx10<0x058>;
551 defm V_FREXP_MANT_F16 : VOP1_Real_gfx10<0x059>;
552 defm V_FREXP_EXP_I16_F16 : VOP1_Real_gfx10<0x05a>;
553 defm V_FLOOR_F16 : VOP1_Real_gfx10<0x05b>;
554 defm V_CEIL_F16 : VOP1_Real_gfx10<0x05c>;
555 defm V_TRUNC_F16 : VOP1_Real_gfx10<0x05d>;
556 defm V_RNDNE_F16 : VOP1_Real_gfx10<0x05e>;
557 defm V_FRACT_F16 : VOP1_Real_gfx10<0x05f>;
558 defm V_SIN_F16 : VOP1_Real_gfx10<0x060>;
559 defm V_COS_F16 : VOP1_Real_gfx10<0x061>;
560 defm V_SAT_PK_U8_I16 : VOP1_Real_gfx10<0x062>;
561 defm V_CVT_NORM_I16_F16 : VOP1_Real_gfx10<0x063>;
562 defm V_CVT_NORM_U16_F16 : VOP1_Real_gfx10<0x064>;
564 defm V_SWAP_B32 : VOP1Only_Real_gfx10<0x065>;
565 defm V_SWAPREL_B32 : VOP1Only_Real_gfx10<0x068>;
567 //===----------------------------------------------------------------------===//
569 //===----------------------------------------------------------------------===//
571 let AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in {
572 multiclass VOP1_Real_e32_gfx7<bits<9> op> {
574 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
575 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
577 multiclass VOP1_Real_e64_gfx7<bits<9> op> {
579 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
580 VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
582 } // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7"
584 multiclass VOP1_Real_gfx7<bits<9> op> :
585 VOP1_Real_e32_gfx7<op>, VOP1_Real_e64_gfx7<op>;
587 multiclass VOP1_Real_gfx7_gfx10<bits<9> op> :
588 VOP1_Real_gfx7<op>, VOP1_Real_gfx10<op>;
590 defm V_LOG_LEGACY_F32 : VOP1_Real_gfx7<0x045>;
591 defm V_EXP_LEGACY_F32 : VOP1_Real_gfx7<0x046>;
593 defm V_TRUNC_F64 : VOP1_Real_gfx7_gfx10<0x017>;
594 defm V_CEIL_F64 : VOP1_Real_gfx7_gfx10<0x018>;
595 defm V_RNDNE_F64 : VOP1_Real_gfx7_gfx10<0x019>;
596 defm V_FLOOR_F64 : VOP1_Real_gfx7_gfx10<0x01a>;
598 //===----------------------------------------------------------------------===//
599 // GFX6, GFX7, GFX10.
600 //===----------------------------------------------------------------------===//
602 let AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in {
603 multiclass VOP1_Real_e32_gfx6_gfx7<bits<9> op> {
605 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
606 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
608 multiclass VOP1_Real_e64_gfx6_gfx7<bits<9> op> {
610 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
611 VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
613 } // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7"
615 multiclass VOP1_Real_gfx6_gfx7<bits<9> op> :
616 VOP1_Real_e32_gfx6_gfx7<op>, VOP1_Real_e64_gfx6_gfx7<op>;
618 multiclass VOP1_Real_gfx6_gfx7_gfx10<bits<9> op> :
619 VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10<op>;
621 multiclass VOP1_Real_gfx6_gfx7_gfx10_no_dpp8<bits<9> op> :
622 VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10_no_dpp8<op>;
624 multiclass VOP1_Real_gfx6_gfx7_gfx10_no_dpp<bits<9> op> :
625 VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10_no_dpp<op>;
627 defm V_LOG_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x026>;
628 defm V_RCP_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x028>;
629 defm V_RCP_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x029>;
630 defm V_RSQ_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x02c>;
631 defm V_RSQ_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x02d>;
632 defm V_RCP_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x030>;
633 defm V_RSQ_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x032>;
635 defm V_NOP : VOP1_Real_gfx6_gfx7_gfx10<0x000>;
636 defm V_MOV_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x001>;
637 defm V_CVT_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x003>;
638 defm V_CVT_F64_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x004>;
639 defm V_CVT_F32_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x005>;
640 defm V_CVT_F32_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x006>;
641 defm V_CVT_U32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x007>;
642 defm V_CVT_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x008>;
643 defm V_MOV_FED_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x009>;
644 defm V_CVT_F16_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00a>;
645 defm V_CVT_F32_F16 : VOP1_Real_gfx6_gfx7_gfx10<0x00b>;
646 defm V_CVT_RPI_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00c>;
647 defm V_CVT_FLR_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00d>;
648 defm V_CVT_OFF_F32_I4 : VOP1_Real_gfx6_gfx7_gfx10<0x00e>;
649 defm V_CVT_F32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x00f>;
650 defm V_CVT_F64_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x010>;
651 defm V_CVT_F32_UBYTE0 : VOP1_Real_gfx6_gfx7_gfx10<0x011>;
652 defm V_CVT_F32_UBYTE1 : VOP1_Real_gfx6_gfx7_gfx10<0x012>;
653 defm V_CVT_F32_UBYTE2 : VOP1_Real_gfx6_gfx7_gfx10<0x013>;
654 defm V_CVT_F32_UBYTE3 : VOP1_Real_gfx6_gfx7_gfx10<0x014>;
655 defm V_CVT_U32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x015>;
656 defm V_CVT_F64_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x016>;
657 defm V_FRACT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x020>;
658 defm V_TRUNC_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x021>;
659 defm V_CEIL_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x022>;
660 defm V_RNDNE_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x023>;
661 defm V_FLOOR_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x024>;
662 defm V_EXP_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x025>;
663 defm V_LOG_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x027>;
664 defm V_RCP_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02a>;
665 defm V_RCP_IFLAG_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02b>;
666 defm V_RSQ_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02e>;
667 defm V_RCP_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x02f>;
668 defm V_RSQ_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x031>;
669 defm V_SQRT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x033>;
670 defm V_SQRT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x034>;
671 defm V_SIN_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x035>;
672 defm V_COS_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x036>;
673 defm V_NOT_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x037>;
674 defm V_BFREV_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x038>;
675 defm V_FFBH_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x039>;
676 defm V_FFBL_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x03a>;
677 defm V_FFBH_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x03b>;
678 defm V_FREXP_EXP_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03c>;
679 defm V_FREXP_MANT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03d>;
680 defm V_FRACT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03e>;
681 defm V_FREXP_EXP_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x03f>;
682 defm V_FREXP_MANT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x040>;
683 defm V_CLREXCP : VOP1_Real_gfx6_gfx7_gfx10<0x041>;
684 defm V_MOVRELD_B32 : VOP1_Real_gfx6_gfx7_gfx10_no_dpp<0x042>;
685 defm V_MOVRELS_B32 : VOP1_Real_gfx6_gfx7_gfx10_no_dpp8<0x043>;
686 defm V_MOVRELSD_B32 : VOP1_Real_gfx6_gfx7_gfx10_no_dpp8<0x044>;
688 //===----------------------------------------------------------------------===//
690 //===----------------------------------------------------------------------===//
692 class VOP1_DPPe <bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile P = ps.Pfl> :
695 let Inst{8-0} = 0xfa; // dpp
697 let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
698 let Inst{31-25} = 0x3f; //encoding
701 multiclass VOP1Only_Real_vi <bits<10> op> {
702 let AssemblerPredicates = [isGFX8GFX9], DecoderNamespace = "GFX8" in {
704 VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.VI>,
705 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
709 multiclass VOP1_Real_e32e64_vi <bits<10> op> {
710 let AssemblerPredicates = [isGFX8GFX9], DecoderNamespace = "GFX8" in {
712 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.VI>,
713 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
715 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>,
716 VOP3e_vi <!add(0x140, op), !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
720 multiclass VOP1_Real_vi <bits<10> op> {
721 defm NAME : VOP1_Real_e32e64_vi <op>;
723 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
725 VOP_SDWA_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
726 VOP1_SDWAe <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
728 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
730 VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
731 VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
733 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
735 VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.VI>,
736 VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
739 defm V_NOP : VOP1_Real_vi <0x0>;
740 defm V_MOV_B32 : VOP1_Real_vi <0x1>;
741 defm V_CVT_I32_F64 : VOP1_Real_vi <0x3>;
742 defm V_CVT_F64_I32 : VOP1_Real_vi <0x4>;
743 defm V_CVT_F32_I32 : VOP1_Real_vi <0x5>;
744 defm V_CVT_F32_U32 : VOP1_Real_vi <0x6>;
745 defm V_CVT_U32_F32 : VOP1_Real_vi <0x7>;
746 defm V_CVT_I32_F32 : VOP1_Real_vi <0x8>;
747 defm V_MOV_FED_B32 : VOP1_Real_vi <0x9>;
748 defm V_CVT_F16_F32 : VOP1_Real_vi <0xa>;
749 defm V_CVT_F32_F16 : VOP1_Real_vi <0xb>;
750 defm V_CVT_RPI_I32_F32 : VOP1_Real_vi <0xc>;
751 defm V_CVT_FLR_I32_F32 : VOP1_Real_vi <0xd>;
752 defm V_CVT_OFF_F32_I4 : VOP1_Real_vi <0xe>;
753 defm V_CVT_F32_F64 : VOP1_Real_vi <0xf>;
754 defm V_CVT_F64_F32 : VOP1_Real_vi <0x10>;
755 defm V_CVT_F32_UBYTE0 : VOP1_Real_vi <0x11>;
756 defm V_CVT_F32_UBYTE1 : VOP1_Real_vi <0x12>;
757 defm V_CVT_F32_UBYTE2 : VOP1_Real_vi <0x13>;
758 defm V_CVT_F32_UBYTE3 : VOP1_Real_vi <0x14>;
759 defm V_CVT_U32_F64 : VOP1_Real_vi <0x15>;
760 defm V_CVT_F64_U32 : VOP1_Real_vi <0x16>;
761 defm V_FRACT_F32 : VOP1_Real_vi <0x1b>;
762 defm V_TRUNC_F32 : VOP1_Real_vi <0x1c>;
763 defm V_CEIL_F32 : VOP1_Real_vi <0x1d>;
764 defm V_RNDNE_F32 : VOP1_Real_vi <0x1e>;
765 defm V_FLOOR_F32 : VOP1_Real_vi <0x1f>;
766 defm V_EXP_F32 : VOP1_Real_vi <0x20>;
767 defm V_LOG_F32 : VOP1_Real_vi <0x21>;
768 defm V_RCP_F32 : VOP1_Real_vi <0x22>;
769 defm V_RCP_IFLAG_F32 : VOP1_Real_vi <0x23>;
770 defm V_RSQ_F32 : VOP1_Real_vi <0x24>;
771 defm V_RCP_F64 : VOP1_Real_vi <0x25>;
772 defm V_RSQ_F64 : VOP1_Real_vi <0x26>;
773 defm V_SQRT_F32 : VOP1_Real_vi <0x27>;
774 defm V_SQRT_F64 : VOP1_Real_vi <0x28>;
775 defm V_SIN_F32 : VOP1_Real_vi <0x29>;
776 defm V_COS_F32 : VOP1_Real_vi <0x2a>;
777 defm V_NOT_B32 : VOP1_Real_vi <0x2b>;
778 defm V_BFREV_B32 : VOP1_Real_vi <0x2c>;
779 defm V_FFBH_U32 : VOP1_Real_vi <0x2d>;
780 defm V_FFBL_B32 : VOP1_Real_vi <0x2e>;
781 defm V_FFBH_I32 : VOP1_Real_vi <0x2f>;
782 defm V_FREXP_EXP_I32_F64 : VOP1_Real_vi <0x30>;
783 defm V_FREXP_MANT_F64 : VOP1_Real_vi <0x31>;
784 defm V_FRACT_F64 : VOP1_Real_vi <0x32>;
785 defm V_FREXP_EXP_I32_F32 : VOP1_Real_vi <0x33>;
786 defm V_FREXP_MANT_F32 : VOP1_Real_vi <0x34>;
787 defm V_CLREXCP : VOP1_Real_vi <0x35>;
788 defm V_MOVRELD_B32 : VOP1_Real_e32e64_vi <0x36>;
789 defm V_MOVRELS_B32 : VOP1_Real_e32e64_vi <0x37>;
790 defm V_MOVRELSD_B32 : VOP1_Real_e32e64_vi <0x38>;
791 defm V_TRUNC_F64 : VOP1_Real_vi <0x17>;
792 defm V_CEIL_F64 : VOP1_Real_vi <0x18>;
793 defm V_FLOOR_F64 : VOP1_Real_vi <0x1A>;
794 defm V_RNDNE_F64 : VOP1_Real_vi <0x19>;
795 defm V_LOG_LEGACY_F32 : VOP1_Real_vi <0x4c>;
796 defm V_EXP_LEGACY_F32 : VOP1_Real_vi <0x4b>;
797 defm V_CVT_F16_U16 : VOP1_Real_vi <0x39>;
798 defm V_CVT_F16_I16 : VOP1_Real_vi <0x3a>;
799 defm V_CVT_U16_F16 : VOP1_Real_vi <0x3b>;
800 defm V_CVT_I16_F16 : VOP1_Real_vi <0x3c>;
801 defm V_RCP_F16 : VOP1_Real_vi <0x3d>;
802 defm V_SQRT_F16 : VOP1_Real_vi <0x3e>;
803 defm V_RSQ_F16 : VOP1_Real_vi <0x3f>;
804 defm V_LOG_F16 : VOP1_Real_vi <0x40>;
805 defm V_EXP_F16 : VOP1_Real_vi <0x41>;
806 defm V_FREXP_MANT_F16 : VOP1_Real_vi <0x42>;
807 defm V_FREXP_EXP_I16_F16 : VOP1_Real_vi <0x43>;
808 defm V_FLOOR_F16 : VOP1_Real_vi <0x44>;
809 defm V_CEIL_F16 : VOP1_Real_vi <0x45>;
810 defm V_TRUNC_F16 : VOP1_Real_vi <0x46>;
811 defm V_RNDNE_F16 : VOP1_Real_vi <0x47>;
812 defm V_FRACT_F16 : VOP1_Real_vi <0x48>;
813 defm V_SIN_F16 : VOP1_Real_vi <0x49>;
814 defm V_COS_F16 : VOP1_Real_vi <0x4a>;
815 defm V_SWAP_B32 : VOP1Only_Real_vi <0x51>;
817 defm V_SAT_PK_U8_I16 : VOP1_Real_vi<0x4f>;
818 defm V_CVT_NORM_I16_F16 : VOP1_Real_vi<0x4d>;
819 defm V_CVT_NORM_U16_F16 : VOP1_Real_vi<0x4e>;
821 // Copy of v_mov_b32 with $vdst as a use operand for use with VGPR
822 // indexing mode. vdst can't be treated as a def for codegen purposes,
823 // and an implicit use and def of the super register should be added.
824 def V_MOV_B32_indirect : VPseudoInstSI<(outs),
825 (ins getVALUDstForVT<i32>.ret:$vdst, getVOPSrc0ForVT<i32>.ret:$src0)>,
826 PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst,
827 getVOPSrc0ForVT<i32>.ret:$src0)> {
829 let SubtargetPredicate = isGFX8GFX9;
832 // This is a pseudo variant of the v_movreld_b32 instruction in which the
833 // vector operand appears only twice, once as def and once as use. Using this
834 // pseudo avoids problems with the Two Address instructions pass.
835 class V_MOVRELD_B32_pseudo<RegisterClass rc> : VPseudoInstSI <
837 (ins rc:$vsrc, VSrc_b32:$val, i32imm:$offset)> {
840 let Constraints = "$vsrc = $vdst";
841 let Uses = [M0, EXEC];
843 let SubtargetPredicate = HasMovrel;
846 def V_MOVRELD_B32_V1 : V_MOVRELD_B32_pseudo<VGPR_32>;
847 def V_MOVRELD_B32_V2 : V_MOVRELD_B32_pseudo<VReg_64>;
848 def V_MOVRELD_B32_V4 : V_MOVRELD_B32_pseudo<VReg_128>;
849 def V_MOVRELD_B32_V8 : V_MOVRELD_B32_pseudo<VReg_256>;
850 def V_MOVRELD_B32_V16 : V_MOVRELD_B32_pseudo<VReg_512>;
852 let OtherPredicates = [isGFX8Plus] in {
855 (i32 (int_amdgcn_mov_dpp i32:$src, timm:$dpp_ctrl, timm:$row_mask, timm:$bank_mask,
857 (V_MOV_B32_dpp $src, $src, (as_i32imm $dpp_ctrl),
858 (as_i32imm $row_mask), (as_i32imm $bank_mask),
859 (as_i1imm $bound_ctrl))
863 (i32 (int_amdgcn_update_dpp i32:$old, i32:$src, timm:$dpp_ctrl, timm:$row_mask,
864 timm:$bank_mask, timm:$bound_ctrl)),
865 (V_MOV_B32_dpp $old, $src, (as_i32imm $dpp_ctrl),
866 (as_i32imm $row_mask), (as_i32imm $bank_mask),
867 (as_i1imm $bound_ctrl))
870 } // End OtherPredicates = [isGFX8Plus]
872 let OtherPredicates = [isGFX8Plus] in {
874 (i32 (anyext i16:$src)),
879 (i64 (anyext i16:$src)),
880 (REG_SEQUENCE VReg_64,
881 (i32 (COPY $src)), sub0,
882 (V_MOV_B32_e32 (i32 0)), sub1)
886 (i16 (trunc i32:$src)),
891 (i16 (trunc i64:$src)),
892 (EXTRACT_SUBREG $src, sub0)
895 } // End OtherPredicates = [isGFX8Plus]
897 //===----------------------------------------------------------------------===//
899 //===----------------------------------------------------------------------===//
901 multiclass VOP1_Real_gfx9 <bits<10> op> {
902 let AssemblerPredicates = [isGFX9Only], DecoderNamespace = "GFX9" in {
903 defm NAME : VOP1_Real_e32e64_vi <op>;
906 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
908 VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
909 VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
911 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
913 VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>,
914 VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
918 defm V_SCREEN_PARTITION_4SE_B32 : VOP1_Real_gfx9 <0x37>;
920 //===----------------------------------------------------------------------===//
922 //===----------------------------------------------------------------------===//
924 let OtherPredicates = [isGFX10Plus] in {
926 (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
927 (V_MOV_B32_dpp8_gfx10 $src, $src, (as_i32imm $dpp8), (i32 DPP8Mode.FI_0))
929 } // End OtherPredicates = [isGFX10Plus]