[llvm-branch-commits] [SPARC] Use op-then-halve instructions when we have VIS3 (PR #135718)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat May 3 14:26:48 PDT 2025
================
@@ -3613,13 +3613,15 @@ bool SparcTargetLowering::isFNegFree(EVT VT) const {
bool SparcTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
bool ForCodeSize) const {
+ bool CanLower = false;
if (VT != MVT::f32 && VT != MVT::f64)
return false;
- if (Imm.isZero())
- return Subtarget->isVIS();
- if (Imm.isExactlyValue(+0.5) || Imm.isExactlyValue(-0.5))
- return Subtarget->isVIS3();
- return false;
+ if (Subtarget->isVIS())
+ CanLower = CanLower || Imm.isZero();
+ if (Subtarget->isVIS3())
+ CanLower =
+ CanLower || (Imm.isExactlyValue(+0.5) || Imm.isExactlyValue(-0.5));
+ return CanLower;
----------------
arsenm wrote:
```suggestion
if (Subtarget->isVIS3())
return Imm.isExactlyValue(+0.5) || Imm.isExactlyValue(-0.5);
return false;
```
Could also use getExactLog2Abs == -1?
https://github.com/llvm/llvm-project/pull/135718
More information about the llvm-branch-commits
mailing list