[Mlir-commits] [mlir] [mlir][NVVM] Add packed EX2 operations (PR #220501)

Bastian Hagedorn llvmlistbot at llvm.org
Mon Sep 7 00:32:12 PDT 2026


================
@@ -503,13 +503,25 @@ def NVVM_Log2Op : NVVM_F32UnaryApproxOp<"log2"> {
   }];
 }
 
-def NVVM_Ex2Op : NVVM_F32UnaryApproxOp<"ex2"> {
+def NVVM_Ex2Op
+    : NVVM_SingleResultIntrinsicOp<"ex2", [Pure, SameOperandsAndResultType]> {
   let summary = "Base-2 exponential (fast approximation)";
   let description = [{
-    Computes a fast approximation of 2 raised to the power of the input
-    value. The `ftz` attribute, when set, flushes subnormal inputs and
-    results to sign-preserving zero.
+    Computes a fast approximation of 2 raised to the power of the input value.
+    Supports f32 and packed f16x2 and bf16x2 values. The `ftz` attribute is
+    optional for f32, unavailable for f16x2, and required for bf16x2.
   }];
+  let arguments = (ins
+    AnyTypeOf<[F32, VectorOfLengthAndType<[2], [F16]>,
----------------
bastianhagedorn wrote:

Done. I added vector<1xf32> and a translation test.

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


More information about the Mlir-commits mailing list