1 //===-- VOP1Instructions.td - Vector Instruction Definitions --------------===//
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;
51 let ReadsModeReg = !or(isFloatType<P.DstVT>.ret, isFloatType<P.Src0VT>.ret);
53 let mayRaiseFPException = ReadsModeReg;
57 let Uses = !if(ReadsModeReg, [MODE, EXEC], [EXEC]);
59 let AsmVariantName = AMDGPUAsmVariants.Default;
62 class VOP1_Real <VOP1_Pseudo ps, int EncodingFamily> :
64 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
65 SIMCInstr <ps.PseudoInstr, EncodingFamily> {
70 let isCodeGenOnly = 0;
72 let Constraints = ps.Constraints;
73 let DisableEncoding = ps.DisableEncoding;
75 // copy relevant pseudo op flags
76 let SubtargetPredicate = ps.SubtargetPredicate;
77 let AsmMatchConverter = ps.AsmMatchConverter;
78 let AsmVariantName = ps.AsmVariantName;
79 let Constraints = ps.Constraints;
80 let DisableEncoding = ps.DisableEncoding;
81 let TSFlags = ps.TSFlags;
82 let UseNamedOperandTable = ps.UseNamedOperandTable;
85 let SchedRW = ps.SchedRW;
86 let mayLoad = ps.mayLoad;
87 let mayStore = ps.mayStore;
91 class VOP1_SDWA_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
92 VOP_SDWA_Pseudo <OpName, P, pattern> {
93 let AsmMatchConverter = "cvtSdwaVOP1";
96 class VOP1_DPP_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
97 VOP_DPP_Pseudo <OpName, P, pattern> {
100 class getVOP1Pat64 <SDPatternOperator node, VOPProfile P> : LetDummies {
103 [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods P.Src0VT:$src0, i32:$src0_modifiers))))],
105 [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3OMods P.Src0VT:$src0,
106 i1:$clamp, i32:$omod))))],
107 [(set P.DstVT:$vdst, (node P.Src0VT:$src0))]
112 multiclass VOP1Inst <string opName, VOPProfile P,
113 SDPatternOperator node = null_frag> {
114 // We only want to set this on the basic, non-SDWA or DPP forms.
115 defvar should_mov_imm = !eq(opName, "v_mov_b32");
117 let isMoveImm = should_mov_imm in {
118 def _e32 : VOP1_Pseudo <opName, P>;
119 def _e64 : VOP3_Pseudo <opName, P, getVOP1Pat64<node, P>.ret>;
122 foreach _ = BoolToList<P.HasExtSDWA>.ret in
123 def _sdwa : VOP1_SDWA_Pseudo <opName, P>;
125 foreach _ = BoolToList<P.HasExtDPP>.ret in
126 def _dpp : VOP1_DPP_Pseudo <opName, P>;
128 def : MnemonicAlias<opName#"_e32", opName>, LetDummies;
129 def : MnemonicAlias<opName#"_e64", opName>, LetDummies;
131 foreach _ = BoolToList<P.HasExtSDWA>.ret in
132 def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies;
134 foreach _ = BoolToList<P.HasExtDPP>.ret in
135 def : MnemonicAlias<opName#"_dpp", opName>, LetDummies;
138 // Special profile for instructions which have clamp
139 // and output modifiers (but have no input modifiers)
140 class VOPProfileI2F<ValueType dstVt, ValueType srcVt> :
141 VOPProfile<[dstVt, srcVt, untyped, untyped]> {
143 let Ins64 = (ins Src0RC64:$src0, clampmod:$clamp, omod:$omod);
144 let Asm64 = "$vdst, $src0$clamp$omod";
146 let HasModifiers = 0;
150 def VOP1_F64_I32 : VOPProfileI2F <f64, i32>;
151 def VOP1_F32_I32 : VOPProfileI2F <f32, i32>;
152 def VOP1_F16_I16 : VOPProfileI2F <f16, i16>;
154 class VOP_SPECIAL_OMOD_PROF<ValueType dstVt, ValueType srcVt> :
155 VOPProfile<[dstVt, srcVt, untyped, untyped]> {
159 def VOP_I32_F32_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f32>;
160 def VOP_I32_F64_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f64>;
161 def VOP_I16_F16_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i16, f16>;
163 //===----------------------------------------------------------------------===//
165 //===----------------------------------------------------------------------===//
167 let VOPAsmPrefer32Bit = 1 in {
168 defm V_NOP : VOP1Inst <"v_nop", VOP_NONE>;
171 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
172 defm V_MOV_B32 : VOP1Inst <"v_mov_b32", VOP_I32_I32>;
173 } // End isMoveImm = 1
175 // FIXME: Specify SchedRW for READFIRSTLANE_B32
176 // TODO: Make profile for this, there is VOP3 encoding also
177 def V_READFIRSTLANE_B32 :
178 InstSI <(outs SReg_32:$vdst),
179 (ins VRegOrLds_32:$src0),
180 "v_readfirstlane_b32 $vdst, $src0",
181 [(set i32:$vdst, (int_amdgcn_readfirstlane (i32 VRegOrLds_32:$src0)))]>,
184 let isCodeGenOnly = 0;
185 let UseNamedOperandTable = 1;
190 let hasSideEffects = 0;
195 let isConvergent = 1;
200 let Inst{8-0} = src0;
201 let Inst{16-9} = 0x2;
202 let Inst{24-17} = vdst;
203 let Inst{31-25} = 0x3f; //encoding
206 let isReMaterializable = 1 in {
207 let SchedRW = [WriteDoubleCvt] in {
208 // OMod clears exceptions when set in this instruction
209 defm V_CVT_I32_F64 : VOP1Inst <"v_cvt_i32_f64", VOP_I32_F64_SPECIAL_OMOD, fp_to_sint>;
211 let mayRaiseFPException = 0 in {
212 defm V_CVT_F64_I32 : VOP1Inst <"v_cvt_f64_i32", VOP1_F64_I32, sint_to_fp>;
215 defm V_CVT_F32_F64 : VOP1Inst <"v_cvt_f32_f64", VOP_F32_F64, fpround>;
216 defm V_CVT_F64_F32 : VOP1Inst <"v_cvt_f64_f32", VOP_F64_F32, fpextend>;
217 // OMod clears exceptions when set in this instruction
218 defm V_CVT_U32_F64 : VOP1Inst <"v_cvt_u32_f64", VOP_I32_F64_SPECIAL_OMOD, fp_to_uint>;
220 let mayRaiseFPException = 0 in {
221 defm V_CVT_F64_U32 : VOP1Inst <"v_cvt_f64_u32", VOP1_F64_I32, uint_to_fp>;
224 } // End SchedRW = [WriteDoubleCvt]
226 let SchedRW = [WriteFloatCvt] in {
228 // XXX: Does this really not raise exceptions? The manual claims the
230 let mayRaiseFPException = 0 in {
231 defm V_CVT_F32_I32 : VOP1Inst <"v_cvt_f32_i32", VOP1_F32_I32, sint_to_fp>;
232 defm V_CVT_F32_U32 : VOP1Inst <"v_cvt_f32_u32", VOP1_F32_I32, uint_to_fp>;
235 // OMod clears exceptions when set in these 2 instructions
236 defm V_CVT_U32_F32 : VOP1Inst <"v_cvt_u32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_uint>;
237 defm V_CVT_I32_F32 : VOP1Inst <"v_cvt_i32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_sint>;
238 let FPDPRounding = 1, isReMaterializable = 0 in {
239 defm V_CVT_F16_F32 : VOP1Inst <"v_cvt_f16_f32", VOP_F16_F32, fpround>;
240 } // End FPDPRounding = 1, isReMaterializable = 0
242 defm V_CVT_F32_F16 : VOP1Inst <"v_cvt_f32_f16", VOP_F32_F16, fpextend>;
244 let ReadsModeReg = 0, mayRaiseFPException = 0 in {
245 defm V_CVT_RPI_I32_F32 : VOP1Inst <"v_cvt_rpi_i32_f32", VOP_I32_F32, cvt_rpi_i32_f32>;
246 defm V_CVT_FLR_I32_F32 : VOP1Inst <"v_cvt_flr_i32_f32", VOP_I32_F32, cvt_flr_i32_f32>;
247 defm V_CVT_OFF_F32_I4 : VOP1Inst <"v_cvt_off_f32_i4", VOP1_F32_I32>;
248 } // End ReadsModeReg = 0, mayRaiseFPException = 0
249 } // End SchedRW = [WriteFloatCvt]
251 let ReadsModeReg = 0, mayRaiseFPException = 0 in {
252 defm V_CVT_F32_UBYTE0 : VOP1Inst <"v_cvt_f32_ubyte0", VOP1_F32_I32, AMDGPUcvt_f32_ubyte0>;
253 defm V_CVT_F32_UBYTE1 : VOP1Inst <"v_cvt_f32_ubyte1", VOP1_F32_I32, AMDGPUcvt_f32_ubyte1>;
254 defm V_CVT_F32_UBYTE2 : VOP1Inst <"v_cvt_f32_ubyte2", VOP1_F32_I32, AMDGPUcvt_f32_ubyte2>;
255 defm V_CVT_F32_UBYTE3 : VOP1Inst <"v_cvt_f32_ubyte3", VOP1_F32_I32, AMDGPUcvt_f32_ubyte3>;
256 } // ReadsModeReg = 0, mayRaiseFPException = 0
258 defm V_FRACT_F32 : VOP1Inst <"v_fract_f32", VOP_F32_F32, AMDGPUfract>;
259 defm V_TRUNC_F32 : VOP1Inst <"v_trunc_f32", VOP_F32_F32, ftrunc>;
260 defm V_CEIL_F32 : VOP1Inst <"v_ceil_f32", VOP_F32_F32, fceil>;
261 defm V_RNDNE_F32 : VOP1Inst <"v_rndne_f32", VOP_F32_F32, frint>;
262 defm V_FLOOR_F32 : VOP1Inst <"v_floor_f32", VOP_F32_F32, ffloor>;
264 let TRANS = 1, SchedRW = [WriteTrans32] in {
265 defm V_EXP_F32 : VOP1Inst <"v_exp_f32", VOP_F32_F32, fexp2>;
266 defm V_LOG_F32 : VOP1Inst <"v_log_f32", VOP_F32_F32, flog2>;
267 defm V_RCP_F32 : VOP1Inst <"v_rcp_f32", VOP_F32_F32, AMDGPUrcp>;
268 defm V_RCP_IFLAG_F32 : VOP1Inst <"v_rcp_iflag_f32", VOP_F32_F32, AMDGPUrcp_iflag>;
269 defm V_RSQ_F32 : VOP1Inst <"v_rsq_f32", VOP_F32_F32, AMDGPUrsq>;
270 defm V_SQRT_F32 : VOP1Inst <"v_sqrt_f32", VOP_F32_F32, any_amdgcn_sqrt>;
271 } // End TRANS = 1, SchedRW = [WriteTrans32]
273 let TRANS = 1, SchedRW = [WriteTrans64] in {
274 defm V_RCP_F64 : VOP1Inst <"v_rcp_f64", VOP_F64_F64, AMDGPUrcp>;
275 defm V_RSQ_F64 : VOP1Inst <"v_rsq_f64", VOP_F64_F64, AMDGPUrsq>;
276 defm V_SQRT_F64 : VOP1Inst <"v_sqrt_f64", VOP_F64_F64, any_amdgcn_sqrt>;
277 } // End TRANS = 1, SchedRW = [WriteTrans64]
279 let TRANS = 1, SchedRW = [WriteTrans32] in {
280 defm V_SIN_F32 : VOP1Inst <"v_sin_f32", VOP_F32_F32, AMDGPUsin>;
281 defm V_COS_F32 : VOP1Inst <"v_cos_f32", VOP_F32_F32, AMDGPUcos>;
282 } // End TRANS = 1, SchedRW = [WriteTrans32]
284 defm V_NOT_B32 : VOP1Inst <"v_not_b32", VOP_I32_I32>;
285 defm V_BFREV_B32 : VOP1Inst <"v_bfrev_b32", VOP_I32_I32, bitreverse>;
286 defm V_FFBH_U32 : VOP1Inst <"v_ffbh_u32", VOP_I32_I32, AMDGPUffbh_u32>;
287 defm V_FFBL_B32 : VOP1Inst <"v_ffbl_b32", VOP_I32_I32, AMDGPUffbl_b32>;
288 defm V_FFBH_I32 : VOP1Inst <"v_ffbh_i32", VOP_I32_I32, AMDGPUffbh_i32>;
290 let SchedRW = [WriteDoubleAdd] in {
291 defm V_FREXP_EXP_I32_F64 : VOP1Inst <"v_frexp_exp_i32_f64", VOP_I32_F64_SPECIAL_OMOD, int_amdgcn_frexp_exp>;
292 defm V_FREXP_MANT_F64 : VOP1Inst <"v_frexp_mant_f64", VOP_F64_F64, int_amdgcn_frexp_mant>;
293 let FPDPRounding = 1 in {
294 defm V_FRACT_F64 : VOP1Inst <"v_fract_f64", VOP_F64_F64, AMDGPUfract>;
295 } // End FPDPRounding = 1
296 } // End SchedRW = [WriteDoubleAdd]
298 defm V_FREXP_EXP_I32_F32 : VOP1Inst <"v_frexp_exp_i32_f32", VOP_I32_F32, int_amdgcn_frexp_exp>;
299 defm V_FREXP_MANT_F32 : VOP1Inst <"v_frexp_mant_f32", VOP_F32_F32, int_amdgcn_frexp_mant>;
300 } // End isReMaterializable = 1
302 let VOPAsmPrefer32Bit = 1 in {
303 defm V_CLREXCP : VOP1Inst <"v_clrexcp", VOP_NO_EXT<VOP_NONE>>;
306 // Restrict src0 to be VGPR
307 def VOP_MOVRELS : VOPProfile<[i32, i32, untyped, untyped]> {
308 let Src0RC32 = VRegSrc_32;
309 let Src0RC64 = VRegSrc_32;
312 // Special case because there are no true output operands. Hack vdst
313 // to be a src operand. The custom inserter must add a tied implicit
314 // def and use of the super register since there seems to be no way to
315 // add an implicit def of a virtual register in tablegen.
316 class VOP_MOVREL<RegisterOperand Src1RC> : VOPProfile<[untyped, i32, untyped, untyped]> {
317 let Src0RC32 = VOPDstOperand<VGPR_32>;
318 let Src0RC64 = VOPDstOperand<VGPR_32>;
321 let Ins32 = (ins Src0RC32:$vdst, Src1RC:$src0);
322 let Ins64 = (ins Src0RC64:$vdst, Src1RC:$src0);
323 let Asm32 = getAsm32<1, 1>.ret;
324 let Asm64 = getAsm64<1, 1, 0, 0, 1>.ret;
326 let OutsSDWA = (outs Src0RC32:$vdst);
327 let InsSDWA = (ins Src0ModSDWA:$src0_modifiers, Src0SDWA:$src0,
328 clampmod:$clamp, dst_sel:$dst_sel, dst_unused:$dst_unused,
330 let AsmSDWA9 = getAsmSDWA9<1, 0, 1>.ret;
332 let OutsDPP = (outs Src0RC32:$vdst);
333 let InsDPP16 = (ins Src0RC32:$old, Src0RC32:$src0,
334 dpp_ctrl:$dpp_ctrl, row_mask:$row_mask,
335 bank_mask:$bank_mask, bound_ctrl:$bound_ctrl, FI:$fi);
336 let AsmDPP16 = getAsmDPP16<1, 1, 0>.ret;
338 let OutsDPP8 = (outs Src0RC32:$vdst);
339 let InsDPP8 = (ins Src0RC32:$old, Src0RC32:$src0, dpp8:$dpp8, FI:$fi);
340 let AsmDPP8 = getAsmDPP8<1, 1, 0>.ret;
343 let EmitDst = 1; // force vdst emission
346 def VOP_MOVRELD : VOP_MOVREL<VSrc_b32>;
347 def VOP_MOVRELSD : VOP_MOVREL<VRegSrc_32>;
349 let SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in {
350 // v_movreld_b32 is a special case because the destination output
351 // register is really a source. It isn't actually read (but may be
352 // written), and is only to provide the base register to start
353 // indexing from. Tablegen seems to not let you define an implicit
354 // virtual register output for the super register being written into,
355 // so this must have an implicit def of the register added to it.
356 defm V_MOVRELD_B32 : VOP1Inst <"v_movreld_b32", VOP_MOVRELD>;
357 defm V_MOVRELS_B32 : VOP1Inst <"v_movrels_b32", VOP_MOVRELS>;
358 defm V_MOVRELSD_B32 : VOP1Inst <"v_movrelsd_b32", VOP_MOVRELSD>;
359 } // End Uses = [M0, EXEC]
361 let isReMaterializable = 1 in {
362 let SubtargetPredicate = isGFX6GFX7 in {
363 let TRANS = 1, SchedRW = [WriteTrans32] in {
364 defm V_LOG_CLAMP_F32 :
365 VOP1Inst<"v_log_clamp_f32", VOP_F32_F32, int_amdgcn_log_clamp>;
366 defm V_RCP_CLAMP_F32 :
367 VOP1Inst<"v_rcp_clamp_f32", VOP_F32_F32>;
368 defm V_RCP_LEGACY_F32 :
369 VOP1Inst<"v_rcp_legacy_f32", VOP_F32_F32, AMDGPUrcp_legacy>;
370 defm V_RSQ_CLAMP_F32 :
371 VOP1Inst<"v_rsq_clamp_f32", VOP_F32_F32, AMDGPUrsq_clamp>;
372 defm V_RSQ_LEGACY_F32 :
373 VOP1Inst<"v_rsq_legacy_f32", VOP_F32_F32, int_amdgcn_rsq_legacy>;
374 } // End TRANS = 1, SchedRW = [WriteTrans32]
376 let SchedRW = [WriteTrans64] in {
377 defm V_RCP_CLAMP_F64 :
378 VOP1Inst<"v_rcp_clamp_f64", VOP_F64_F64>;
379 defm V_RSQ_CLAMP_F64 :
380 VOP1Inst<"v_rsq_clamp_f64", VOP_F64_F64, AMDGPUrsq_clamp>;
381 } // End SchedRW = [WriteTrans64]
382 } // End SubtargetPredicate = isGFX6GFX7
384 let SubtargetPredicate = isGFX7GFX8GFX9 in {
385 let TRANS = 1, SchedRW = [WriteTrans32] in {
386 defm V_LOG_LEGACY_F32 : VOP1Inst<"v_log_legacy_f32", VOP_F32_F32>;
387 defm V_EXP_LEGACY_F32 : VOP1Inst<"v_exp_legacy_f32", VOP_F32_F32>;
388 } // End TRANS = 1, SchedRW = [WriteTrans32]
389 } // End SubtargetPredicate = isGFX7GFX8GFX9
391 let SubtargetPredicate = isGFX7Plus in {
392 let SchedRW = [WriteDoubleAdd] in {
393 defm V_TRUNC_F64 : VOP1Inst<"v_trunc_f64", VOP_F64_F64, ftrunc>;
394 defm V_CEIL_F64 : VOP1Inst<"v_ceil_f64", VOP_F64_F64, fceil>;
395 defm V_RNDNE_F64 : VOP1Inst<"v_rndne_f64", VOP_F64_F64, frint>;
396 defm V_FLOOR_F64 : VOP1Inst<"v_floor_f64", VOP_F64_F64, ffloor>;
397 } // End SchedRW = [WriteDoubleAdd]
398 } // End SubtargetPredicate = isGFX7Plus
399 } // End isReMaterializable = 1
401 let SubtargetPredicate = Has16BitInsts in {
403 let FPDPRounding = 1 in {
404 defm V_CVT_F16_U16 : VOP1Inst <"v_cvt_f16_u16", VOP1_F16_I16, uint_to_fp>;
405 defm V_CVT_F16_I16 : VOP1Inst <"v_cvt_f16_i16", VOP1_F16_I16, sint_to_fp>;
406 } // End FPDPRounding = 1
407 // OMod clears exceptions when set in these two instructions
408 defm V_CVT_U16_F16 : VOP1Inst <"v_cvt_u16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_uint>;
409 defm V_CVT_I16_F16 : VOP1Inst <"v_cvt_i16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_sint>;
410 let TRANS = 1, SchedRW = [WriteTrans32] in {
411 defm V_RCP_F16 : VOP1Inst <"v_rcp_f16", VOP_F16_F16, AMDGPUrcp>;
412 defm V_SQRT_F16 : VOP1Inst <"v_sqrt_f16", VOP_F16_F16, any_amdgcn_sqrt>;
413 defm V_RSQ_F16 : VOP1Inst <"v_rsq_f16", VOP_F16_F16, AMDGPUrsq>;
414 defm V_LOG_F16 : VOP1Inst <"v_log_f16", VOP_F16_F16, flog2>;
415 defm V_EXP_F16 : VOP1Inst <"v_exp_f16", VOP_F16_F16, fexp2>;
416 defm V_SIN_F16 : VOP1Inst <"v_sin_f16", VOP_F16_F16, AMDGPUsin>;
417 defm V_COS_F16 : VOP1Inst <"v_cos_f16", VOP_F16_F16, AMDGPUcos>;
418 } // End TRANS = 1, SchedRW = [WriteTrans32]
419 defm V_FREXP_MANT_F16 : VOP1Inst <"v_frexp_mant_f16", VOP_F16_F16, int_amdgcn_frexp_mant>;
420 defm V_FREXP_EXP_I16_F16 : VOP1Inst <"v_frexp_exp_i16_f16", VOP_I16_F16_SPECIAL_OMOD, int_amdgcn_frexp_exp>;
421 defm V_FLOOR_F16 : VOP1Inst <"v_floor_f16", VOP_F16_F16, ffloor>;
422 defm V_CEIL_F16 : VOP1Inst <"v_ceil_f16", VOP_F16_F16, fceil>;
423 defm V_TRUNC_F16 : VOP1Inst <"v_trunc_f16", VOP_F16_F16, ftrunc>;
424 defm V_RNDNE_F16 : VOP1Inst <"v_rndne_f16", VOP_F16_F16, frint>;
425 let FPDPRounding = 1 in {
426 defm V_FRACT_F16 : VOP1Inst <"v_fract_f16", VOP_F16_F16, AMDGPUfract>;
427 } // End FPDPRounding = 1
431 let OtherPredicates = [Has16BitInsts] in {
434 (f32 (f16_to_fp i16:$src)),
435 (V_CVT_F32_F16_e32 $src)
439 (i16 (AMDGPUfp_to_f16 f32:$src)),
440 (V_CVT_F16_F32_e32 $src)
445 def VOP_SWAP_I32 : VOPProfile<[i32, i32, i32, untyped]> {
446 let Outs32 = (outs VGPR_32:$vdst, VGPR_32:$vdst1);
447 let Ins32 = (ins VGPR_32:$src0, VGPR_32:$src1);
449 let Asm32 = " $vdst, $src0";
454 let SubtargetPredicate = isGFX9Plus in {
455 def V_SWAP_B32 : VOP1_Pseudo<"v_swap_b32", VOP_SWAP_I32, [], 1> {
456 let Constraints = "$vdst = $src1, $vdst1 = $src0";
457 let DisableEncoding = "$vdst1,$src1";
458 let SchedRW = [Write64Bit, Write64Bit];
461 let isReMaterializable = 1 in
462 defm V_SAT_PK_U8_I16 : VOP1Inst<"v_sat_pk_u8_i16", VOP_I32_I32>;
464 let mayRaiseFPException = 0 in {
465 defm V_CVT_NORM_I16_F16 : VOP1Inst<"v_cvt_norm_i16_f16", VOP_I16_F16_SPECIAL_OMOD>;
466 defm V_CVT_NORM_U16_F16 : VOP1Inst<"v_cvt_norm_u16_f16", VOP_I16_F16_SPECIAL_OMOD>;
467 } // End mayRaiseFPException = 0
468 } // End SubtargetPredicate = isGFX9Plus
470 let SubtargetPredicate = isGFX9Only in {
471 defm V_SCREEN_PARTITION_4SE_B32 : VOP1Inst <"v_screen_partition_4se_b32", VOP_I32_I32>;
472 } // End SubtargetPredicate = isGFX9Only
474 let SubtargetPredicate = isGFX10Plus in {
475 defm V_PIPEFLUSH : VOP1Inst<"v_pipeflush", VOP_NONE>;
478 defm V_MOVRELSD_2_B32 :
479 VOP1Inst<"v_movrelsd_2_b32", VOP_MOVRELSD>;
481 def V_SWAPREL_B32 : VOP1_Pseudo<"v_swaprel_b32", VOP_SWAP_I32, [], 1> {
482 let Constraints = "$vdst = $src1, $vdst1 = $src0";
483 let DisableEncoding = "$vdst1,$src1";
484 let SchedRW = [Write64Bit, Write64Bit];
487 } // End SubtargetPredicate = isGFX10Plus
489 def VOPProfileAccMov : VOP_NO_EXT<VOP_I32_I32> {
490 let DstRC = RegisterOperand<AGPR_32>;
491 let Src0RC32 = RegisterOperand<AGPR_32>;
492 let Asm32 = " $vdst, $src0";
495 def V_ACCVGPR_MOV_B32 : VOP1_Pseudo<"v_accvgpr_mov_b32", VOPProfileAccMov, [], 1> {
496 let SubtargetPredicate = isGFX90APlus;
497 let isReMaterializable = 1;
498 let isAsCheapAsAMove = 1;
501 //===----------------------------------------------------------------------===//
502 // Target-specific instruction encodings.
503 //===----------------------------------------------------------------------===//
505 class VOP1_DPP<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl, bit isDPP16 = 0> :
506 VOP_DPP<ps.OpName, p, isDPP16> {
507 let hasSideEffects = ps.hasSideEffects;
509 let SchedRW = ps.SchedRW;
511 let TRANS = ps.TRANS;
514 let Inst{8-0} = 0xfa;
516 let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
517 let Inst{31-25} = 0x3f;
520 class VOP1_DPP16<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl> :
521 VOP1_DPP<op, ps, p, 1>,
522 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.GFX10> {
523 let AssemblerPredicate = HasDPP16;
524 let SubtargetPredicate = HasDPP16;
527 class VOP1_DPP8<bits<8> op, VOP1_Pseudo ps, VOPProfile p = ps.Pfl> :
528 VOP_DPP8<ps.OpName, p> {
529 let hasSideEffects = ps.hasSideEffects;
531 let SchedRW = ps.SchedRW;
537 let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
538 let Inst{31-25} = 0x3f;
541 //===----------------------------------------------------------------------===//
543 //===----------------------------------------------------------------------===//
545 let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
546 multiclass VOP1Only_Real_gfx10<bits<9> op> {
548 VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.GFX10>,
549 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
551 multiclass VOP1_Real_e32_gfx10<bits<9> op> {
553 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.GFX10>,
554 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
556 multiclass VOP1_Real_e64_gfx10<bits<9> op> {
558 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>,
559 VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
561 multiclass VOP1_Real_sdwa_gfx10<bits<9> op> {
562 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
564 VOP_SDWA10_Real<!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
565 VOP1_SDWA9Ae<op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
566 let DecoderNamespace = "SDWA10";
569 multiclass VOP1_Real_dpp_gfx10<bits<9> op> {
570 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
571 def _dpp_gfx10 : VOP1_DPP16<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")> {
572 let DecoderNamespace = "SDWA10";
575 multiclass VOP1_Real_dpp8_gfx10<bits<9> op> {
576 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
577 def _dpp8_gfx10 : VOP1_DPP8<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32")> {
578 let DecoderNamespace = "DPP8";
581 } // End AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10"
583 multiclass VOP1_Real_gfx10<bits<9> op> :
584 VOP1_Real_e32_gfx10<op>, VOP1_Real_e64_gfx10<op>,
585 VOP1_Real_sdwa_gfx10<op>, VOP1_Real_dpp_gfx10<op>,
586 VOP1_Real_dpp8_gfx10<op>;
588 defm V_PIPEFLUSH : VOP1_Real_gfx10<0x01b>;
589 defm V_MOVRELSD_2_B32 : VOP1_Real_gfx10<0x048>;
590 defm V_CVT_F16_U16 : VOP1_Real_gfx10<0x050>;
591 defm V_CVT_F16_I16 : VOP1_Real_gfx10<0x051>;
592 defm V_CVT_U16_F16 : VOP1_Real_gfx10<0x052>;
593 defm V_CVT_I16_F16 : VOP1_Real_gfx10<0x053>;
594 defm V_RCP_F16 : VOP1_Real_gfx10<0x054>;
595 defm V_SQRT_F16 : VOP1_Real_gfx10<0x055>;
596 defm V_RSQ_F16 : VOP1_Real_gfx10<0x056>;
597 defm V_LOG_F16 : VOP1_Real_gfx10<0x057>;
598 defm V_EXP_F16 : VOP1_Real_gfx10<0x058>;
599 defm V_FREXP_MANT_F16 : VOP1_Real_gfx10<0x059>;
600 defm V_FREXP_EXP_I16_F16 : VOP1_Real_gfx10<0x05a>;
601 defm V_FLOOR_F16 : VOP1_Real_gfx10<0x05b>;
602 defm V_CEIL_F16 : VOP1_Real_gfx10<0x05c>;
603 defm V_TRUNC_F16 : VOP1_Real_gfx10<0x05d>;
604 defm V_RNDNE_F16 : VOP1_Real_gfx10<0x05e>;
605 defm V_FRACT_F16 : VOP1_Real_gfx10<0x05f>;
606 defm V_SIN_F16 : VOP1_Real_gfx10<0x060>;
607 defm V_COS_F16 : VOP1_Real_gfx10<0x061>;
608 defm V_SAT_PK_U8_I16 : VOP1_Real_gfx10<0x062>;
609 defm V_CVT_NORM_I16_F16 : VOP1_Real_gfx10<0x063>;
610 defm V_CVT_NORM_U16_F16 : VOP1_Real_gfx10<0x064>;
612 defm V_SWAP_B32 : VOP1Only_Real_gfx10<0x065>;
613 defm V_SWAPREL_B32 : VOP1Only_Real_gfx10<0x068>;
615 //===----------------------------------------------------------------------===//
617 //===----------------------------------------------------------------------===//
619 let AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in {
620 multiclass VOP1_Real_e32_gfx7<bits<9> op> {
622 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
623 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
625 multiclass VOP1_Real_e64_gfx7<bits<9> op> {
627 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
628 VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
630 } // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7"
632 multiclass VOP1_Real_gfx7<bits<9> op> :
633 VOP1_Real_e32_gfx7<op>, VOP1_Real_e64_gfx7<op>;
635 multiclass VOP1_Real_gfx7_gfx10<bits<9> op> :
636 VOP1_Real_gfx7<op>, VOP1_Real_gfx10<op>;
638 defm V_LOG_LEGACY_F32 : VOP1_Real_gfx7<0x045>;
639 defm V_EXP_LEGACY_F32 : VOP1_Real_gfx7<0x046>;
641 defm V_TRUNC_F64 : VOP1_Real_gfx7_gfx10<0x017>;
642 defm V_CEIL_F64 : VOP1_Real_gfx7_gfx10<0x018>;
643 defm V_RNDNE_F64 : VOP1_Real_gfx7_gfx10<0x019>;
644 defm V_FLOOR_F64 : VOP1_Real_gfx7_gfx10<0x01a>;
646 //===----------------------------------------------------------------------===//
647 // GFX6, GFX7, GFX10.
648 //===----------------------------------------------------------------------===//
650 let AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in {
651 multiclass VOP1_Real_e32_gfx6_gfx7<bits<9> op> {
653 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
654 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
656 multiclass VOP1_Real_e64_gfx6_gfx7<bits<9> op> {
658 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
659 VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
661 } // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7"
663 multiclass VOP1_Real_gfx6_gfx7<bits<9> op> :
664 VOP1_Real_e32_gfx6_gfx7<op>, VOP1_Real_e64_gfx6_gfx7<op>;
666 multiclass VOP1_Real_gfx6_gfx7_gfx10<bits<9> op> :
667 VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10<op>;
669 defm V_LOG_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x026>;
670 defm V_RCP_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x028>;
671 defm V_RCP_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x029>;
672 defm V_RSQ_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x02c>;
673 defm V_RSQ_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x02d>;
674 defm V_RCP_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x030>;
675 defm V_RSQ_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x032>;
677 defm V_NOP : VOP1_Real_gfx6_gfx7_gfx10<0x000>;
678 defm V_MOV_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x001>;
679 defm V_CVT_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x003>;
680 defm V_CVT_F64_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x004>;
681 defm V_CVT_F32_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x005>;
682 defm V_CVT_F32_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x006>;
683 defm V_CVT_U32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x007>;
684 defm V_CVT_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x008>;
685 defm V_CVT_F16_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00a>;
686 defm V_CVT_F32_F16 : VOP1_Real_gfx6_gfx7_gfx10<0x00b>;
687 defm V_CVT_RPI_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00c>;
688 defm V_CVT_FLR_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00d>;
689 defm V_CVT_OFF_F32_I4 : VOP1_Real_gfx6_gfx7_gfx10<0x00e>;
690 defm V_CVT_F32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x00f>;
691 defm V_CVT_F64_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x010>;
692 defm V_CVT_F32_UBYTE0 : VOP1_Real_gfx6_gfx7_gfx10<0x011>;
693 defm V_CVT_F32_UBYTE1 : VOP1_Real_gfx6_gfx7_gfx10<0x012>;
694 defm V_CVT_F32_UBYTE2 : VOP1_Real_gfx6_gfx7_gfx10<0x013>;
695 defm V_CVT_F32_UBYTE3 : VOP1_Real_gfx6_gfx7_gfx10<0x014>;
696 defm V_CVT_U32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x015>;
697 defm V_CVT_F64_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x016>;
698 defm V_FRACT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x020>;
699 defm V_TRUNC_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x021>;
700 defm V_CEIL_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x022>;
701 defm V_RNDNE_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x023>;
702 defm V_FLOOR_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x024>;
703 defm V_EXP_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x025>;
704 defm V_LOG_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x027>;
705 defm V_RCP_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02a>;
706 defm V_RCP_IFLAG_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02b>;
707 defm V_RSQ_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x02e>;
708 defm V_RCP_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x02f>;
709 defm V_RSQ_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x031>;
710 defm V_SQRT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x033>;
711 defm V_SQRT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x034>;
712 defm V_SIN_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x035>;
713 defm V_COS_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x036>;
714 defm V_NOT_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x037>;
715 defm V_BFREV_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x038>;
716 defm V_FFBH_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x039>;
717 defm V_FFBL_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x03a>;
718 defm V_FFBH_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x03b>;
719 defm V_FREXP_EXP_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03c>;
720 defm V_FREXP_MANT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03d>;
721 defm V_FRACT_F64 : VOP1_Real_gfx6_gfx7_gfx10<0x03e>;
722 defm V_FREXP_EXP_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x03f>;
723 defm V_FREXP_MANT_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x040>;
724 defm V_CLREXCP : VOP1_Real_gfx6_gfx7_gfx10<0x041>;
725 defm V_MOVRELD_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x042>;
726 defm V_MOVRELS_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x043>;
727 defm V_MOVRELSD_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x044>;
729 //===----------------------------------------------------------------------===//
731 //===----------------------------------------------------------------------===//
733 class VOP1_DPPe <bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile P = ps.Pfl> :
736 let Inst{8-0} = 0xfa; // dpp
738 let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
739 let Inst{31-25} = 0x3f; //encoding
742 multiclass VOP1Only_Real_vi <bits<10> op> {
743 let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in {
745 VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.VI>,
746 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
750 multiclass VOP1_Real_e32e64_vi <bits<10> op> {
751 let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in {
753 VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.VI>,
754 VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
756 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>,
757 VOP3e_vi <!add(0x140, op), !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
761 multiclass VOP1_Real_vi <bits<10> op> {
762 defm NAME : VOP1_Real_e32e64_vi <op>;
764 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
766 VOP_SDWA_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
767 VOP1_SDWAe <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
769 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
771 VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
772 VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
774 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
776 VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.VI>,
777 VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
780 defm V_NOP : VOP1_Real_vi <0x0>;
781 defm V_MOV_B32 : VOP1_Real_vi <0x1>;
782 defm V_CVT_I32_F64 : VOP1_Real_vi <0x3>;
783 defm V_CVT_F64_I32 : VOP1_Real_vi <0x4>;
784 defm V_CVT_F32_I32 : VOP1_Real_vi <0x5>;
785 defm V_CVT_F32_U32 : VOP1_Real_vi <0x6>;
786 defm V_CVT_U32_F32 : VOP1_Real_vi <0x7>;
787 defm V_CVT_I32_F32 : VOP1_Real_vi <0x8>;
788 defm V_CVT_F16_F32 : VOP1_Real_vi <0xa>;
789 defm V_CVT_F32_F16 : VOP1_Real_vi <0xb>;
790 defm V_CVT_RPI_I32_F32 : VOP1_Real_vi <0xc>;
791 defm V_CVT_FLR_I32_F32 : VOP1_Real_vi <0xd>;
792 defm V_CVT_OFF_F32_I4 : VOP1_Real_vi <0xe>;
793 defm V_CVT_F32_F64 : VOP1_Real_vi <0xf>;
794 defm V_CVT_F64_F32 : VOP1_Real_vi <0x10>;
795 defm V_CVT_F32_UBYTE0 : VOP1_Real_vi <0x11>;
796 defm V_CVT_F32_UBYTE1 : VOP1_Real_vi <0x12>;
797 defm V_CVT_F32_UBYTE2 : VOP1_Real_vi <0x13>;
798 defm V_CVT_F32_UBYTE3 : VOP1_Real_vi <0x14>;
799 defm V_CVT_U32_F64 : VOP1_Real_vi <0x15>;
800 defm V_CVT_F64_U32 : VOP1_Real_vi <0x16>;
801 defm V_FRACT_F32 : VOP1_Real_vi <0x1b>;
802 defm V_TRUNC_F32 : VOP1_Real_vi <0x1c>;
803 defm V_CEIL_F32 : VOP1_Real_vi <0x1d>;
804 defm V_RNDNE_F32 : VOP1_Real_vi <0x1e>;
805 defm V_FLOOR_F32 : VOP1_Real_vi <0x1f>;
806 defm V_EXP_F32 : VOP1_Real_vi <0x20>;
807 defm V_LOG_F32 : VOP1_Real_vi <0x21>;
808 defm V_RCP_F32 : VOP1_Real_vi <0x22>;
809 defm V_RCP_IFLAG_F32 : VOP1_Real_vi <0x23>;
810 defm V_RSQ_F32 : VOP1_Real_vi <0x24>;
811 defm V_RCP_F64 : VOP1_Real_vi <0x25>;
812 defm V_RSQ_F64 : VOP1_Real_vi <0x26>;
813 defm V_SQRT_F32 : VOP1_Real_vi <0x27>;
814 defm V_SQRT_F64 : VOP1_Real_vi <0x28>;
815 defm V_SIN_F32 : VOP1_Real_vi <0x29>;
816 defm V_COS_F32 : VOP1_Real_vi <0x2a>;
817 defm V_NOT_B32 : VOP1_Real_vi <0x2b>;
818 defm V_BFREV_B32 : VOP1_Real_vi <0x2c>;
819 defm V_FFBH_U32 : VOP1_Real_vi <0x2d>;
820 defm V_FFBL_B32 : VOP1_Real_vi <0x2e>;
821 defm V_FFBH_I32 : VOP1_Real_vi <0x2f>;
822 defm V_FREXP_EXP_I32_F64 : VOP1_Real_vi <0x30>;
823 defm V_FREXP_MANT_F64 : VOP1_Real_vi <0x31>;
824 defm V_FRACT_F64 : VOP1_Real_vi <0x32>;
825 defm V_FREXP_EXP_I32_F32 : VOP1_Real_vi <0x33>;
826 defm V_FREXP_MANT_F32 : VOP1_Real_vi <0x34>;
827 defm V_CLREXCP : VOP1_Real_vi <0x35>;
828 defm V_MOVRELD_B32 : VOP1_Real_e32e64_vi <0x36>;
829 defm V_MOVRELS_B32 : VOP1_Real_e32e64_vi <0x37>;
830 defm V_MOVRELSD_B32 : VOP1_Real_e32e64_vi <0x38>;
831 defm V_TRUNC_F64 : VOP1_Real_vi <0x17>;
832 defm V_CEIL_F64 : VOP1_Real_vi <0x18>;
833 defm V_FLOOR_F64 : VOP1_Real_vi <0x1A>;
834 defm V_RNDNE_F64 : VOP1_Real_vi <0x19>;
835 defm V_LOG_LEGACY_F32 : VOP1_Real_vi <0x4c>;
836 defm V_EXP_LEGACY_F32 : VOP1_Real_vi <0x4b>;
837 defm V_CVT_F16_U16 : VOP1_Real_vi <0x39>;
838 defm V_CVT_F16_I16 : VOP1_Real_vi <0x3a>;
839 defm V_CVT_U16_F16 : VOP1_Real_vi <0x3b>;
840 defm V_CVT_I16_F16 : VOP1_Real_vi <0x3c>;
841 defm V_RCP_F16 : VOP1_Real_vi <0x3d>;
842 defm V_SQRT_F16 : VOP1_Real_vi <0x3e>;
843 defm V_RSQ_F16 : VOP1_Real_vi <0x3f>;
844 defm V_LOG_F16 : VOP1_Real_vi <0x40>;
845 defm V_EXP_F16 : VOP1_Real_vi <0x41>;
846 defm V_FREXP_MANT_F16 : VOP1_Real_vi <0x42>;
847 defm V_FREXP_EXP_I16_F16 : VOP1_Real_vi <0x43>;
848 defm V_FLOOR_F16 : VOP1_Real_vi <0x44>;
849 defm V_CEIL_F16 : VOP1_Real_vi <0x45>;
850 defm V_TRUNC_F16 : VOP1_Real_vi <0x46>;
851 defm V_RNDNE_F16 : VOP1_Real_vi <0x47>;
852 defm V_FRACT_F16 : VOP1_Real_vi <0x48>;
853 defm V_SIN_F16 : VOP1_Real_vi <0x49>;
854 defm V_COS_F16 : VOP1_Real_vi <0x4a>;
855 defm V_SWAP_B32 : VOP1Only_Real_vi <0x51>;
857 defm V_SAT_PK_U8_I16 : VOP1_Real_vi<0x4f>;
858 defm V_CVT_NORM_I16_F16 : VOP1_Real_vi<0x4d>;
859 defm V_CVT_NORM_U16_F16 : VOP1_Real_vi<0x4e>;
861 defm V_ACCVGPR_MOV_B32 : VOP1Only_Real_vi<0x52>;
863 // Copy of v_mov_b32 with $vdst as a use operand for use with VGPR
864 // indexing mode. vdst can't be treated as a def for codegen purposes,
865 // and an implicit use and def of the super register should be added.
866 def V_MOV_B32_indirect : VPseudoInstSI<(outs),
867 (ins getVALUDstForVT<i32>.ret:$vdst, getVOPSrc0ForVT<i32>.ret:$src0)>,
868 PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst,
869 getVOPSrc0ForVT<i32>.ret:$src0)> {
871 let SubtargetPredicate = isGFX8GFX9;
874 let OtherPredicates = [isGFX8Plus] in {
877 (i32 (int_amdgcn_mov_dpp i32:$src, timm:$dpp_ctrl, timm:$row_mask,
878 timm:$bank_mask, timm:$bound_ctrl)),
879 (V_MOV_B32_dpp VGPR_32:$src, VGPR_32:$src, (as_i32timm $dpp_ctrl),
880 (as_i32timm $row_mask), (as_i32timm $bank_mask),
881 (as_i1timm $bound_ctrl))
885 (i32 (int_amdgcn_update_dpp i32:$old, i32:$src, timm:$dpp_ctrl,
886 timm:$row_mask, timm:$bank_mask,
888 (V_MOV_B32_dpp VGPR_32:$old, VGPR_32:$src, (as_i32timm $dpp_ctrl),
889 (as_i32timm $row_mask), (as_i32timm $bank_mask),
890 (as_i1timm $bound_ctrl))
893 } // End OtherPredicates = [isGFX8Plus]
895 let OtherPredicates = [isGFX8Plus] in {
897 (i32 (anyext i16:$src)),
902 (i64 (anyext i16:$src)),
903 (REG_SEQUENCE VReg_64,
904 (i32 (COPY $src)), sub0,
905 (V_MOV_B32_e32 (i32 0)), sub1)
909 (i16 (trunc i32:$src)),
914 (i16 (trunc i64:$src)),
915 (EXTRACT_SUBREG $src, sub0)
918 } // End OtherPredicates = [isGFX8Plus]
920 //===----------------------------------------------------------------------===//
922 //===----------------------------------------------------------------------===//
924 multiclass VOP1_Real_gfx9 <bits<10> op> {
925 let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in {
926 defm NAME : VOP1_Real_e32e64_vi <op>;
929 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
931 VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
932 VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
934 foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
936 VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>,
937 VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
941 defm V_SCREEN_PARTITION_4SE_B32 : VOP1_Real_gfx9 <0x37>;
943 //===----------------------------------------------------------------------===//
945 //===----------------------------------------------------------------------===//
947 let OtherPredicates = [isGFX10Plus] in {
949 (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
950 (V_MOV_B32_dpp8_gfx10 VGPR_32:$src, VGPR_32:$src,
951 (as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
953 } // End OtherPredicates = [isGFX10Plus]