https://github.com/koachan updated 
https://github.com/llvm/llvm-project/pull/135718

>From 50422a4d24403ef55bf76ccd710511e8dec6b77d Mon Sep 17 00:00:00 2001
From: Koakuma <koac...@protonmail.com>
Date: Sun, 4 May 2025 09:33:39 +0700
Subject: [PATCH] Rework isFPImmLegal

Created using spr 1.3.5
---
 llvm/lib/Target/Sparc/SparcISelLowering.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp 
b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
index 68c523709d38d..727857b647acc 100644
--- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp
+++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
@@ -3613,15 +3613,14 @@ 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 (Subtarget->isVIS())
-    CanLower = CanLower || Imm.isZero();
+  if (Subtarget->isVIS() && Imm.isZero())
+    return true;
   if (Subtarget->isVIS3())
-    CanLower =
-        CanLower || (Imm.isExactlyValue(+0.5) || Imm.isExactlyValue(-0.5));
-  return CanLower;
+    return Imm.isExactlyValue(+0.5) || Imm.isExactlyValue(-0.5) ||
+           Imm.getExactLog2Abs() == -1;
+  return false;
 }
 
 bool SparcTargetLowering::isCtlzFast() const { return Subtarget->isVIS3(); }

_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to