Skip to content

Commit 2b05c7c

Browse files
authored
[AMDGPU] Fix regclass check for PackedF32InputMods in AsmParser. (#138767)
Downstream patch by Pravin Jagtap.
1 parent 52f568d commit 2b05c7c

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ class AMDGPUOperand : public MCParsedAsmOperand {
337337
return isRegOrImmWithInputMods(AMDGPU::VS_32RegClassID, MVT::v2f16);
338338
}
339339

340-
bool isPackedFP32InputMods() const {
341-
return isRegOrImmWithInputMods(AMDGPU::VS_64RegClassID, MVT::v2f32);
340+
bool isPackedVGPRFP32InputMods() const {
341+
return isRegOrImmWithInputMods(AMDGPU::VReg_64RegClassID, MVT::v2f32);
342342
}
343343

344344
bool isVReg() const {

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,10 @@ class PackedFPInputModsMatchClass <int opSize> : AsmOperandClass {
15501550
let PredicateMethod = "isPackedFP"#opSize#"InputMods";
15511551
}
15521552

1553+
class PackedVGPRFPInputModsMatchClass <int opSize> : PackedFPInputModsMatchClass<opSize> {
1554+
let PredicateMethod = "isPackedVGPRFP"#opSize#"InputMods";
1555+
}
1556+
15531557
class PackedIntInputModsMatchClass <int opSize> : AsmOperandClass {
15541558
let Name = "PackedInt"#opSize#"InputMods";
15551559
let ParserMethod = "parseRegOrImm";
@@ -1559,7 +1563,7 @@ class PackedIntInputModsMatchClass <int opSize> : AsmOperandClass {
15591563

15601564
def PackedF16InputModsMatchClass : PackedFPInputModsMatchClass<16>;
15611565
def PackedI16InputModsMatchClass : PackedIntInputModsMatchClass<16>;
1562-
def PackedF32InputModsMatchClass : PackedFPInputModsMatchClass<32>;
1566+
def PackedVGPRF32InputModsMatchClass : PackedVGPRFPInputModsMatchClass<32>;
15631567

15641568
class PackedFPInputMods <PackedFPInputModsMatchClass matchClass> : InputMods <matchClass> {
15651569
let PrintMethod = "printOperandAndFPInputMods";
@@ -1571,7 +1575,7 @@ class PackedIntInputMods <PackedIntInputModsMatchClass matchClass> : InputMods <
15711575

15721576
def PackedF16InputMods : PackedFPInputMods<PackedF16InputModsMatchClass>;
15731577
def PackedI16InputMods : PackedIntInputMods<PackedI16InputModsMatchClass>;
1574-
def PackedF32InputMods : PackedFPInputMods<PackedF32InputModsMatchClass>;
1578+
def PackedVGPRF32InputMods : PackedFPInputMods<PackedVGPRF32InputModsMatchClass>;
15751579

15761580
def MFMALdScaleModifierOp : TImmLeaf<i32, [{
15771581
return isUInt<2>(Imm);

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ class VOP3_CVT_SCALE_SR_PK_F4_F32_TiedInput_Profile<VOPProfile P>
10491049

10501050
let Src0RC64 = !if(!gt(P.Src0VT.Size, 32), getVOP3VRegSrcForVT<P.Src0VT>.ret,
10511051
getVOP3SrcForVT<P.Src0VT>.ret);
1052-
let InsVOP3OpSel = (ins PackedF32InputMods: $src0_modifiers, Src0RC64:$src0,
1052+
let InsVOP3OpSel = (ins PackedVGPRF32InputMods: $src0_modifiers, Src0RC64:$src0,
10531053
Int32InputMods: $src1_modifiers, Src1RC64:$src1,
10541054
FP32InputMods: $src2_modifiers, Src2RC64:$src2,
10551055
VGPR_32:$vdst_in, op_sel0:$op_sel);

llvm/test/MC/AMDGPU/gfx950_err.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,5 +495,5 @@ v_cvt_scalef32_2xpk16_bf6_f32 v[0:5], s[0:15], v[6:21], v16
495495
// GFX950: :[[@LINE+1]]:{{[0-9]+}}: error: invalid operand for instruction
496496
v_cvt_scalef32_2xpk16_bf6_f32 v[0:5], v[6:21], s[0:15], v16
497497

498-
// GFX950: v_cvt_scalef32_sr_pk_fp4_f32 v0, s[2:3]/*Invalid register, operand has 'VReg_64' register class*/, v4, v5
498+
// GFX950: :[[@LINE+1]]:{{[0-9]+}}: error: invalid operand for instruction
499499
v_cvt_scalef32_sr_pk_fp4_f32 v0, s[2:3], v4, v5

0 commit comments

Comments
 (0)