[llvm] [X86] Add custom operation actions for f16: FABS, FNEG, and FCOPYSIGN (PR #128877)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 06:02:22 PST 2025


https://github.com/StarOne01 created https://github.com/llvm/llvm-project/pull/128877

This pull request adds custom handling for several floating-point operations for the `f16` type with respect to (https://github.com/llvm/llvm-project/issues/126892)..

>From a3aaae0b4952fb5c5671f654394ca8a12feb16cf Mon Sep 17 00:00:00 2001
From: Prashanth <TheStarOne01 at proton.me>
Date: Wed, 26 Feb 2025 19:22:58 +0530
Subject: [PATCH] [X86] Add custom operation actions for f16: FABS, FNEG, and
 FCOPYSIGN

---
 llvm/lib/Target/X86/X86ISelLowering.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index a4357197e2843..5a80754e7a3bb 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -701,6 +701,9 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
     setOperationAction(ISD::FSUB, MVT::f16, Promote);
     setOperationAction(ISD::FMUL, MVT::f16, Promote);
     setOperationAction(ISD::FDIV, MVT::f16, Promote);
+    setOperationAction(ISD::FABS, MVT::f16, Custom);
+    setOperationAction(ISD::FNEG, MVT::f16, Custom);
+    setOperationAction(ISD::FCOPYSIGN, MVT::f16, Custom);
     setOperationAction(ISD::FP_ROUND, MVT::f16, Custom);
     setOperationAction(ISD::FP_EXTEND, MVT::f32, Custom);
     setOperationAction(ISD::FP_EXTEND, MVT::f64, Custom);



More information about the llvm-commits mailing list