@@ -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 ;
@@ -2390,11 +2389,10 @@ bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
23902389 Register SrcReg = I.getOperand (1 ).getReg ();
23912390 const LLT DstTy = MRI->getType (DstReg);
23922391 const LLT SrcTy = MRI->getType (SrcReg);
2393- const LLT S1 = LLT::scalar (1 );
23942392
23952393 const RegisterBank *SrcRB = RBI.getRegBank (SrcReg, *MRI, TRI);
23962394 const RegisterBank *DstRB;
2397- if (DstTy == S1 ) {
2395+ if (DstTy. isScalar ( 1 ) ) {
23982396 // This is a special case. We don't treat s1 for legalization artifacts as
23992397 // vcc booleans.
24002398 DstRB = SrcRB;
@@ -2432,7 +2430,7 @@ bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
24322430 return true ;
24332431 }
24342432
2435- if (DstTy == LLT::fixed_vector (2 , 16 ) && SrcTy == LLT::fixed_vector (2 , 32 )) {
2433+ if (DstTy. isFixedVector (2 , 16 ) && SrcTy. isFixedVector (2 , 32 )) {
24362434 MachineBasicBlock *MBB = I.getParent ();
24372435 const DebugLoc &DL = I.getDebugLoc ();
24382436
@@ -2724,8 +2722,7 @@ static bool isExtractHiElt(MachineRegisterInfo &MRI, Register In,
27242722 if (Shuffle->getOpcode () != AMDGPU::G_SHUFFLE_VECTOR)
27252723 return false ;
27262724
2727- assert (MRI.getType (Shuffle->getOperand (0 ).getReg ()) ==
2728- LLT::fixed_vector (2 , 16 ));
2725+ assert (MRI.getType (Shuffle->getOperand (0 ).getReg ()).isFixedVector (2 , 16 ));
27292726
27302727 ArrayRef<int > Mask = Shuffle->getOperand (3 ).getShuffleMask ();
27312728 assert (Mask.size () == 2 );
@@ -2749,8 +2746,7 @@ bool AMDGPUInstructionSelector::selectG_FPEXT(MachineInstr &I) const {
27492746
27502747 Register Src = I.getOperand (1 ).getReg ();
27512748
2752- if (MRI->getType (Dst) == LLT::scalar (32 ) &&
2753- MRI->getType (Src) == LLT::scalar (16 )) {
2749+ if (MRI->getType (Dst).isScalar (32 ) && MRI->getType (Src).isScalar (16 )) {
27542750 if (isExtractHiElt (*MRI, Src, Src)) {
27552751 MachineBasicBlock *BB = I.getParent ();
27562752 BuildMI (*BB, &I, I.getDebugLoc (), TII.get (AMDGPU::S_CVT_HI_F32_F16), Dst)
@@ -2778,7 +2774,7 @@ bool AMDGPUInstructionSelector::selectG_FNEG(MachineInstr &MI) const {
27782774 Register Dst = MI.getOperand (0 ).getReg ();
27792775 const RegisterBank *DstRB = RBI.getRegBank (Dst, *MRI, TRI);
27802776 if (DstRB->getID () != AMDGPU::SGPRRegBankID ||
2781- MRI->getType (Dst) != LLT::scalar (64 ))
2777+ ! MRI->getType (Dst). isScalar (64 ))
27822778 return false ;
27832779
27842780 Register Src = MI.getOperand (1 ).getReg ();
@@ -2824,7 +2820,7 @@ bool AMDGPUInstructionSelector::selectG_FABS(MachineInstr &MI) const {
28242820 Register Dst = MI.getOperand (0 ).getReg ();
28252821 const RegisterBank *DstRB = RBI.getRegBank (Dst, *MRI, TRI);
28262822 if (DstRB->getID () != AMDGPU::SGPRRegBankID ||
2827- MRI->getType (Dst) != LLT::scalar (64 ))
2823+ ! MRI->getType (Dst). isScalar (64 ))
28282824 return false ;
28292825
28302826 Register Src = MI.getOperand (1 ).getReg ();
@@ -2996,7 +2992,7 @@ bool AMDGPUInstructionSelector::selectG_BRCOND(MachineInstr &I) const {
29962992 // RegBankSelect knows what it's doing if the branch condition is scc, even
29972993 // though it currently does not.
29982994 if (!isVCC (CondReg, *MRI)) {
2999- if (MRI->getType (CondReg) != LLT::scalar (32 ))
2995+ if (! MRI->getType (CondReg). isScalar (32 ))
30002996 return false ;
30012997
30022998 CondPhysReg = AMDGPU::SCC;
@@ -3459,15 +3455,15 @@ bool AMDGPUInstructionSelector::selectBufferLoadLds(MachineInstr &MI) const {
34593455static Register matchZeroExtendFromS32 (MachineRegisterInfo &MRI, Register Reg) {
34603456 Register ZExtSrc;
34613457 if (mi_match (Reg, MRI, m_GZExt (m_Reg (ZExtSrc))))
3462- return MRI.getType (ZExtSrc) == LLT::scalar (32 ) ? ZExtSrc : Register ();
3458+ return MRI.getType (ZExtSrc). isScalar (32 ) ? ZExtSrc : Register ();
34633459
34643460 // Match legalized form %zext = G_MERGE_VALUES (s32 %x), (s32 0)
34653461 const MachineInstr *Def = getDefIgnoringCopies (Reg, MRI);
34663462 if (Def->getOpcode () != AMDGPU::G_MERGE_VALUES)
34673463 return Register ();
34683464
34693465 assert (Def->getNumOperands () == 3 &&
3470- MRI.getType (Def->getOperand (0 ).getReg ()) == LLT::scalar (64 ));
3466+ MRI.getType (Def->getOperand (0 ).getReg ()). isScalar (64 ));
34713467 if (mi_match (Def->getOperand (2 ).getReg (), MRI, m_ZeroInt ())) {
34723468 return Def->getOperand (1 ).getReg ();
34733469 }
@@ -4058,7 +4054,7 @@ bool AMDGPUInstructionSelector::select(MachineInstr &I) {
40584054 // This is a workaround. For extension from type i1, `selectImpl()` uses
40594055 // patterns from TD file and generates an illegal VGPR to SGPR COPY as type
40604056 // i1 can only be hold in a SGPR class.
4061- if (MRI->getType (I.getOperand (1 ).getReg ()) != LLT::scalar (1 ) &&
4057+ if (! MRI->getType (I.getOperand (1 ).getReg ()). isScalar (1 ) &&
40624058 selectImpl (I, *CoverageInfo))
40634059 return true ;
40644060 return selectG_SZA_EXT (I);
@@ -4291,7 +4287,7 @@ AMDGPUInstructionSelector::selectVOP3PModsImpl(
42914287 if (MI->getOpcode () == AMDGPU::G_FNEG &&
42924288 // It's possible to see an f32 fneg here, but unlikely.
42934289 // TODO: Treat f32 fneg as only high bit.
4294- MRI.getType (Src) == LLT::fixed_vector (2 , 16 )) {
4290+ MRI.getType (Src). isFixedVector (2 , 16 )) {
42954291 Mods ^= (SISrcMods::NEG | SISrcMods::NEG_HI);
42964292 Src = MI->getOperand (1 ).getReg ();
42974293 MI = MRI.getVRegDef (Src);
@@ -5789,7 +5785,7 @@ AMDGPUInstructionSelector::selectSMRDBufferSgprImm(MachineOperand &Root) const {
57895785 if (!EncodedOffset)
57905786 return std::nullopt ;
57915787
5792- assert (MRI->getType (SOffset) == LLT::scalar (32 ));
5788+ assert (MRI->getType (SOffset). isScalar (32 ));
57935789 return {{[=](MachineInstrBuilder &MIB) { MIB.addReg (SOffset); },
57945790 [=](MachineInstrBuilder &MIB) { MIB.addImm (*EncodedOffset); }}};
57955791}
@@ -5804,7 +5800,7 @@ AMDGPUInstructionSelector::selectVOP3PMadMixModsImpl(MachineOperand &Root,
58045800 std::tie (Src, Mods) = selectVOP3ModsImpl (Root.getReg ());
58055801
58065802 if (mi_match (Src, *MRI, m_GFPExt (m_Reg (Src)))) {
5807- assert (MRI->getType (Src) == LLT::scalar (16 ));
5803+ assert (MRI->getType (Src). isScalar (16 ));
58085804
58095805 // Only change Src if src modifier could be gained. In such cases new Src
58105806 // could be sgpr but this does not violate constant bus restriction for
0 commit comments