[llvm] [X86][NVPTX][LegalizeDAG] If i16 legal, legalize FABS.f16 with Expand (PR #106153)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 14:34:41 PDT 2024


================
@@ -849,7 +849,8 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
     AddPromotedToType(Op, MVT::bf16, MVT::f32);
   }
   for (const auto &Op : {ISD::FABS}) {
-    setOperationAction(Op, MVT::f16, Promote);
+    // Expand instead of Promote to clear sign bit by bitcasting to i16
+    setOperationAction(Op, MVT::f16, Expand);
----------------
v01dXYZ wrote:

that's a valid point.

For `NVPTX`, we have for `f16` (so no change required)

* `FNEG` Legal / Expand
* `FCOPYSIGN` Expand

For `X86-64`, we have for `f16`

* `FNEG` Promote
* `FCOPYSIGN` Expand

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


More information about the llvm-commits mailing list