[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
================
@@ -595,6 +676,45 @@ def SPIRV_CLRintOp : SPIRV_CLUnaryArithmeticOp<"rint", 53, SPIRV_Float> {
// -----
+def SPIRV_CLRootnOp : SPIRV_CLOp<"rootn", 54, [Pure, AllTypesMatch<["x", "result"]>]> {
+ let summary = "Compute the n-th root of x, where n is an integer.";
+
+ let description = [{
+ Result is the n-th root of x, where n is an integer.
+
+ The operand x must be a scalar or vector whose component type is
+ floating-point.
+
+ The n operand must be a scalar or vector with integer component type.
+ The number of components in x and n 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.rootn %0 : f32, %1 : i32 -> f32
+ %2 = spirv.CL.rootn %0 : vector<3xf32>, %1 : vector<3xi32> -> vector<3xf32>
+ ```
+ }];
+
+ let arguments = (ins
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$x,
+ SPIRV_ScalarOrVectorOf<SPIRV_Integer>:$n
+ );
+
+ let results = (outs
+ SPIRV_ScalarOrVectorOf<SPIRV_Float>:$result
+ );
+
+ let assemblyFormat = [{
+ attr-dict $x `:` type($x) `,` $n `:` type($n) `->` type($result)
----------------
kuhar wrote:
also here
https://github.com/llvm/llvm-project/pull/194791
More information about the Mlir-commits
mailing list