[llvm] [RISCV] Optimize bitcast to use dedicated fneg instruction (PR #216659)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 01:27:12 PDT 2026
================
@@ -3444,6 +3438,14 @@ class LLVM_ABI TargetLoweringBase {
return false;
}
+ /// Return true if the target should always perform FMA negation optimizations
+ /// even when isFNegFree returns true. This is used to handle target-specific
+ /// cases where FMA negation should be performed regardless of the general
+ /// fneg cost model.
+ virtual bool shouldAlwaysPerformFMANegOpt(EVT VT) const {
+ return false;
+ }
----------------
arsenm wrote:
This is the bad style of overly specific, single use, TargetLowering hook which we should stop adding. The negation transforms should be improved to understand the context. AMDGPU has quite a lot of source modifier matching code aware of this, maybe some of that should be moved to the generic combines
https://github.com/llvm/llvm-project/pull/216659
More information about the llvm-commits
mailing list