Skip to content

Commit e25bc5e

Browse files
committed
[AMDGPU][MC] Corrected src0 for v_movrelsd_b32 and v_movrelsd_2_b32
See https://bugs.llvm.org/show_bug.cgi?id=40903 Reviewers: arsenm, rampitec Differential Revision: https://reviews.llvm.org/D69888
1 parent 11ed1c0 commit e25bc5e

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

llvm/lib/Target/AMDGPU/VOP1Instructions.td

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ def VOP_I32_VI32_NO_EXT : VOPProfile<[i32, i32, untyped, untyped]> {
274274
// to be a src operand. The custom inserter must add a tied implicit
275275
// def and use of the super register since there seems to be no way to
276276
// add an implicit def of a virtual register in tablegen.
277-
def VOP_MOVRELD : VOPProfile<[untyped, i32, untyped, untyped]> {
277+
class VOP_MOVREL<RegisterOperand Src1RC> : VOPProfile<[untyped, i32, untyped, untyped]> {
278278
let Src0RC32 = VOPDstOperand<VGPR_32>;
279279
let Src0RC64 = VOPDstOperand<VGPR_32>;
280280

281281
let Outs = (outs);
282-
let Ins32 = (ins Src0RC32:$vdst, VSrc_b32:$src0);
283-
let Ins64 = (ins Src0RC64:$vdst, VSrc_b32:$src0);
282+
let Ins32 = (ins Src0RC32:$vdst, Src1RC:$src0);
283+
let Ins64 = (ins Src0RC64:$vdst, Src1RC:$src0);
284284
let InsDPP = (ins DstRC:$vdst, DstRC:$old, Src0RC32:$src0,
285285
dpp_ctrl:$dpp_ctrl, row_mask:$row_mask,
286286
bank_mask:$bank_mask, bound_ctrl:$bound_ctrl);
@@ -306,6 +306,9 @@ def VOP_MOVRELD : VOPProfile<[untyped, i32, untyped, untyped]> {
306306
let EmitDst = 1; // force vdst emission
307307
}
308308

309+
def VOP_MOVRELD : VOP_MOVREL<VSrc_b32>;
310+
def VOP_MOVRELSD : VOP_MOVREL<VRegSrc_32>;
311+
309312
let SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in {
310313
// v_movreld_b32 is a special case because the destination output
311314
// register is really a source. It isn't actually read (but may be
@@ -315,7 +318,7 @@ let SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in {
315318
// so this must have an implicit def of the register added to it.
316319
defm V_MOVRELD_B32 : VOP1Inst <"v_movreld_b32", VOP_MOVRELD>;
317320
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>>;
321+
defm V_MOVRELSD_B32 : VOP1Inst <"v_movrelsd_b32", VOP_MOVRELSD>;
319322
} // End Uses = [M0, EXEC]
320323

321324
defm V_MOV_FED_B32 : VOP1Inst <"v_mov_fed_b32", VOP_I32_I32>;
@@ -430,9 +433,8 @@ let SubtargetPredicate = isGFX10Plus in {
430433
defm V_PIPEFLUSH : VOP1Inst<"v_pipeflush", VOP_NONE>;
431434

432435
let Uses = [M0] in {
433-
// FIXME-GFX10: Should V_MOVRELSD_2_B32 be VOP_NO_EXT?
434436
defm V_MOVRELSD_2_B32 :
435-
VOP1Inst<"v_movrelsd_2_b32", VOP_NO_EXT<VOP_I32_I32>>;
437+
VOP1Inst<"v_movrelsd_2_b32", VOP_MOVRELSD>;
436438

437439
def V_SWAPREL_B32 : VOP1_Pseudo<"v_swaprel_b32", VOP_SWAP_I32, [], 1> {
438440
let Constraints = "$vdst = $src1, $vdst1 = $src0";

llvm/test/MC/AMDGPU/gfx10_asm_all.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32199,6 +32199,9 @@ v_movrelsd_b32_e64 v255, v1
3219932199
v_movrelsd_b32_e64 v5, v255
3220032200
// GFX10: encoding: [0x05,0x00,0xc4,0xd5,0xff,0x01,0x00,0x00]
3220132201

32202+
v_movrelsd_b32 v5, s1
32203+
// GFX10-ERR: error: invalid operand for instruction
32204+
3220232205
v_movrelsd_2_b32 v5, v1
3220332206
// GFX10: encoding: [0x01,0x91,0x0a,0x7e]
3220432207

@@ -32217,6 +32220,9 @@ v_movrelsd_2_b32_e64 v255, v1
3221732220
v_movrelsd_2_b32_e64 v5, v255
3221832221
// GFX10: encoding: [0x05,0x00,0xc8,0xd5,0xff,0x01,0x00,0x00]
3221932222

32223+
v_movrelsd_2_b32 v5, s1
32224+
// GFX10-ERR: error: invalid operand for instruction
32225+
3222032226
v_cvt_f16_u16_e32 v5, v1
3222132227
// GFX10: encoding: [0x01,0xa1,0x0a,0x7e]
3222232228

llvm/test/MC/AMDGPU/vop1.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ v_movrels_b32_e32 v1, v2
273273
// VI: v_movrelsd_b32_e32 v1, v2 ; encoding: [0x02,0x71,0x02,0x7e]
274274
v_movrelsd_b32_e32 v1, v2
275275

276+
// NOSICI: error: invalid operand for instruction
277+
// NOVI: error: invalid operand for instruction
278+
v_movrelsd_b32_e32 v1, s2
279+
276280
// NOSI: error: instruction not supported on this GPU
277281
// NOSI: v_log_legacy_f32 v1, v2
278282
// CI: v_log_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x8b,0x02,0x7e]

0 commit comments

Comments
 (0)