[Mlir-commits] [mlir] [mlir][SPIR-V] Add OpenCL.std ldexp, pown, and rootn ops (PR #194791)
Arseniy Obolenskiy
llvmlistbot at llvm.org
Wed Apr 29 08:03:56 PDT 2026
================
@@ -571,6 +613,45 @@ def SPIRV_CLPowOp : SPIRV_CLBinaryArithmeticOp<"pow", 48, SPIRV_Float> {
// -----
+def SPIRV_CLPownOp : SPIRV_CLOp<"pown", 49, [Pure, AllTypesMatch<["x", "result"]>]> {
+ let summary = "Compute x to the power y, where y is an integer.";
+
+ let description = [{
+ Result is x raised to the power y, where y is an integer.
+
+ The operand x must be a scalar or vector whose component type is
+ floating-point.
+
+ The y operand must be a scalar or vector with integer component type.
+ The number of components in x and y must be the same.
+
+ Result Type must be the same type as the type of x. Results are computed
+ per component.
+
+ #### Example:
+
+ ```mlir
+ %2 = spirv.CL.pown %0 : f32, %1 : i32 -> f32
+ %2 = spirv.CL.pown %0 : vector<3xf32>, %1 : vector<3xi32> -> vector<3xf32>
+ ```
+ }];
+
+ let arguments = (ins
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$x,
+ SPIRV_ScalarOrVectorOf<SPIRV_Integer>:$y
+ );
+
+ let results = (outs
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$result
+ );
+
+ let assemblyFormat = [{
+ attr-dict $x `:` type($x) `,` $y `:` type($y) `->` type($result)
----------------
aobolensk wrote:
Done
https://github.com/llvm/llvm-project/pull/194791
More information about the Mlir-commits
mailing list