@@ -3507,7 +3507,7 @@ bool AMDGPUAsmParser::validateConstantBusLimitations(
3507
3507
return true ;
3508
3508
3509
3509
// Check special imm operands (used by madmk, etc)
3510
- if (AMDGPU::getNamedOperandIdx (Opcode, AMDGPU::OpName::imm) != - 1 ) {
3510
+ if (AMDGPU::hasNamedOperand (Opcode, AMDGPU::OpName::imm)) {
3511
3511
++NumLiterals;
3512
3512
LiteralSize = 4 ;
3513
3513
}
@@ -7897,7 +7897,7 @@ void AMDGPUAsmParser::cvtMIMG(MCInst &Inst, const OperandVector &Operands,
7897
7897
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyR128A16);
7898
7898
if (IsGFX10Plus)
7899
7899
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyA16);
7900
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::tfe) != - 1 )
7900
+ if (AMDGPU::hasNamedOperand (Inst.getOpcode (), AMDGPU::OpName::tfe))
7901
7901
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE);
7902
7902
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyLWE);
7903
7903
if (!IsGFX10Plus)
@@ -8205,9 +8205,9 @@ void cvtVOP3DstOpSelOnly(MCInst &Inst) {
8205
8205
const int Ops[] = { AMDGPU::OpName::src0,
8206
8206
AMDGPU::OpName::src1,
8207
8207
AMDGPU::OpName::src2 };
8208
- for (SrcNum = 0 ;
8209
- SrcNum < 3 && AMDGPU::getNamedOperandIdx (Opc, Ops[SrcNum]) != - 1 ;
8210
- ++SrcNum) ;
8208
+ for (SrcNum = 0 ; SrcNum < 3 && AMDGPU::hasNamedOperand (Opc, Ops[SrcNum]);
8209
+ ++ SrcNum)
8210
+ ;
8211
8211
assert (SrcNum > 0 );
8212
8212
8213
8213
unsigned OpSel = Inst.getOperand (OpSelIdx).getImm ();
@@ -8268,17 +8268,17 @@ void AMDGPUAsmParser::cvtVOP3Interp(MCInst &Inst, const OperandVector &Operands)
8268
8268
}
8269
8269
}
8270
8270
8271
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::high) != - 1 ) {
8272
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyHigh);
8273
- }
8271
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::high))
8272
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8273
+ AMDGPUOperand::ImmTyHigh);
8274
8274
8275
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::clamp) != - 1 ) {
8276
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyClampSI);
8277
- }
8275
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::clamp))
8276
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8277
+ AMDGPUOperand::ImmTyClampSI);
8278
8278
8279
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::omod) != - 1 ) {
8280
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyOModSI);
8281
- }
8279
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::omod))
8280
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8281
+ AMDGPUOperand::ImmTyOModSI);
8282
8282
}
8283
8283
8284
8284
void AMDGPUAsmParser::cvtVINTERP (MCInst &Inst, const OperandVector &Operands)
@@ -8351,7 +8351,7 @@ void AMDGPUAsmParser::cvtVOP3(MCInst &Inst, const OperandVector &Operands,
8351
8351
((AMDGPUOperand &)*Operands[I++]).addRegOperands (Inst, 1 );
8352
8352
}
8353
8353
8354
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::src0_modifiers) != - 1 ) {
8354
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::src0_modifiers)) {
8355
8355
// This instruction has src modifiers
8356
8356
for (unsigned E = Operands.size (); I != E; ++I) {
8357
8357
AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I]);
@@ -8377,13 +8377,13 @@ void AMDGPUAsmParser::cvtVOP3(MCInst &Inst, const OperandVector &Operands,
8377
8377
}
8378
8378
}
8379
8379
8380
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::clamp) != - 1 ) {
8381
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyClampSI);
8382
- }
8380
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::clamp))
8381
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8382
+ AMDGPUOperand::ImmTyClampSI);
8383
8383
8384
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::omod) != - 1 ) {
8385
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyOModSI);
8386
- }
8384
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::omod))
8385
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8386
+ AMDGPUOperand::ImmTyOModSI);
8387
8387
8388
8388
// Special case v_mac_{f16, f32} and v_fmac_{f16, f32} (gfx906/gfx10+):
8389
8389
// it has src2 register operand that is tied to dst operand
@@ -8427,7 +8427,7 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands,
8427
8427
Inst.addOperand (Inst.getOperand (0 ));
8428
8428
}
8429
8429
8430
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::vdst_in) != - 1 ) {
8430
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::vdst_in)) {
8431
8431
assert (!IsPacked);
8432
8432
Inst.addOperand (Inst.getOperand (0 ));
8433
8433
}
@@ -8885,7 +8885,7 @@ void AMDGPUAsmParser::cvtVOP3DPP(MCInst &Inst, const OperandVector &Operands,
8885
8885
unsigned Opc = Inst.getOpcode ();
8886
8886
const MCInstrDesc &Desc = MII.get (Inst.getOpcode ());
8887
8887
bool HasModifiers =
8888
- AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::src0_modifiers) != - 1 ;
8888
+ AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::src0_modifiers);
8889
8889
8890
8890
// MAC instructions are special because they have 'old'
8891
8891
// operand which is not tied to dst (but assumed to be).
@@ -8943,17 +8943,17 @@ void AMDGPUAsmParser::cvtVOP3DPP(MCInst &Inst, const OperandVector &Operands,
8943
8943
llvm_unreachable (" unhandled operand type" );
8944
8944
}
8945
8945
}
8946
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::clamp) != - 1 ) {
8946
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::clamp))
8947
8947
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyClampSI);
8948
- }
8949
- if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::omod) != - 1 ) {
8948
+
8949
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::omod))
8950
8950
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyOModSI);
8951
- }
8951
+
8952
8952
if (Desc.TSFlags & SIInstrFlags::VOP3P)
8953
8953
cvtVOP3P (Inst, Operands, OptionalIdx);
8954
8954
else if (Desc.TSFlags & SIInstrFlags::VOP3)
8955
8955
cvtVOP3OpSel (Inst, Operands, OptionalIdx);
8956
- else if (AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::op_sel) != - 1 ) {
8956
+ else if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::op_sel)) {
8957
8957
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyOpSel);
8958
8958
}
8959
8959
@@ -8966,9 +8966,10 @@ void AMDGPUAsmParser::cvtVOP3DPP(MCInst &Inst, const OperandVector &Operands,
8966
8966
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppRowMask, 0xf );
8967
8967
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppBankMask, 0xf );
8968
8968
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppBoundCtrl);
8969
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::fi) != -1 ) {
8970
- addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppFi);
8971
- }
8969
+
8970
+ if (AMDGPU::hasNamedOperand (Inst.getOpcode (), AMDGPU::OpName::fi))
8971
+ addOptionalImmOperand (Inst, Operands, OptionalIdx,
8972
+ AMDGPUOperand::ImmTyDppFi);
8972
8973
}
8973
8974
}
8974
8975
@@ -8977,7 +8978,7 @@ void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool I
8977
8978
8978
8979
unsigned Opc = Inst.getOpcode ();
8979
8980
bool HasModifiers =
8980
- AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::src0_modifiers) != - 1 ;
8981
+ AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::src0_modifiers);
8981
8982
unsigned I = 1 ;
8982
8983
const MCInstrDesc &Desc = MII.get (Inst.getOpcode ());
8983
8984
for (unsigned J = 0 ; J < Desc.getNumDefs (); ++J) {
@@ -9038,7 +9039,7 @@ void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands, bool I
9038
9039
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppRowMask, 0xf );
9039
9040
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppBankMask, 0xf );
9040
9041
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppBoundCtrl);
9041
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::fi) != - 1 ) {
9042
+ if (AMDGPU::hasNamedOperand (Inst.getOpcode (), AMDGPU::OpName::fi)) {
9042
9043
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDppFi);
9043
9044
}
9044
9045
}
@@ -9180,49 +9181,46 @@ void AMDGPUAsmParser::cvtSDWA(MCInst &Inst, const OperandVector &Operands,
9180
9181
SkippedVcc = false ;
9181
9182
}
9182
9183
9183
- if ( Inst.getOpcode () != AMDGPU::V_NOP_sdwa_gfx10 &&
9184
- Inst. getOpcode () != AMDGPU::V_NOP_sdwa_gfx9 &&
9185
- Inst. getOpcode () != AMDGPU::V_NOP_sdwa_vi) {
9184
+ const unsigned Opc = Inst.getOpcode ();
9185
+ if (Opc != AMDGPU::V_NOP_sdwa_gfx10 && Opc != AMDGPU::V_NOP_sdwa_gfx9 &&
9186
+ Opc != AMDGPU::V_NOP_sdwa_vi) {
9186
9187
// v_nop_sdwa_sdwa_vi/gfx9 has no optional sdwa arguments
9187
9188
switch (BasicInstType) {
9188
9189
case SIInstrFlags::VOP1:
9189
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (),
9190
- AMDGPU::OpName::clamp) != -1 ) {
9190
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::clamp))
9191
9191
addOptionalImmOperand (Inst, Operands, OptionalIdx,
9192
9192
AMDGPUOperand::ImmTyClampSI, 0 );
9193
- }
9194
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (),
9195
- AMDGPU::OpName::omod) != -1 ) {
9193
+
9194
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::omod))
9196
9195
addOptionalImmOperand (Inst, Operands, OptionalIdx,
9197
9196
AMDGPUOperand::ImmTyOModSI, 0 );
9198
- }
9199
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (),
9200
- AMDGPU::OpName::dst_sel) != -1 ) {
9197
+
9198
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::dst_sel))
9201
9199
addOptionalImmOperand (Inst, Operands, OptionalIdx,
9202
9200
AMDGPUOperand::ImmTySdwaDstSel, SdwaSel::DWORD);
9203
- }
9204
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (),
9205
- AMDGPU::OpName::dst_unused) != -1 ) {
9201
+
9202
+ if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::dst_unused))
9206
9203
addOptionalImmOperand (Inst, Operands, OptionalIdx,
9207
9204
AMDGPUOperand::ImmTySdwaDstUnused,
9208
9205
DstUnused::UNUSED_PRESERVE);
9209
- }
9206
+
9210
9207
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, SdwaSel::DWORD);
9211
9208
break ;
9212
9209
9213
9210
case SIInstrFlags::VOP2:
9214
9211
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyClampSI, 0 );
9215
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::omod) != -1 ) {
9212
+
9213
+ if (AMDGPU::hasNamedOperand (Inst.getOpcode (), AMDGPU::OpName::omod))
9216
9214
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyOModSI, 0 );
9217
- }
9215
+
9218
9216
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstSel, SdwaSel::DWORD);
9219
9217
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaDstUnused, DstUnused::UNUSED_PRESERVE);
9220
9218
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, SdwaSel::DWORD);
9221
9219
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, SdwaSel::DWORD);
9222
9220
break ;
9223
9221
9224
9222
case SIInstrFlags::VOPC:
9225
- if (AMDGPU::getNamedOperandIdx (Inst.getOpcode (), AMDGPU::OpName::clamp) != - 1 )
9223
+ if (AMDGPU::hasNamedOperand (Inst.getOpcode (), AMDGPU::OpName::clamp))
9226
9224
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyClampSI, 0 );
9227
9225
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc0Sel, SdwaSel::DWORD);
9228
9226
addOptionalImmOperand (Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySdwaSrc1Sel, SdwaSel::DWORD);
0 commit comments