[spirv] Adding sqrt op in the GLSL extension.

PiperOrigin-RevId: 283769736
Change-Id: Idf156efd2c223488ba3a4e63ad04c393cde443bc
This commit is contained in:
Scott Todd 2019-12-04 09:15:49 -08:00 committed by TensorFlower Gardener
parent 45dc6b7be1
commit 256811da7e

View File

@ -516,6 +516,36 @@ def SPV_GLSLSSignOp : SPV_GLSLUnaryArithmeticOp<"SSign", 7, SPV_Integer> {
// -----
def SPV_GLSLSqrtOp : SPV_GLSLUnaryArithmeticOp<"Sqrt", 31, SPV_Float> {
let summary = "Returns the square root of the operand";
let description = [{
Result is the square root of x. Result is undefined if x < 0.
The operand x must be a scalar or vector whose component type is
floating-point.
Result Type and the type of x must be the same type. Results are computed
per component.
### Custom assembly format
``` {.ebnf}
float-scalar-vector-type ::= float-type |
`vector<` integer-literal `x` float-type `>`
sqrt-op ::= ssa-id `=` `spv.GLSL.Sqrt` ssa-use `:`
float-scalar-vector-type
```
For example:
```
%2 = spv.GLSL.Sqrt %0 : f32
%3 = spv.GLSL.Sqrt %1 : vector<3xf16>
```
}];
}
// -----
def SPV_GLSLTanhOp : SPV_GLSLUnaryArithmeticOp<"Tanh", 21, SPV_Float16or32> {
let summary = "Hyperbolic tangent of operand in radians";