@@ -105,7 +105,7 @@ bool AMDGPUInstructionSelector::constrainCopyLikeIntrin(MachineInstr &MI,
105105 MachineOperand &Src = MI.getOperand (1 );
106106
107107 // TODO: This should be legalized to s32 if needed
108- if (MRI->getType (Dst.getReg ()) == LLT::scalar (1 ))
108+ if (MRI->getType (Dst.getReg ()). isScalar (1 ))
109109 return false ;
110110
111111 const TargetRegisterClass *DstRC
@@ -293,7 +293,7 @@ bool AMDGPUInstructionSelector::selectPHI(MachineInstr &I) const {
293293 // - divergent S1 G_PHI should go through lane mask merging algorithm
294294 // and be fully inst-selected in AMDGPUGlobalISelDivergenceLowering
295295 // - uniform S1 G_PHI should be lowered into S32 G_PHI in AMDGPURegBankSelect
296- if (DefTy == LLT::scalar (1 ))
296+ if (DefTy. isScalar (1 ))
297297 return false ;
298298
299299 // TODO: Verify this doesn't have insane operands (i.e. VGPR to SGPR copy)
@@ -733,9 +733,8 @@ bool AMDGPUInstructionSelector::selectG_BUILD_VECTOR(MachineInstr &MI) const {
733733 // Selection logic below is for V2S16 only.
734734 // For G_BUILD_VECTOR_TRUNC, additionally check that the operands are s32.
735735 Register Dst = MI.getOperand (0 ).getReg ();
736- if (MRI->getType (Dst) != LLT::fixed_vector (2 , 16 ) ||
737- (MI.getOpcode () == AMDGPU::G_BUILD_VECTOR_TRUNC &&
738- SrcTy != LLT::scalar (32 )))
736+ if (!MRI->getType (Dst).isFixedVector (2 , 16 ) ||
737+ (MI.getOpcode () == AMDGPU::G_BUILD_VECTOR_TRUNC && !SrcTy.isScalar (32 )))
739738 return selectImpl (MI, *CoverageInfo);
740739
741740 const RegisterBank *DstBank = RBI.getRegBank (Dst, *MRI, TRI);
@@ -1073,9 +1072,9 @@ bool AMDGPUInstructionSelector::selectDivScale(MachineInstr &MI) const {
10731072
10741073 LLT Ty = MRI->getType (Dst0);
10751074 unsigned Opc;
1076- if (Ty == LLT::scalar (32 ))
1075+ if (Ty. isScalar (32 ))
10771076 Opc = AMDGPU::V_DIV_SCALE_F32_e64;
1078- else if (Ty == LLT::scalar (64 ))
1077+ else if (Ty. isScalar (64 ))
10791078 Opc = AMDGPU::V_DIV_SCALE_F64_e64;
10801079 else
10811080 return false ;
@@ -2386,11 +2385,10 @@ bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
23862385 Register SrcReg = I.getOperand (1 ).getReg ();
23872386 const LLT DstTy = MRI->getType (DstReg);
23882387 const LLT SrcTy = MRI->getType (SrcReg);
2389- const LLT S1 = LLT::scalar (1 );
23902388
23912389 const RegisterBank *SrcRB = RBI.getRegBank (SrcReg, *MRI, TRI);
23922390 const RegisterBank *DstRB;
2393- if (DstTy == S1 ) {
2391+ if (DstTy. isScalar ( 1 ) ) {
23942392 // This is a special case. We don't treat s1 for legalization artifacts as
23952393 // vcc booleans.
23962394 DstRB = SrcRB;
@@ -2428,7 +2426,7 @@ bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
24282426 return true ;
24292427 }
24302428
2431- if (DstTy == LLT::fixed_vector (2 , 16 ) && SrcTy == LLT::fixed_vector (2 , 32 )) {
2429+ if (DstTy. isFixedVector (2 , 16 ) && SrcTy. isFixedVector (2 , 32 )) {
24322430 MachineBasicBlock *MBB = I.getParent ();
24332431 const DebugLoc &DL = I.getDebugLoc ();
24342432
@@ -2720,8 +2718,7 @@ static bool isExtractHiElt(MachineRegisterInfo &MRI, Register In,
27202718 if (Shuffle->getOpcode () != AMDGPU::G_SHUFFLE_VECTOR)
27212719 return false ;
27222720
2723- assert (MRI.getType (Shuffle->getOperand (0 ).getReg ()) ==
2724- LLT::fixed_vector (2 , 16 ));
2721+ assert (MRI.getType (Shuffle->getOperand (0 ).getReg ()).isFixedVector (2 , 16 ));
27252722
27262723 ArrayRef<int > Mask = Shuffle->getOperand (3 ).getShuffleMask ();
27272724 assert (Mask.size () == 2 );
@@ -2745,8 +2742,7 @@ bool AMDGPUInstructionSelector::selectG_FPEXT(MachineInstr &I) const {
27452742
27462743 Register Src = I.getOperand (1 ).getReg ();
27472744
2748- if (MRI->getType (Dst) == LLT::scalar (32 ) &&
2749- MRI->getType (Src) == LLT::scalar (16 )) {
2745+ if (MRI->getType (Dst).isScalar (32 ) && MRI->getType (Src).isScalar (16 )) {
27502746 if (isExtractHiElt (*MRI, Src, Src)) {
27512747 MachineBasicBlock *BB = I.getParent ();
27522748 BuildMI (*BB, &I, I.getDebugLoc (), TII.get (AMDGPU::S_CVT_HI_F32_F16), Dst)
@@ -2774,7 +2770,7 @@ bool AMDGPUInstructionSelector::selectG_FNEG(MachineInstr &MI) const {
27742770 Register Dst = MI.getOperand (0 ).getReg ();
27752771 const RegisterBank *DstRB = RBI.getRegBank (Dst, *MRI, TRI);
27762772 if (DstRB->getID () != AMDGPU::SGPRRegBankID ||
2777- MRI->getType (Dst) != LLT::scalar (64 ))
2773+ ! MRI->getType (Dst). isScalar (64 ))
27782774 return false ;
27792775
27802776 Register Src = MI.getOperand (1 ).getReg ();
@@ -2820,7 +2816,7 @@ bool AMDGPUInstructionSelector::selectG_FABS(MachineInstr &MI) const {
28202816 Register Dst = MI.getOperand (0 ).getReg ();
28212817 const RegisterBank *DstRB = RBI.getRegBank (Dst, *MRI, TRI);
28222818 if (DstRB->getID () != AMDGPU::SGPRRegBankID ||
2823- MRI->getType (Dst) != LLT::scalar (64 ))
2819+ ! MRI->getType (Dst). isScalar (64 ))
28242820 return false ;
28252821
28262822 Register Src = MI.getOperand (1 ).getReg ();
@@ -2992,7 +2988,7 @@ bool AMDGPUInstructionSelector::selectG_BRCOND(MachineInstr &I) const {
29922988 // RegBankSelect knows what it's doing if the branch condition is scc, even
29932989 // though it currently does not.
29942990 if (!isVCC (CondReg, *MRI)) {
2995- if (MRI->getType (CondReg) != LLT::scalar (32 ))
2991+ if (! MRI->getType (CondReg). isScalar (32 ))
29962992 return false ;
29972993
29982994 CondPhysReg = AMDGPU::SCC;
@@ -3455,15 +3451,15 @@ bool AMDGPUInstructionSelector::selectBufferLoadLds(MachineInstr &MI) const {
34553451static Register matchZeroExtendFromS32 (MachineRegisterInfo &MRI, Register Reg) {
34563452 Register ZExtSrc;
34573453 if (mi_match (Reg, MRI, m_GZExt (m_Reg (ZExtSrc))))
3458- return MRI.getType (ZExtSrc) == LLT::scalar (32 ) ? ZExtSrc : Register ();
3454+ return MRI.getType (ZExtSrc). isScalar (32 ) ? ZExtSrc : Register ();
34593455
34603456 // Match legalized form %zext = G_MERGE_VALUES (s32 %x), (s32 0)
34613457 const MachineInstr *Def = getDefIgnoringCopies (Reg, MRI);
34623458 if (Def->getOpcode () != AMDGPU::G_MERGE_VALUES)
34633459 return Register ();
34643460
34653461 assert (Def->getNumOperands () == 3 &&
3466- MRI.getType (Def->getOperand (0 ).getReg ()) == LLT::scalar (64 ));
3462+ MRI.getType (Def->getOperand (0 ).getReg ()). isScalar (64 ));
34673463 if (mi_match (Def->getOperand (2 ).getReg (), MRI, m_ZeroInt ())) {
34683464 return Def->getOperand (1 ).getReg ();
34693465 }
@@ -4053,7 +4049,7 @@ bool AMDGPUInstructionSelector::select(MachineInstr &I) {
40534049 // This is a workaround. For extension from type i1, `selectImpl()` uses
40544050 // patterns from TD file and generates an illegal VGPR to SGPR COPY as type
40554051 // i1 can only be hold in a SGPR class.
4056- if (MRI->getType (I.getOperand (1 ).getReg ()) != LLT::scalar (1 ) &&
4052+ if (! MRI->getType (I.getOperand (1 ).getReg ()). isScalar (1 ) &&
40574053 selectImpl (I, *CoverageInfo))
40584054 return true ;
40594055 return selectG_SZA_EXT (I);
@@ -4286,7 +4282,7 @@ AMDGPUInstructionSelector::selectVOP3PModsImpl(
42864282 if (MI->getOpcode () == AMDGPU::G_FNEG &&
42874283 // It's possible to see an f32 fneg here, but unlikely.
42884284 // TODO: Treat f32 fneg as only high bit.
4289- MRI.getType (Src) == LLT::fixed_vector (2 , 16 )) {
4285+ MRI.getType (Src). isFixedVector (2 , 16 )) {
42904286 Mods ^= (SISrcMods::NEG | SISrcMods::NEG_HI);
42914287 Src = MI->getOperand (1 ).getReg ();
42924288 MI = MRI.getVRegDef (Src);
@@ -5784,7 +5780,7 @@ AMDGPUInstructionSelector::selectSMRDBufferSgprImm(MachineOperand &Root) const {
57845780 if (!EncodedOffset)
57855781 return std::nullopt ;
57865782
5787- assert (MRI->getType (SOffset) == LLT::scalar (32 ));
5783+ assert (MRI->getType (SOffset). isScalar (32 ));
57885784 return {{[=](MachineInstrBuilder &MIB) { MIB.addReg (SOffset); },
57895785 [=](MachineInstrBuilder &MIB) { MIB.addImm (*EncodedOffset); }}};
57905786}
@@ -5799,7 +5795,7 @@ AMDGPUInstructionSelector::selectVOP3PMadMixModsImpl(MachineOperand &Root,
57995795 std::tie (Src, Mods) = selectVOP3ModsImpl (Root.getReg ());
58005796
58015797 if (mi_match (Src, *MRI, m_GFPExt (m_Reg (Src)))) {
5802- assert (MRI->getType (Src) == LLT::scalar (16 ));
5798+ assert (MRI->getType (Src). isScalar (16 ));
58035799
58045800 // Only change Src if src modifier could be gained. In such cases new Src
58055801 // could be sgpr but this does not violate constant bus restriction for
0 commit comments