[clang] [llvm] [NVPTX] Cleanup and document nvvm.fabs intrinsics, adding f16 support (PR #135644)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 14:28:42 PDT 2025


================
@@ -411,6 +412,13 @@ static Instruction *convertNvvmIntrinsicToLlvm(InstCombiner &IC,
     }
     return nullptr;
   }
+  case SPC_Fabs: {
+    if (!II->getType()->isDoubleTy())
+      return nullptr;
+    auto *Fabs = Intrinsic::getOrInsertDeclaration(
+        II->getModule(), Intrinsic::fabs, II->getType());
+    return CallInst::Create(Fabs, II->getArgOperand(0));
----------------
AlexMaclean wrote:

I've removed this transformation all together based on https://github.com/llvm/llvm-project/pull/135644#discussion_r2045313522. I've also updated the clang frontend to use `llvm.fabs` for this case since the `llvm.nvvm.fabs` intrinsic has no advantage for doubles. 

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


More information about the llvm-commits mailing list