[llvm] [SelectionDAG] optimize sdiv with positive divisor and positive magic (PR #189287)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 05:57:08 PDT 2026
================
@@ -5427,6 +5427,10 @@ class LLVM_ABI TargetLowering : public TargetLoweringBase {
SelectionDAG &DAG,
SmallVectorImpl<SDNode *> &Created) const;
+ /// Return true if the target prefers to lower constant sdiv using SRA+SUB
+ /// rather than SRL+ADD for the sign correction step.
+ virtual bool preferSDivSRASUB(EVT VT) const { return false; }
----------------
arsenm wrote:
Don't add a new niche hook, this should be inferable with existing information
https://github.com/llvm/llvm-project/pull/189287
More information about the llvm-commits
mailing list