================ @@ -290,7 +504,86 @@ RegBankLegalizeRules::RegBankLegalizeRules(const GCNSubtarget &_ST, .Any({{UniS64, S32}, {{Sgpr64}, {Sgpr32}, Ext32To64}}) .Any({{DivS64, S32}, {{Vgpr64}, {Vgpr32}, Ext32To64}}); - addRulesForGOpcs({G_LOAD}).Any({{DivS32, DivP1}, {{Vgpr32}, {VgprP1}}}); + bool hasUnAlignedLoads = ST->getGeneration() >= AMDGPUSubtarget::GFX12; + bool hasSMRDSmall = ST->hasScalarSubwordLoads(); + + Predicate isAlign16([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->getAlign() >= Align(16); + }); + + Predicate isAlign4([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->getAlign() >= Align(4); + }); + + Predicate isAtomicMMO([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->isAtomic(); + }); + + Predicate isUniMMO([](const MachineInstr &MI) -> bool { + return AMDGPUInstrInfo::isUniformMMO(*MI.memoperands_begin()); + }); + + Predicate isConst([](const MachineInstr &MI) -> bool { + // Address space in MMO be different then address space on pointer. + const MachineMemOperand *MMO = *MI.memoperands_begin(); + const unsigned AS = MMO->getAddrSpace(); + return AS == AMDGPUAS::CONSTANT_ADDRESS || + AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT; + }); + + Predicate isVolatileMMO([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->isVolatile(); + }); + + Predicate isInvMMO([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->isInvariant(); + }); + + Predicate isNoClobberMMO([](const MachineInstr &MI) -> bool { + return (*MI.memoperands_begin())->getFlags() & MONoClobber; + }); + + Predicate isNaturalAlignedSmall([](const MachineInstr &MI) -> bool { + const MachineMemOperand *MMO = *MI.memoperands_begin(); + const unsigned MemSize = 8 * MMO->getSize().getValue(); + return (MemSize == 16 && MMO->getAlign() >= Align(2)) || + (MemSize == 8 && MMO->getAlign() >= Align(1)); + }); + + auto isUL = !isAtomicMMO && isUniMMO && (isConst || !isVolatileMMO) && + (isConst || isInvMMO || isNoClobberMMO); ---------------- nhaehnle wrote:
What's the logic behind the `isConst || !isVolatileMMO` part of this predicate? const && volatile doesn't make much sense to me, so why isn't this just `!isVolatileMMO`? https://github.com/llvm/llvm-project/pull/112882 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits