[Mlir-commits] [mlir] [mlir][SPIR-V] Add OpenCL.std ldexp, pown, and rootn ops (PR #194791)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Apr 29 06:10:58 PDT 2026
================
@@ -505,6 +505,48 @@ def SPIRV_CLFmaOp : SPIRV_CLTernaryArithmeticOp<"fma", 26, SPIRV_Float> {
// -----
+def SPIRV_CLLdexpOp : SPIRV_CLOp<"ldexp", 34, [Pure, AllTypesMatch<["x", "y"]>]> {
+ let summary = "Builds y such that y = significand * 2^exponent.";
+
+ let description = [{
+ Builds a floating-point number from x and the corresponding
+ integral exponent of two in exp:
+
+ significand * 2^exponent
+
+ The operand x must be a scalar or vector whose component type is
+ floating-point.
+
+ The exp operand must be a scalar or vector with integer component type.
+ The number of components in x and exp must be the same.
+
+ Result Type must be the same type as the type of x. Results are computed
+ per component.
+
+ #### Example:
+
+ ```mlir
+ %y = spirv.CL.ldexp %x : f32, %exp : i32 -> f32
+ %y = spirv.CL.ldexp %x : vector<3xf32>, %exp : vector<3xi32> -> vector<3xf32>
+ ```
+ }];
+
+ let arguments = (ins
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$x,
+ SPIRV_ScalarOrVectorOf<SPIRV_Integer>:$exp
+ );
+
+ let results = (outs
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$y
+ );
+
+ let assemblyFormat = [{
+ attr-dict $x `:` type($x) `,` $exp `:` type($exp) `->` type($y)
----------------
kuhar wrote:
We generally follow this assembly format: `spirv.op_name %arg0, %arg1 : type0, type0 -> result_type` in the spirv dialect
https://github.com/llvm/llvm-project/pull/194791
More information about the Mlir-commits
mailing list