@@ -1886,6 +1886,7 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
18861886  bool  validateTHAndScopeBits (const  MCInst &Inst, const  OperandVector &Operands,
18871887                              const  unsigned  CPol);
18881888  bool  validateTFE (const  MCInst &Inst, const  OperandVector &Operands);
1889+   bool  validateSetVgprMSB (const  MCInst &Inst, const  OperandVector &Operands);
18891890  std::optional<StringRef> validateLdsDirect (const  MCInst &Inst);
18901891  bool  validateWMMA (const  MCInst &Inst, const  OperandVector &Operands);
18911892  unsigned  getConstantBusLimit (unsigned  Opcode) const ;
@@ -5542,6 +5543,22 @@ bool AMDGPUAsmParser::validateTFE(const MCInst &Inst,
55425543  return  true ;
55435544}
55445545
5546+ bool  AMDGPUAsmParser::validateSetVgprMSB (const  MCInst &Inst,
5547+                                          const  OperandVector &Operands) {
5548+   if  (Inst.getOpcode () != AMDGPU::S_SET_VGPR_MSB_gfx12)
5549+     return  true ;
5550+ 
5551+   int  Simm16Pos =
5552+       AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::simm16);
5553+   if  ((unsigned )Inst.getOperand (Simm16Pos).getImm () > 255 ) {
5554+     SMLoc Loc = Operands[1 ]->getStartLoc ();
5555+     Error (Loc, " s_set_vgpr_msb accepts values in range [0..255]" 
5556+     return  false ;
5557+   }
5558+ 
5559+   return  true ;
5560+ }
5561+ 
55455562bool  AMDGPUAsmParser::validateWMMA (const  MCInst &Inst,
55465563                                   const  OperandVector &Operands) {
55475564  unsigned  Opc = Inst.getOpcode ();
@@ -5706,6 +5723,9 @@ bool AMDGPUAsmParser::validateInstruction(const MCInst &Inst,
57065723  if  (!validateTFE (Inst, Operands)) {
57075724    return  false ;
57085725  }
5726+   if  (!validateSetVgprMSB (Inst, Operands)) {
5727+     return  false ;
5728+   }
57095729  if  (!validateWMMA (Inst, Operands)) {
57105730    return  false ;
57115731  }
0 commit comments