[llvm] [AMDGPU][GlobalISel] Improve combining on v_ldexp (PR #190236)
Jasmine Tang via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 12:52:42 PDT 2026
================
@@ -518,6 +522,23 @@ bool AMDGPUCombinerHelper::matchCombineFmulWithSelectToFldexp(
return true;
}
+bool AMDGPUCombinerHelper::matchCombineFmulWithSelectToFldexp(
+ MachineInstr &MI, MachineInstr &Sel,
+ std::function<void(MachineIRBuilder &)> &MatchInfo) const {
+ Register Dst = MI.getOperand(0).getReg();
+ LLT ScalarDestTy = MRI.getType(Dst).getScalarType();
+
+ // fldexp has no SALU form. On targets with SALU float, defer this combine
+ // to the RegBankCombiner where register banks are known and we can limit it
+ // to VGPR (divergent) values only.
+ if (STI.hasSALUFloatInsts() &&
+ (ScalarDestTy == LLT::scalar(64) || ScalarDestTy == LLT::scalar(32) ||
+ ScalarDestTy == LLT::scalar(16)))
+ return false;
----------------
badumbatish wrote:
would it be simpler to gate this to
```
if (STI.hasSALUFloatInsts() &&ScalarDestTy == LLT::scalar(32))
return false;
```
this addresses the original issue and doesn't complicate the if-else case too much, leaving 16 and 64 case to early combine
https://github.com/llvm/llvm-project/pull/190236
More information about the llvm-commits
mailing list