[PATCH] D80152: Added a TanOp to SPIR-V dialect GLSL ops
Lei Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 06:29:00 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe984b7f2a232: Added a TanOp to SPIR-V dialect GLSL ops (authored by shalva97, committed by antiagainst).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80152/new/
https://reviews.llvm.org/D80152
Files:
mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td
mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
mlir/test/Dialect/SPIRV/glslops.mlir
Index: mlir/test/Dialect/SPIRV/glslops.mlir
===================================================================
--- mlir/test/Dialect/SPIRV/glslops.mlir
+++ mlir/test/Dialect/SPIRV/glslops.mlir
@@ -139,3 +139,19 @@
%2 = spv.GLSL.Sin %arg0 : vector<3xf16>
return
}
+
+//===----------------------------------------------------------------------===//
+// spv.GLSL.Tan
+//===----------------------------------------------------------------------===//
+
+func @tan(%arg0 : f32) -> () {
+ // CHECK: spv.GLSL.Tan {{%.*}} : f32
+ %2 = spv.GLSL.Tan %arg0 : f32
+ return
+}
+
+func @tanvec(%arg0 : vector<3xf16>) -> () {
+ // CHECK: spv.GLSL.Tan {{%.*}} : vector<3xf16>
+ %2 = spv.GLSL.Tan %arg0 : vector<3xf16>
+ return
+}
Index: mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
===================================================================
--- mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
+++ mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir
@@ -12,6 +12,8 @@
%3 = spv.GLSL.Cos %arg0 : f32
// CHECK: {{%.*}} = spv.GLSL.Sin {{%.*}} : f32
%4 = spv.GLSL.Sin %arg0 : f32
+ // CHECK: {{%.*}} = spv.GLSL.Tan {{%.*}} : f32
+ %5 = spv.GLSL.Tan %arg0 : f32
spv.Return
}
}
Index: mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td
===================================================================
--- mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td
+++ mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td
@@ -233,6 +233,38 @@
// -----
+def SPV_GLSLTanOp : SPV_GLSLUnaryArithmeticOp<"Tan", 15, SPV_Float16or32> {
+ let summary = "Tangent of operand in radians";
+
+ let description = [{
+ The standard trigonometric tangent of x radians.
+
+ The operand x must be a scalar or vector whose component type is 16-bit or
+ 32-bit floating-point.
+
+ Result Type and the type of x must be the same type. Results are computed
+ per component.
+
+ <!-- End of AutoGen section -->
+ ```
+ restricted-float-scalar-type ::= `f16` | `f32`
+ restricted-float-scalar-vector-type ::=
+ restricted-float-scalar-type |
+ `vector<` integer-literal `x` restricted-float-scalar-type `>`
+ tan-op ::= ssa-id `=` `spv.GLSL.Tan` ssa-use `:`
+ restricted-float-scalar-vector-type
+ ```
+ #### Example:
+
+ ```mlir
+ %2 = spv.GLSL.Tan %0 : f32
+ %3 = spv.GLSL.Tan %1 : vector<3xf16>
+ ```
+ }];
+}
+
+// -----
+
def SPV_GLSLExpOp : SPV_GLSLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> {
let summary = "Exponentiation of Operand 1";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80152.264882.patch
Type: text/x-patch
Size: 2536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/f1ebf89c/attachment.bin>
More information about the llvm-commits
mailing list