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

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 10:48:56 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);
----------------
Artem-B wrote:

Would operations other than FABS benefit from that, too?  E.g. `fneg` or `fcopysign`?

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


More information about the llvm-commits mailing list