[Mlir-commits] [mlir] [ROCDL] added math instructions to the ROCDL dialect (PR #169672)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Nov 26 10:02:50 PST 2025


================
@@ -1885,6 +1885,27 @@ def ROCDL_FMed3Op : ROCDL_IntrOp<"fmed3", [0], [], [Pure, AllTypesMatch<["res",
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// Math operations
+//===----------------------------------------------------------------------===//
+
+class ROCDL_Math_IntrOp<string mnemonic, list<Trait> traits = []> :
+  ROCDL_IntrOp<mnemonic, [0], [], traits, 1>,
+  Arguments<(ins LLVM_AnyFloat:$arg)> {
+  let results = (outs LLVM_AnyFloat:$res);
+  let assemblyFormat =
+    "$arg qualified(type($arg)) attr-dict `->` qualified(type($res))";
+}
+
+def ROCDLTanh : ROCDL_Math_IntrOp<"tanh">;
----------------
krzysz00 wrote:

These are all `Pure` in the MLIR sense (no side effects and speculatable) and should be declared as such, probably in the common class

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


More information about the Mlir-commits mailing list