[Mlir-commits] [mlir] [MLIR][NVVM] Add rsqrt Op (PR #195854)

Varad Rahul Kamthe llvmlistbot at llvm.org
Thu May 7 03:10:36 PDT 2026


================
@@ -3515,6 +3515,25 @@ Ex2Op::getIntrinsicIDAndArgs(Operation &op, LLVM::ModuleTranslation &mt,
   return {id, {mt.lookupValue(thisOp.getSrc())}};
 }
 
+mlir::NVVM::IDArgPair
+RsqrtApproxOp::getIntrinsicIDAndArgs(Operation &op, LLVM::ModuleTranslation &mt,
+                                     llvm::IRBuilderBase &builder) {
+  auto thisOp = cast<NVVM::RsqrtApproxOp>(op);
+  Type t = thisOp.getRes().getType();
+  bool isFtz = thisOp.getFtz();
+
+  llvm::Intrinsic::ID id = [&] {
+    if (t.isF32())
+      return isFtz ? llvm::Intrinsic::nvvm_rsqrt_approx_ftz_f
----------------
varadk27 wrote:

Thanks for the review, @grypp! The if-body is technically a single return statement (wrapped due to the ternary), which per the coding standard Pradeep linked would normally be brace-less. That said, since it visually spans multiple lines,
I'm happy to add {} if you think it reads better here . Please let me know which you'd prefer.

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


More information about the Mlir-commits mailing list