[llvm-branch-commits] [SPARC] Use op-then-halve instructions when we have VIS3 (PR #135718)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Apr 26 16:03:04 PDT 2025


================
@@ -3588,8 +3588,13 @@ bool SparcTargetLowering::useLoadStackGuardNode(const Module &M) const {
 
 bool SparcTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
                                        bool ForCodeSize) const {
-  return Subtarget->isVIS() && (VT == MVT::f32 || VT == MVT::f64) &&
-         Imm.isZero();
+  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;
----------------
koachan wrote:

I've reordered the check so the target check is done first, but what do you mean by separately?

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


More information about the llvm-branch-commits mailing list