[llvm] [TargetLowering] Optimize scmp with 0 using (x ashr 31) | (-x shr 31) (PR #205398)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 01:08:42 PDT 2026


================
@@ -3605,6 +3605,10 @@ class LLVM_ABI TargetLoweringBase {
     return isOperationLegalOrCustom(Op, VT);
   }
 
+  /// scmp(x, 0) Can be specially lowered using bitwise shifts.
+  /// On some platforms, this is better than shifts or boolean arithmetic.
+  virtual bool preferBitwiseSignum() const { return false; }
----------------
RKSimon wrote:

I would dearly like to avoid yet another TLI tuning hook - add target specific SCMP lowering instead if really necessary

https://github.com/llvm/llvm-project/pull/205398


More information about the llvm-commits mailing list