[llvm-branch-commits] [SPARC] Promote i32 CTTZ when we have VIS3 (PR #135894)
Sergei Barannikov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Apr 17 08:36:54 PDT 2025
================
@@ -3599,6 +3615,15 @@ bool SparcTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
bool SparcTargetLowering::isCtlzFast() const { return Subtarget->isVIS3(); }
+bool SparcTargetLowering::isCheapToSpeculateCttz(Type *Ty) const {
+ // We lack native cttz, however,
+ // On 64-bit targets it is cheap to implement it in terms of popc.
+ if (Subtarget->is64Bit() && Subtarget->usePopc())
+ return true;
+ // Otherwise, implementing cttz in terms of ctlz is still cheap.
+ return isCheapToSpeculateCtlz(Ty);
----------------
s-barannikov wrote:
Never mind, I saw it in tests :)
https://github.com/llvm/llvm-project/pull/135894
More information about the llvm-branch-commits
mailing list