[llvm] GlobalISel needs fdiv 1 / sqrt(x) to rsq combine (PR #78673)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 23:09:57 PST 2024
================
@@ -334,6 +336,19 @@ bool AMDGPUPostLegalizerCombinerImpl::matchRcpSqrtToRsq(
return false;
}
+void AMDGPUPostLegalizerCombinerImpl::applyOneFDivSqrtToRsq(
+ MachineInstr &MI, const Register &X) const {
+ // B.setInstrAndDebugLoc(MI);
+
+ Register Dst = MI.getOperand(0).getReg();
+
+ B.buildIntrinsic(Intrinsic::amdgcn_rsq, ArrayRef<Register>({Dst}))
----------------
Pierre-vh wrote:
```suggestion
B.buildIntrinsic(Intrinsic::amdgcn_rsq, {Dst})
```
This should work I think, maybe you don't even need the `{}` - I don't remember if implicit ctor works in this case
https://github.com/llvm/llvm-project/pull/78673
More information about the llvm-commits
mailing list