forked from OSchip/llvm-project
[mlir][spirv] Rename spv.GLSL ops to spv.GL. NFC.
This is to improve consistency within the SPIR-V dialect and make these ops a bit shorter. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D130280
This commit is contained in:
parent
448220a884
commit
52b630da02
|
@ -79,7 +79,7 @@ The SPIR-V dialect adopts the following conventions for IR:
|
|||
* The prefix for all SPIR-V types and operations are `spv.`.
|
||||
* All instructions in an extended instruction set are further qualified with
|
||||
the extended instruction set's prefix. For example, all operations in the
|
||||
GLSL extended instruction set have the prefix of `spv.GLSL.`.
|
||||
GLSL extended instruction set have the prefix of `spv.GL.`.
|
||||
* Ops that directly mirror instructions in the specification have `CamelCase`
|
||||
names that are the same as the instruction opnames (without the `Op`
|
||||
prefix). For example, `spv.FMul` is a direct mirror of `OpFMul` in the
|
||||
|
@ -508,8 +508,8 @@ proper name prefix. For example, for
|
|||
we can have
|
||||
|
||||
```mlir
|
||||
%1 = "spv.GLSL.Log"(%cst) : (f32) -> (f32)
|
||||
%2 = "spv.GLSL.Sqrt"(%cst) : (f32) -> (f32)
|
||||
%1 = "spv.GL.Log"(%cst) : (f32) -> (f32)
|
||||
%2 = "spv.GL.Sqrt"(%cst) : (f32) -> (f32)
|
||||
```
|
||||
|
||||
## Control Flow
|
||||
|
|
|
@ -630,14 +630,14 @@ As well as:
|
|||
* spv.ControlBarrier
|
||||
* spv.CopyMemory
|
||||
* spv.FMod
|
||||
* spv.GLSL.Acos
|
||||
* spv.GLSL.Asin
|
||||
* spv.GLSL.Atan
|
||||
* spv.GLSL.Cosh
|
||||
* spv.GLSL.FSign
|
||||
* spv.GLSL.SAbs
|
||||
* spv.GLSL.Sinh
|
||||
* spv.GLSL.SSign
|
||||
* spv.GL.Acos
|
||||
* spv.GL.Asin
|
||||
* spv.GL.Atan
|
||||
* spv.GL.Cosh
|
||||
* spv.GL.FSign
|
||||
* spv.GL.SAbs
|
||||
* spv.GL.Sinh
|
||||
* spv.GL.SSign
|
||||
* spv.MemoryBarrier
|
||||
* spv.mlir.referenceof
|
||||
* spv.SMod
|
||||
|
@ -730,18 +730,18 @@ mapped to LLVM Dialect.
|
|||
|
||||
SPIR-V Dialect op | LLVM Dialect op
|
||||
:---------------: | :----------------:
|
||||
`spv.GLSL.Ceil` | `llvm.intr.ceil`
|
||||
`spv.GLSL.Cos` | `llvm.intr.cos`
|
||||
`spv.GLSL.Exp` | `llvm.intr.exp`
|
||||
`spv.GLSL.FAbs` | `llvm.intr.fabs`
|
||||
`spv.GLSL.Floor` | `llvm.intr.floor`
|
||||
`spv.GLSL.FMax` | `llvm.intr.maxnum`
|
||||
`spv.GLSL.FMin` | `llvm.intr.minnum`
|
||||
`spv.GLSL.Log` | `llvm.intr.log`
|
||||
`spv.GLSL.Sin` | `llvm.intr.sin`
|
||||
`spv.GLSL.Sqrt` | `llvm.intr.sqrt`
|
||||
`spv.GLSL.SMax` | `llvm.intr.smax`
|
||||
`spv.GLSL.SMin` | `llvm.intr.smin`
|
||||
`spv.GL.Ceil` | `llvm.intr.ceil`
|
||||
`spv.GL.Cos` | `llvm.intr.cos`
|
||||
`spv.GL.Exp` | `llvm.intr.exp`
|
||||
`spv.GL.FAbs` | `llvm.intr.fabs`
|
||||
`spv.GL.Floor` | `llvm.intr.floor`
|
||||
`spv.GL.FMax` | `llvm.intr.maxnum`
|
||||
`spv.GL.FMin` | `llvm.intr.minnum`
|
||||
`spv.GL.Log` | `llvm.intr.log`
|
||||
`spv.GL.Sin` | `llvm.intr.sin`
|
||||
`spv.GL.Sqrt` | `llvm.intr.sqrt`
|
||||
`spv.GL.SMax` | `llvm.intr.smax`
|
||||
`spv.GL.SMin` | `llvm.intr.smin`
|
||||
|
||||
### Special cases
|
||||
|
||||
|
|
|
@ -2080,12 +2080,12 @@ def SPV_D_MatrixStride : I32EnumAttrCase<"MatrixStride", 7
|
|||
Capability<[SPV_C_Matrix]>
|
||||
];
|
||||
}
|
||||
def SPV_D_GLSLShared : I32EnumAttrCase<"GLSLShared", 8> {
|
||||
def SPV_D_GLShared : I32EnumAttrCase<"GLShared", 8> {
|
||||
list<Availability> availability = [
|
||||
Capability<[SPV_C_Shader]>
|
||||
];
|
||||
}
|
||||
def SPV_D_GLSLPacked : I32EnumAttrCase<"GLSLPacked", 9> {
|
||||
def SPV_D_GLPacked : I32EnumAttrCase<"GLPacked", 9> {
|
||||
list<Availability> availability = [
|
||||
Capability<[SPV_C_Shader]>
|
||||
];
|
||||
|
@ -2550,7 +2550,7 @@ def SPV_DecorationAttr :
|
|||
SPV_I32EnumAttr<"Decoration", "valid SPIR-V Decoration", [
|
||||
SPV_D_RelaxedPrecision, SPV_D_SpecId, SPV_D_Block, SPV_D_BufferBlock,
|
||||
SPV_D_RowMajor, SPV_D_ColMajor, SPV_D_ArrayStride, SPV_D_MatrixStride,
|
||||
SPV_D_GLSLShared, SPV_D_GLSLPacked, SPV_D_CPacked, SPV_D_BuiltIn,
|
||||
SPV_D_GLShared, SPV_D_GLPacked, SPV_D_CPacked, SPV_D_BuiltIn,
|
||||
SPV_D_NoPerspective, SPV_D_Flat, SPV_D_Patch, SPV_D_Centroid, SPV_D_Sample,
|
||||
SPV_D_Invariant, SPV_D_Restrict, SPV_D_Aliased, SPV_D_Volatile, SPV_D_Constant,
|
||||
SPV_D_Coherent, SPV_D_NonWritable, SPV_D_NonReadable, SPV_D_Uniform,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===- SPIRVGLSLCanonicalization.h - GLSL-specific patterns -----*- C++ -*-===//
|
||||
//===- SPIRVGLCanonicalization.h - GLSL-specific patterns -----*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
|
@ -11,8 +11,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_DIALECT_SPIRV_IR_SPIRVGLSLCANONICALIZATION_H_
|
||||
#define MLIR_DIALECT_SPIRV_IR_SPIRVGLSLCANONICALIZATION_H_
|
||||
#ifndef MLIR_DIALECT_SPIRV_IR_SPIRVGLCANONICALIZATION_H_
|
||||
#define MLIR_DIALECT_SPIRV_IR_SPIRVGLCANONICALIZATION_H_
|
||||
|
||||
#include "mlir/IR/MLIRContext.h"
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
|
@ -23,12 +23,12 @@
|
|||
|
||||
namespace mlir {
|
||||
namespace spirv {
|
||||
/// Populates patterns to run canoncalization that involves GLSL ops.
|
||||
/// Populates patterns to run canoncalization that involves GL ops.
|
||||
///
|
||||
/// These patterns cannot be run in default canonicalization because GLSL ops
|
||||
/// These patterns cannot be run in default canonicalization because GL ops
|
||||
/// aren't always available. So they should be involed specifically when needed.
|
||||
void populateSPIRVGLSLCanonicalizationPatterns(RewritePatternSet &results);
|
||||
void populateSPIRVGLCanonicalizationPatterns(RewritePatternSet &results);
|
||||
} // namespace spirv
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_SPIRVGLSLCANONICALIZATION_H_
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_SPIRVGLCANONICALIZATION_H_
|
|
@ -1,4 +1,4 @@
|
|||
//===- SPIRVGLSLOps.td - GLSL extended insts spec file -----*- tablegen -*-===//
|
||||
//===- SPIRVGLOps.td - GLSL extended insts spec file -----*- tablegen -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
#define MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
#ifndef MLIR_DIALECT_SPIRV_IR_GL_OPS
|
||||
#define MLIR_DIALECT_SPIRV_IR_GL_OPS
|
||||
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
|
||||
include "mlir/Interfaces/SideEffectInterfaces.td"
|
||||
|
@ -20,9 +20,9 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
|
|||
// SPIR-V GLSL 4.50 opcode specification.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Base class for all GLSL ops.
|
||||
class SPV_GLSLOp<string mnemonic, int opcode, list<Trait> traits = []> :
|
||||
SPV_ExtInstOp<mnemonic, "GLSL", "GLSL.std.450", opcode, traits> {
|
||||
// Base class for all GL ops.
|
||||
class SPV_GLOp<string mnemonic, int opcode, list<Trait> traits = []> :
|
||||
SPV_ExtInstOp<mnemonic, "GL", "GLSL.std.450", opcode, traits> {
|
||||
|
||||
let availability = [
|
||||
MinVersion<SPV_V_1_0>,
|
||||
|
@ -32,10 +32,10 @@ class SPV_GLSLOp<string mnemonic, int opcode, list<Trait> traits = []> :
|
|||
];
|
||||
}
|
||||
|
||||
// Base class for GLSL unary ops.
|
||||
class SPV_GLSLUnaryOp<string mnemonic, int opcode, Type resultType,
|
||||
// Base class for GL unary ops.
|
||||
class SPV_GLUnaryOp<string mnemonic, int opcode, Type resultType,
|
||||
Type operandType, list<Trait> traits = []> :
|
||||
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
SPV_GLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
|
||||
let arguments = (ins
|
||||
SPV_ScalarOrVectorOf<operandType>:$operand
|
||||
|
@ -48,19 +48,19 @@ class SPV_GLSLUnaryOp<string mnemonic, int opcode, Type resultType,
|
|||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for GLSL Unary arithmetic ops where return type matches
|
||||
// Base class for GL Unary arithmetic ops where return type matches
|
||||
// the operand type.
|
||||
class SPV_GLSLUnaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
class SPV_GLUnaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
list<Trait> traits = []> :
|
||||
SPV_GLSLUnaryOp<mnemonic, opcode, type, type,
|
||||
SPV_GLUnaryOp<mnemonic, opcode, type, type,
|
||||
traits # [SameOperandsAndResultType]> {
|
||||
let assemblyFormat = "$operand `:` type($operand) attr-dict";
|
||||
}
|
||||
|
||||
// Base class for GLSL binary ops.
|
||||
class SPV_GLSLBinaryOp<string mnemonic, int opcode, Type resultType,
|
||||
// Base class for GL binary ops.
|
||||
class SPV_GLBinaryOp<string mnemonic, int opcode, Type resultType,
|
||||
Type operandType, list<Trait> traits = []> :
|
||||
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
SPV_GLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
|
||||
let arguments = (ins
|
||||
SPV_ScalarOrVectorOf<operandType>:$lhs,
|
||||
|
@ -74,19 +74,19 @@ class SPV_GLSLBinaryOp<string mnemonic, int opcode, Type resultType,
|
|||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
// Base class for GLSL Binary arithmetic ops where operand types and
|
||||
// Base class for GL Binary arithmetic ops where operand types and
|
||||
// return type matches.
|
||||
class SPV_GLSLBinaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
class SPV_GLBinaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
list<Trait> traits = []> :
|
||||
SPV_GLSLBinaryOp<mnemonic, opcode, type, type,
|
||||
SPV_GLBinaryOp<mnemonic, opcode, type, type,
|
||||
traits # [SameOperandsAndResultType]> {
|
||||
let assemblyFormat = "operands attr-dict `:` type($result)";
|
||||
}
|
||||
|
||||
// Base class for GLSL ternary ops.
|
||||
class SPV_GLSLTernaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
// Base class for GL ternary ops.
|
||||
class SPV_GLTernaryArithmeticOp<string mnemonic, int opcode, Type type,
|
||||
list<Trait> traits = []> :
|
||||
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
SPV_GLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
|
||||
|
||||
let arguments = (ins
|
||||
SPV_ScalarOrVectorOf<type>:$x,
|
||||
|
@ -104,7 +104,7 @@ class SPV_GLSLTernaryArithmeticOp<string mnemonic, int opcode, Type type,
|
|||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFAbsOp : SPV_GLSLUnaryArithmeticOp<"FAbs", 4, SPV_Float> {
|
||||
def SPV_GLFAbsOp : SPV_GLUnaryArithmeticOp<"FAbs", 4, SPV_Float> {
|
||||
let summary = "Absolute value of operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -120,21 +120,21 @@ def SPV_GLSLFAbsOp : SPV_GLSLUnaryArithmeticOp<"FAbs", 4, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
abs-op ::= ssa-id `=` `spv.GLSL.FAbs` ssa-use `:`
|
||||
abs-op ::= ssa-id `=` `spv.GL.FAbs` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FAbs %0 : f32
|
||||
%3 = spv.GLSL.FAbs %1 : vector<3xf16>
|
||||
%2 = spv.GL.FAbs %0 : f32
|
||||
%3 = spv.GL.FAbs %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSAbsOp : SPV_GLSLUnaryArithmeticOp<"SAbs", 5, SPV_Integer> {
|
||||
def SPV_GLSAbsOp : SPV_GLUnaryArithmeticOp<"SAbs", 5, SPV_Integer> {
|
||||
let summary = "Absolute value of operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -149,21 +149,21 @@ def SPV_GLSLSAbsOp : SPV_GLSLUnaryArithmeticOp<"SAbs", 5, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
abs-op ::= ssa-id `=` `spv.GLSL.SAbs` ssa-use `:`
|
||||
abs-op ::= ssa-id `=` `spv.GL.SAbs` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.SAbs %0 : i32
|
||||
%3 = spv.GLSL.SAbs %1 : vector<3xi16>
|
||||
%2 = spv.GL.SAbs %0 : i32
|
||||
%3 = spv.GL.SAbs %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLCeilOp : SPV_GLSLUnaryArithmeticOp<"Ceil", 9, SPV_Float> {
|
||||
def SPV_GLCeilOp : SPV_GLUnaryArithmeticOp<"Ceil", 9, SPV_Float> {
|
||||
let summary = "Rounds up to the next whole number";
|
||||
|
||||
let description = [{
|
||||
|
@ -180,21 +180,21 @@ def SPV_GLSLCeilOp : SPV_GLSLUnaryArithmeticOp<"Ceil", 9, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
ceil-op ::= ssa-id `=` `spv.GLSL.Ceil` ssa-use `:`
|
||||
ceil-op ::= ssa-id `=` `spv.GL.Ceil` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Ceil %0 : f32
|
||||
%3 = spv.GLSL.Ceil %1 : vector<3xf16>
|
||||
%2 = spv.GL.Ceil %0 : f32
|
||||
%3 = spv.GL.Ceil %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLCosOp : SPV_GLSLUnaryArithmeticOp<"Cos", 14, SPV_Float16or32> {
|
||||
def SPV_GLCosOp : SPV_GLUnaryArithmeticOp<"Cos", 14, SPV_Float16or32> {
|
||||
let summary = "Cosine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -212,21 +212,21 @@ def SPV_GLSLCosOp : SPV_GLSLUnaryArithmeticOp<"Cos", 14, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
cos-op ::= ssa-id `=` `spv.GLSL.Cos` ssa-use `:`
|
||||
cos-op ::= ssa-id `=` `spv.GL.Cos` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Cos %0 : f32
|
||||
%3 = spv.GLSL.Cos %1 : vector<3xf16>
|
||||
%2 = spv.GL.Cos %0 : f32
|
||||
%3 = spv.GL.Cos %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSinOp : SPV_GLSLUnaryArithmeticOp<"Sin", 13, SPV_Float16or32> {
|
||||
def SPV_GLSinOp : SPV_GLUnaryArithmeticOp<"Sin", 13, SPV_Float16or32> {
|
||||
let summary = "Sine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -244,21 +244,21 @@ def SPV_GLSLSinOp : SPV_GLSLUnaryArithmeticOp<"Sin", 13, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
sin-op ::= ssa-id `=` `spv.GLSL.Sin` ssa-use `:`
|
||||
sin-op ::= ssa-id `=` `spv.GL.Sin` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Sin %0 : f32
|
||||
%3 = spv.GLSL.Sin %1 : vector<3xf16>
|
||||
%2 = spv.GL.Sin %0 : f32
|
||||
%3 = spv.GL.Sin %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLTanOp : SPV_GLSLUnaryArithmeticOp<"Tan", 15, SPV_Float16or32> {
|
||||
def SPV_GLTanOp : SPV_GLUnaryArithmeticOp<"Tan", 15, SPV_Float16or32> {
|
||||
let summary = "Tangent of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -276,21 +276,21 @@ def SPV_GLSLTanOp : SPV_GLSLUnaryArithmeticOp<"Tan", 15, SPV_Float16or32> {
|
|||
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 `:`
|
||||
tan-op ::= ssa-id `=` `spv.GL.Tan` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Tan %0 : f32
|
||||
%3 = spv.GLSL.Tan %1 : vector<3xf16>
|
||||
%2 = spv.GL.Tan %0 : f32
|
||||
%3 = spv.GL.Tan %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLAsinOp : SPV_GLSLUnaryArithmeticOp<"Asin", 16, SPV_Float16or32> {
|
||||
def SPV_GLAsinOp : SPV_GLUnaryArithmeticOp<"Asin", 16, SPV_Float16or32> {
|
||||
let summary = "Arc Sine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -310,21 +310,21 @@ def SPV_GLSLAsinOp : SPV_GLSLUnaryArithmeticOp<"Asin", 16, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
asin-op ::= ssa-id `=` `spv.GLSL.Asin` ssa-use `:`
|
||||
asin-op ::= ssa-id `=` `spv.GL.Asin` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Asin %0 : f32
|
||||
%3 = spv.GLSL.Asin %1 : vector<3xf16>
|
||||
%2 = spv.GL.Asin %0 : f32
|
||||
%3 = spv.GL.Asin %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLAcosOp : SPV_GLSLUnaryArithmeticOp<"Acos", 17, SPV_Float16or32> {
|
||||
def SPV_GLAcosOp : SPV_GLUnaryArithmeticOp<"Acos", 17, SPV_Float16or32> {
|
||||
let summary = "Arc Cosine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -344,21 +344,21 @@ def SPV_GLSLAcosOp : SPV_GLSLUnaryArithmeticOp<"Acos", 17, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
acos-op ::= ssa-id `=` `spv.GLSL.Acos` ssa-use `:`
|
||||
acos-op ::= ssa-id `=` `spv.GL.Acos` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Acos %0 : f32
|
||||
%3 = spv.GLSL.Acos %1 : vector<3xf16>
|
||||
%2 = spv.GL.Acos %0 : f32
|
||||
%3 = spv.GL.Acos %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLAtanOp : SPV_GLSLUnaryArithmeticOp<"Atan", 18, SPV_Float16or32> {
|
||||
def SPV_GLAtanOp : SPV_GLUnaryArithmeticOp<"Atan", 18, SPV_Float16or32> {
|
||||
let summary = "Arc Tangent of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -378,21 +378,21 @@ def SPV_GLSLAtanOp : SPV_GLSLUnaryArithmeticOp<"Atan", 18, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
atan-op ::= ssa-id `=` `spv.GLSL.Atan` ssa-use `:`
|
||||
atan-op ::= ssa-id `=` `spv.GL.Atan` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Atan %0 : f32
|
||||
%3 = spv.GLSL.Atan %1 : vector<3xf16>
|
||||
%2 = spv.GL.Atan %0 : f32
|
||||
%3 = spv.GL.Atan %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLExpOp : SPV_GLSLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> {
|
||||
def SPV_GLExpOp : SPV_GLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> {
|
||||
let summary = "Exponentiation of Operand 1";
|
||||
|
||||
let description = [{
|
||||
|
@ -410,21 +410,21 @@ def SPV_GLSLExpOp : SPV_GLSLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
exp-op ::= ssa-id `=` `spv.GLSL.Exp` ssa-use `:`
|
||||
exp-op ::= ssa-id `=` `spv.GL.Exp` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Exp %0 : f32
|
||||
%3 = spv.GLSL.Exp %1 : vector<3xf16>
|
||||
%2 = spv.GL.Exp %0 : f32
|
||||
%3 = spv.GL.Exp %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFloorOp : SPV_GLSLUnaryArithmeticOp<"Floor", 8, SPV_Float> {
|
||||
def SPV_GLFloorOp : SPV_GLUnaryArithmeticOp<"Floor", 8, SPV_Float> {
|
||||
let summary = "Rounds down to the next whole number";
|
||||
|
||||
let description = [{
|
||||
|
@ -441,21 +441,21 @@ def SPV_GLSLFloorOp : SPV_GLSLUnaryArithmeticOp<"Floor", 8, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
floor-op ::= ssa-id `=` `spv.GLSL.Floor` ssa-use `:`
|
||||
floor-op ::= ssa-id `=` `spv.GL.Floor` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Floor %0 : f32
|
||||
%3 = spv.GLSL.Floor %1 : vector<3xf16>
|
||||
%2 = spv.GL.Floor %0 : f32
|
||||
%3 = spv.GL.Floor %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLRoundOp: SPV_GLSLUnaryArithmeticOp<"Round", 1, SPV_Float> {
|
||||
def SPV_GLRoundOp: SPV_GLUnaryArithmeticOp<"Round", 1, SPV_Float> {
|
||||
let summary = "Rounds to the whole number";
|
||||
|
||||
let description = [{
|
||||
|
@ -471,21 +471,21 @@ def SPV_GLSLRoundOp: SPV_GLSLUnaryArithmeticOp<"Round", 1, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
floor-op ::= ssa-id `=` `spv.GLSL.Round` ssa-use `:`
|
||||
floor-op ::= ssa-id `=` `spv.GL.Round` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Round %0 : f32
|
||||
%3 = spv.GLSL.Round %1 : vector<3xf16>
|
||||
%2 = spv.GL.Round %0 : f32
|
||||
%3 = spv.GL.Round %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLInverseSqrtOp : SPV_GLSLUnaryArithmeticOp<"InverseSqrt", 32, SPV_Float> {
|
||||
def SPV_GLInverseSqrtOp : SPV_GLUnaryArithmeticOp<"InverseSqrt", 32, SPV_Float> {
|
||||
let summary = "Reciprocal of sqrt(operand)";
|
||||
|
||||
let description = [{
|
||||
|
@ -501,21 +501,21 @@ def SPV_GLSLInverseSqrtOp : SPV_GLSLUnaryArithmeticOp<"InverseSqrt", 32, SPV_Flo
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
rsqrt-op ::= ssa-id `=` `spv.GLSL.InverseSqrt` ssa-use `:`
|
||||
rsqrt-op ::= ssa-id `=` `spv.GL.InverseSqrt` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.InverseSqrt %0 : f32
|
||||
%3 = spv.GLSL.InverseSqrt %1 : vector<3xf16>
|
||||
%2 = spv.GL.InverseSqrt %0 : f32
|
||||
%3 = spv.GL.InverseSqrt %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLLogOp : SPV_GLSLUnaryArithmeticOp<"Log", 28, SPV_Float16or32> {
|
||||
def SPV_GLLogOp : SPV_GLUnaryArithmeticOp<"Log", 28, SPV_Float16or32> {
|
||||
let summary = "Natural logarithm of the operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -534,21 +534,21 @@ def SPV_GLSLLogOp : SPV_GLSLUnaryArithmeticOp<"Log", 28, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
log-op ::= ssa-id `=` `spv.GLSL.Log` ssa-use `:`
|
||||
log-op ::= ssa-id `=` `spv.GL.Log` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Log %0 : f32
|
||||
%3 = spv.GLSL.Log %1 : vector<3xf16>
|
||||
%2 = spv.GL.Log %0 : f32
|
||||
%3 = spv.GL.Log %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFMaxOp : SPV_GLSLBinaryArithmeticOp<"FMax", 40, SPV_Float> {
|
||||
def SPV_GLFMaxOp : SPV_GLBinaryArithmeticOp<"FMax", 40, SPV_Float> {
|
||||
let summary = "Return maximum of two floating-point operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -565,21 +565,21 @@ def SPV_GLSLFMaxOp : SPV_GLSLBinaryArithmeticOp<"FMax", 40, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
fmax-op ::= ssa-id `=` `spv.GLSL.FMax` ssa-use `:`
|
||||
fmax-op ::= ssa-id `=` `spv.GL.FMax` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FMax %0, %1 : f32
|
||||
%3 = spv.GLSL.FMax %0, %1 : vector<3xf16>
|
||||
%2 = spv.GL.FMax %0, %1 : f32
|
||||
%3 = spv.GL.FMax %0, %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLUMaxOp : SPV_GLSLBinaryArithmeticOp<"UMax", 41, SPV_Integer> {
|
||||
def SPV_GLUMaxOp : SPV_GLBinaryArithmeticOp<"UMax", 41, SPV_Integer> {
|
||||
let summary = "Return maximum of two unsigned integer operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -595,21 +595,21 @@ def SPV_GLSLUMaxOp : SPV_GLSLBinaryArithmeticOp<"UMax", 41, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
smax-op ::= ssa-id `=` `spv.GLSL.UMax` ssa-use `:`
|
||||
smax-op ::= ssa-id `=` `spv.GL.UMax` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.UMax %0, %1 : i32
|
||||
%3 = spv.GLSL.UMax %0, %1 : vector<3xi16>
|
||||
%2 = spv.GL.UMax %0, %1 : i32
|
||||
%3 = spv.GL.UMax %0, %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSMaxOp : SPV_GLSLBinaryArithmeticOp<"SMax", 42, SPV_Integer> {
|
||||
def SPV_GLSMaxOp : SPV_GLBinaryArithmeticOp<"SMax", 42, SPV_Integer> {
|
||||
let summary = "Return maximum of two signed integer operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -625,21 +625,21 @@ def SPV_GLSLSMaxOp : SPV_GLSLBinaryArithmeticOp<"SMax", 42, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
smax-op ::= ssa-id `=` `spv.GLSL.SMax` ssa-use `:`
|
||||
smax-op ::= ssa-id `=` `spv.GL.SMax` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.SMax %0, %1 : i32
|
||||
%3 = spv.GLSL.SMax %0, %1 : vector<3xi16>
|
||||
%2 = spv.GL.SMax %0, %1 : i32
|
||||
%3 = spv.GL.SMax %0, %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFMinOp : SPV_GLSLBinaryArithmeticOp<"FMin", 37, SPV_Float> {
|
||||
def SPV_GLFMinOp : SPV_GLBinaryArithmeticOp<"FMin", 37, SPV_Float> {
|
||||
let summary = "Return minimum of two floating-point operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -656,21 +656,21 @@ def SPV_GLSLFMinOp : SPV_GLSLBinaryArithmeticOp<"FMin", 37, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
fmin-op ::= ssa-id `=` `spv.GLSL.FMin` ssa-use `:`
|
||||
fmin-op ::= ssa-id `=` `spv.GL.FMin` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FMin %0, %1 : f32
|
||||
%3 = spv.GLSL.FMin %0, %1 : vector<3xf16>
|
||||
%2 = spv.GL.FMin %0, %1 : f32
|
||||
%3 = spv.GL.FMin %0, %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLUMinOp : SPV_GLSLBinaryArithmeticOp<"UMin", 38, SPV_Integer> {
|
||||
def SPV_GLUMinOp : SPV_GLBinaryArithmeticOp<"UMin", 38, SPV_Integer> {
|
||||
let summary = "Return minimum of two unsigned integer operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -686,21 +686,21 @@ def SPV_GLSLUMinOp : SPV_GLSLBinaryArithmeticOp<"UMin", 38, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
smin-op ::= ssa-id `=` `spv.GLSL.UMin` ssa-use `:`
|
||||
smin-op ::= ssa-id `=` `spv.GL.UMin` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.UMin %0, %1 : i32
|
||||
%3 = spv.GLSL.UMin %0, %1 : vector<3xi16>
|
||||
%2 = spv.GL.UMin %0, %1 : i32
|
||||
%3 = spv.GL.UMin %0, %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSMinOp : SPV_GLSLBinaryArithmeticOp<"SMin", 39, SPV_Integer> {
|
||||
def SPV_GLSMinOp : SPV_GLBinaryArithmeticOp<"SMin", 39, SPV_Integer> {
|
||||
let summary = "Return minimum of two signed integer operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -716,21 +716,21 @@ def SPV_GLSLSMinOp : SPV_GLSLBinaryArithmeticOp<"SMin", 39, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
smin-op ::= ssa-id `=` `spv.GLSL.SMin` ssa-use `:`
|
||||
smin-op ::= ssa-id `=` `spv.GL.SMin` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.SMin %0, %1 : i32
|
||||
%3 = spv.GLSL.SMin %0, %1 : vector<3xi16>
|
||||
%2 = spv.GL.SMin %0, %1 : i32
|
||||
%3 = spv.GL.SMin %0, %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLPowOp : SPV_GLSLBinaryArithmeticOp<"Pow", 26, SPV_Float16or32> {
|
||||
def SPV_GLPowOp : SPV_GLBinaryArithmeticOp<"Pow", 26, SPV_Float16or32> {
|
||||
let summary = "Return x raised to the y power of two operands";
|
||||
|
||||
let description = [{
|
||||
|
@ -750,21 +750,21 @@ def SPV_GLSLPowOp : SPV_GLSLBinaryArithmeticOp<"Pow", 26, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
pow-op ::= ssa-id `=` `spv.GLSL.Pow` ssa-use `:`
|
||||
pow-op ::= ssa-id `=` `spv.GL.Pow` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Pow %0, %1 : f32
|
||||
%3 = spv.GLSL.Pow %0, %1 : vector<3xf16>
|
||||
%2 = spv.GL.Pow %0, %1 : f32
|
||||
%3 = spv.GL.Pow %0, %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFSignOp : SPV_GLSLUnaryArithmeticOp<"FSign", 6, SPV_Float> {
|
||||
def SPV_GLFSignOp : SPV_GLUnaryArithmeticOp<"FSign", 6, SPV_Float> {
|
||||
let summary = "Returns the sign of the operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -780,21 +780,21 @@ def SPV_GLSLFSignOp : SPV_GLSLUnaryArithmeticOp<"FSign", 6, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
sign-op ::= ssa-id `=` `spv.GLSL.FSign` ssa-use `:`
|
||||
sign-op ::= ssa-id `=` `spv.GL.FSign` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FSign %0 : f32
|
||||
%3 = spv.GLSL.FSign %1 : vector<3xf16>
|
||||
%2 = spv.GL.FSign %0 : f32
|
||||
%3 = spv.GL.FSign %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSSignOp : SPV_GLSLUnaryArithmeticOp<"SSign", 7, SPV_Integer> {
|
||||
def SPV_GLSSignOp : SPV_GLUnaryArithmeticOp<"SSign", 7, SPV_Integer> {
|
||||
let summary = "Returns the sign of the operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -809,21 +809,21 @@ def SPV_GLSLSSignOp : SPV_GLSLUnaryArithmeticOp<"SSign", 7, SPV_Integer> {
|
|||
```
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
sign-op ::= ssa-id `=` `spv.GLSL.SSign` ssa-use `:`
|
||||
sign-op ::= ssa-id `=` `spv.GL.SSign` ssa-use `:`
|
||||
integer-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.SSign %0 : i32
|
||||
%3 = spv.GLSL.SSign %1 : vector<3xi16>
|
||||
%2 = spv.GL.SSign %0 : i32
|
||||
%3 = spv.GL.SSign %1 : vector<3xi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSqrtOp : SPV_GLSLUnaryArithmeticOp<"Sqrt", 31, SPV_Float> {
|
||||
def SPV_GLSqrtOp : SPV_GLUnaryArithmeticOp<"Sqrt", 31, SPV_Float> {
|
||||
let summary = "Returns the square root of the operand";
|
||||
|
||||
let description = [{
|
||||
|
@ -839,21 +839,21 @@ def SPV_GLSLSqrtOp : SPV_GLSLUnaryArithmeticOp<"Sqrt", 31, SPV_Float> {
|
|||
```
|
||||
float-scalar-vector-type ::= float-type |
|
||||
`vector<` integer-literal `x` float-type `>`
|
||||
sqrt-op ::= ssa-id `=` `spv.GLSL.Sqrt` ssa-use `:`
|
||||
sqrt-op ::= ssa-id `=` `spv.GL.Sqrt` ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Sqrt %0 : f32
|
||||
%3 = spv.GLSL.Sqrt %1 : vector<3xf16>
|
||||
%2 = spv.GL.Sqrt %0 : f32
|
||||
%3 = spv.GL.Sqrt %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSinhOp : SPV_GLSLUnaryArithmeticOp<"Sinh", 19, SPV_Float16or32> {
|
||||
def SPV_GLSinhOp : SPV_GLUnaryArithmeticOp<"Sinh", 19, SPV_Float16or32> {
|
||||
let summary = "Hyperbolic sine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -871,21 +871,21 @@ def SPV_GLSLSinhOp : SPV_GLSLUnaryArithmeticOp<"Sinh", 19, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
sinh-op ::= ssa-id `=` `spv.GLSL.Sinh` ssa-use `:`
|
||||
sinh-op ::= ssa-id `=` `spv.GL.Sinh` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Sinh %0 : f32
|
||||
%3 = spv.GLSL.Sinh %1 : vector<3xf16>
|
||||
%2 = spv.GL.Sinh %0 : f32
|
||||
%3 = spv.GL.Sinh %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLCoshOp : SPV_GLSLUnaryArithmeticOp<"Cosh", 20, SPV_Float16or32> {
|
||||
def SPV_GLCoshOp : SPV_GLUnaryArithmeticOp<"Cosh", 20, SPV_Float16or32> {
|
||||
let summary = "Hyperbolic cosine of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -903,21 +903,21 @@ def SPV_GLSLCoshOp : SPV_GLSLUnaryArithmeticOp<"Cosh", 20, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
cosh-op ::= ssa-id `=` `spv.GLSL.Cosh` ssa-use `:`
|
||||
cosh-op ::= ssa-id `=` `spv.GL.Cosh` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Cosh %0 : f32
|
||||
%3 = spv.GLSL.Cosh %1 : vector<3xf16>
|
||||
%2 = spv.GL.Cosh %0 : f32
|
||||
%3 = spv.GL.Cosh %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLTanhOp : SPV_GLSLUnaryArithmeticOp<"Tanh", 21, SPV_Float16or32> {
|
||||
def SPV_GLTanhOp : SPV_GLUnaryArithmeticOp<"Tanh", 21, SPV_Float16or32> {
|
||||
let summary = "Hyperbolic tangent of operand in radians";
|
||||
|
||||
let description = [{
|
||||
|
@ -935,21 +935,21 @@ def SPV_GLSLTanhOp : SPV_GLSLUnaryArithmeticOp<"Tanh", 21, SPV_Float16or32> {
|
|||
restricted-float-scalar-vector-type ::=
|
||||
restricted-float-scalar-type |
|
||||
`vector<` integer-literal `x` restricted-float-scalar-type `>`
|
||||
tanh-op ::= ssa-id `=` `spv.GLSL.Tanh` ssa-use `:`
|
||||
tanh-op ::= ssa-id `=` `spv.GL.Tanh` ssa-use `:`
|
||||
restricted-float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.Tanh %0 : f32
|
||||
%3 = spv.GLSL.Tanh %1 : vector<3xf16>
|
||||
%2 = spv.GL.Tanh %0 : f32
|
||||
%3 = spv.GL.Tanh %1 : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFClampOp : SPV_GLSLTernaryArithmeticOp<"FClamp", 43, SPV_Float> {
|
||||
def SPV_GLFClampOp : SPV_GLTernaryArithmeticOp<"FClamp", 43, SPV_Float> {
|
||||
let summary = "Clamp x between min and max values.";
|
||||
|
||||
let description = [{
|
||||
|
@ -965,21 +965,21 @@ def SPV_GLSLFClampOp : SPV_GLSLTernaryArithmeticOp<"FClamp", 43, SPV_Float> {
|
|||
|
||||
<!-- End of AutoGen section -->
|
||||
```
|
||||
fclamp-op ::= ssa-id `=` `spv.GLSL.FClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
fclamp-op ::= ssa-id `=` `spv.GL.FClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FClamp %x, %min, %max : f32
|
||||
%3 = spv.GLSL.FClamp %x, %min, %max : vector<3xf16>
|
||||
%2 = spv.GL.FClamp %x, %min, %max : f32
|
||||
%3 = spv.GL.FClamp %x, %min, %max : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLUClampOp : SPV_GLSLTernaryArithmeticOp<"UClamp", 44, SPV_Integer> {
|
||||
def SPV_GLUClampOp : SPV_GLTernaryArithmeticOp<"UClamp", 44, SPV_Integer> {
|
||||
let summary = "Clamp x between min and max values.";
|
||||
|
||||
let description = [{
|
||||
|
@ -994,21 +994,21 @@ def SPV_GLSLUClampOp : SPV_GLSLTernaryArithmeticOp<"UClamp", 44, SPV_Integer> {
|
|||
|
||||
<!-- End of AutoGen section -->
|
||||
```
|
||||
uclamp-op ::= ssa-id `=` `spv.GLSL.UClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
uclamp-op ::= ssa-id `=` `spv.GL.UClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
unsigned-signless-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.UClamp %x, %min, %max : i32
|
||||
%3 = spv.GLSL.UClamp %x, %min, %max : vector<3xui16>
|
||||
%2 = spv.GL.UClamp %x, %min, %max : i32
|
||||
%3 = spv.GL.UClamp %x, %min, %max : vector<3xui16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLSClampOp : SPV_GLSLTernaryArithmeticOp<"SClamp", 45, SPV_Integer> {
|
||||
def SPV_GLSClampOp : SPV_GLTernaryArithmeticOp<"SClamp", 45, SPV_Integer> {
|
||||
let summary = "Clamp x between min and max values.";
|
||||
|
||||
let description = [{
|
||||
|
@ -1023,21 +1023,21 @@ def SPV_GLSLSClampOp : SPV_GLSLTernaryArithmeticOp<"SClamp", 45, SPV_Integer> {
|
|||
|
||||
<!-- End of AutoGen section -->
|
||||
```
|
||||
uclamp-op ::= ssa-id `=` `spv.GLSL.UClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
uclamp-op ::= ssa-id `=` `spv.GL.UClamp` ssa-use, ssa-use, ssa-use `:`
|
||||
sgined-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.SClamp %x, %min, %max : si32
|
||||
%3 = spv.GLSL.SClamp %x, %min, %max : vector<3xsi16>
|
||||
%2 = spv.GL.SClamp %x, %min, %max : si32
|
||||
%3 = spv.GL.SClamp %x, %min, %max : vector<3xsi16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
def SPV_GLSLFmaOp : SPV_GLSLTernaryArithmeticOp<"Fma", 50, SPV_Float> {
|
||||
def SPV_GLFmaOp : SPV_GLTernaryArithmeticOp<"Fma", 50, SPV_Float> {
|
||||
let summary = "Computes a * b + c.";
|
||||
|
||||
let description = [{
|
||||
|
@ -1063,21 +1063,21 @@ def SPV_GLSLFmaOp : SPV_GLSLTernaryArithmeticOp<"Fma", 50, SPV_Float> {
|
|||
|
||||
<!-- End of AutoGen section -->
|
||||
```
|
||||
fma-op ::= ssa-id `=` `spv.GLSL.Fma` ssa-use, ssa-use, ssa-use `:`
|
||||
fma-op ::= ssa-id `=` `spv.GL.Fma` ssa-use, ssa-use, ssa-use `:`
|
||||
float-scalar-vector-type
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%0 = spv.GLSL.Fma %a, %b, %c : f32
|
||||
%1 = spv.GLSL.Fma %a, %b, %c : vector<3xf16>
|
||||
%0 = spv.GL.Fma %a, %b, %c : f32
|
||||
%1 = spv.GL.Fma %a, %b, %c : vector<3xf16>
|
||||
```
|
||||
}];
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
def SPV_GLSLFrexpStructOp : SPV_GLSLOp<"FrexpStruct", 52, [NoSideEffect]> {
|
||||
def SPV_GLFrexpStructOp : SPV_GLOp<"FrexpStruct", 52, [NoSideEffect]> {
|
||||
let summary = "Splits x into two components such that x = significand * 2^exponent";
|
||||
|
||||
let description = [{
|
||||
|
@ -1105,15 +1105,15 @@ def SPV_GLSLFrexpStructOp : SPV_GLSLOp<"FrexpStruct", 52, [NoSideEffect]> {
|
|||
`vector<` integer-literal `x` float-type `>`
|
||||
integer-scalar-vector-type ::= integer-type |
|
||||
`vector<` integer-literal `x` integer-type `>`
|
||||
frexpstruct-op ::= ssa-id `=` `spv.GLSL.FrexpStruct` ssa-use `:`
|
||||
frexpstruct-op ::= ssa-id `=` `spv.GL.FrexpStruct` ssa-use `:`
|
||||
`!spv.struct<` float-scalar-vector-type `,`
|
||||
integer-scalar-vector-type `>`
|
||||
```
|
||||
#### Example:
|
||||
|
||||
```mlir
|
||||
%2 = spv.GLSL.FrexpStruct %0 : f32 -> !spv.struct<f32, i32>
|
||||
%3 = spv.GLSL.FrexpStruct %0 : vector<3xf32> -> !spv.struct<vector<3xf32>, vector<3xi32>>
|
||||
%2 = spv.GL.FrexpStruct %0 : f32 -> !spv.struct<f32, i32>
|
||||
%3 = spv.GL.FrexpStruct %0 : vector<3xf32> -> !spv.struct<vector<3xf32>, vector<3xi32>>
|
||||
```
|
||||
}];
|
||||
|
||||
|
@ -1130,8 +1130,8 @@ def SPV_GLSLFrexpStructOp : SPV_GLSLOp<"FrexpStruct", 52, [NoSideEffect]> {
|
|||
}];
|
||||
}
|
||||
|
||||
def SPV_GLSLLdexpOp :
|
||||
SPV_GLSLOp<"Ldexp", 53, [
|
||||
def SPV_GLLdexpOp :
|
||||
SPV_GLOp<"Ldexp", 53, [
|
||||
NoSideEffect, AllTypesMatch<["x", "y"]>]> {
|
||||
let summary = "Builds y such that y = significand * 2^exponent";
|
||||
|
||||
|
@ -1163,8 +1163,8 @@ def SPV_GLSLLdexpOp :
|
|||
#### Example:
|
||||
|
||||
```mlir
|
||||
%y = spv.GLSL.Ldexp %x : f32, %exp : i32 -> f32
|
||||
%y = spv.GLSL.Ldexp %x : vector<3xf32>, %exp : vector<3xi32> -> vector<3xf32>
|
||||
%y = spv.GL.Ldexp %x : f32, %exp : i32 -> f32
|
||||
%y = spv.GL.Ldexp %x : vector<3xf32>, %exp : vector<3xi32> -> vector<3xf32>
|
||||
```
|
||||
}];
|
||||
|
||||
|
@ -1182,8 +1182,8 @@ def SPV_GLSLLdexpOp :
|
|||
}];
|
||||
}
|
||||
|
||||
def SPV_GLSLFMixOp :
|
||||
SPV_GLSLOp<"FMix", 46, [
|
||||
def SPV_GLFMixOp :
|
||||
SPV_GLOp<"FMix", 46, [
|
||||
NoSideEffect, AllTypesMatch<["x", "y", "a", "result"]>]> {
|
||||
let summary = "Builds the linear blend of x and y";
|
||||
|
||||
|
@ -1199,8 +1199,8 @@ def SPV_GLSLFMixOp :
|
|||
#### Example:
|
||||
|
||||
```mlir
|
||||
%0 = spv.GLSL.FMix %x : f32, %y : f32, %a : f32 -> f32
|
||||
%0 = spv.GLSL.FMix %x : vector<4xf32>, %y : vector<4xf32>, %a : vector<4xf32> -> vector<4xf32>
|
||||
%0 = spv.GL.FMix %x : f32, %y : f32, %a : f32 -> f32
|
||||
%0 = spv.GL.FMix %x : vector<4xf32>, %y : vector<4xf32>, %a : vector<4xf32> -> vector<4xf32>
|
||||
```
|
||||
}];
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ def SPV_GLSLFMixOp :
|
|||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
def SPV_GLSLFindUMsbOp : SPV_GLSLUnaryArithmeticOp<"FindUMsb", 75, SPV_Int32> {
|
||||
def SPV_GLFindUMsbOp : SPV_GLUnaryArithmeticOp<"FindUMsb", 75, SPV_Int32> {
|
||||
let summary = "Unsigned-integer most-significant bit";
|
||||
|
||||
let description = [{
|
||||
|
@ -1237,4 +1237,4 @@ def SPV_GLSLFindUMsbOp : SPV_GLSLUnaryArithmeticOp<"FindUMsb", 75, SPV_Int32> {
|
|||
}];
|
||||
}
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GL_OPS
|
|
@ -178,4 +178,4 @@ def SPV_ImageOp : SPV_Op<"Image",
|
|||
let hasVerifier = 0;
|
||||
}
|
||||
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS
|
||||
#endif // MLIR_DIALECT_SPIRV_IR_GL_OPS
|
||||
|
|
|
@ -30,7 +30,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVCastOps.td"
|
|||
include "mlir/Dialect/SPIRV/IR/SPIRVCompositeOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVControlFlowOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVCooperativeMatrixOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVGLOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVGroupOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVImageOps.td"
|
||||
include "mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td"
|
||||
|
|
|
@ -27,10 +27,10 @@ class ModuleOp;
|
|||
// Passes
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Creates a pass to run canoncalization patterns that involve GLSL ops.
|
||||
/// These patterns cannot be run in default canonicalization because GLSL ops
|
||||
/// Creates a pass to run canoncalization patterns that involve GL ops.
|
||||
/// These patterns cannot be run in default canonicalization because GL ops
|
||||
/// aren't always available. So they should be involed specifically when needed.
|
||||
std::unique_ptr<OperationPass<>> createCanonicalizeGLSLPass();
|
||||
std::unique_ptr<OperationPass<>> createCanonicalizeGLPass();
|
||||
|
||||
/// Creates a module pass that converts composite types used by objects in the
|
||||
/// StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage
|
||||
|
|
|
@ -17,9 +17,9 @@ def SPIRVCompositeTypeLayout
|
|||
let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
|
||||
}
|
||||
|
||||
def SPIRVCanonicalizeGLSL : Pass<"spirv-canonicalize-glsl", ""> {
|
||||
def SPIRVCanonicalizeGL : Pass<"spirv-canonicalize-gl", ""> {
|
||||
let summary = "Run canonicalization involving GLSL ops";
|
||||
let constructor = "mlir::spirv::createCanonicalizeGLSLPass()";
|
||||
let constructor = "mlir::spirv::createCanonicalizeGLPass()";
|
||||
}
|
||||
|
||||
def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
|
||||
|
|
|
@ -51,7 +51,7 @@ struct ConstantScalarOpPattern final
|
|||
///
|
||||
/// This cannot be merged into the template unary/binary pattern due to Vulkan
|
||||
/// restrictions over spv.SRem and spv.SMod.
|
||||
struct RemSIOpGLSLPattern final : public OpConversionPattern<arith::RemSIOp> {
|
||||
struct RemSIOpGLPattern final : public OpConversionPattern<arith::RemSIOp> {
|
||||
using OpConversionPattern<arith::RemSIOp>::OpConversionPattern;
|
||||
|
||||
LogicalResult
|
||||
|
@ -442,7 +442,7 @@ LogicalResult ConstantScalarOpPattern::matchAndRewrite(
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// RemSIOpGLSLPattern
|
||||
// RemSIOpGLPattern
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Returns signed remainder for `lhs` and `rhs` and lets the result follow
|
||||
|
@ -476,9 +476,9 @@ static Value emulateSignedRemainder(Location loc, Value lhs, Value rhs,
|
|||
}
|
||||
|
||||
LogicalResult
|
||||
RemSIOpGLSLPattern::matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor,
|
||||
ConversionPatternRewriter &rewriter) const {
|
||||
Value result = emulateSignedRemainder<spirv::GLSLSAbsOp>(
|
||||
RemSIOpGLPattern::matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor,
|
||||
ConversionPatternRewriter &rewriter) const {
|
||||
Value result = emulateSignedRemainder<spirv::GLSAbsOp>(
|
||||
op.getLoc(), adaptor.getOperands()[0], adaptor.getOperands()[1],
|
||||
adaptor.getOperands()[0], rewriter);
|
||||
rewriter.replaceOp(op, result);
|
||||
|
@ -862,7 +862,7 @@ void mlir::arith::populateArithmeticToSPIRVPatterns(
|
|||
spirv::ElementwiseOpPattern<arith::DivUIOp, spirv::UDivOp>,
|
||||
spirv::ElementwiseOpPattern<arith::DivSIOp, spirv::SDivOp>,
|
||||
spirv::ElementwiseOpPattern<arith::RemUIOp, spirv::UModOp>,
|
||||
RemSIOpGLSLPattern, RemSIOpCLPattern,
|
||||
RemSIOpGLPattern, RemSIOpCLPattern,
|
||||
BitwiseOpPattern<arith::AndIOp, spirv::LogicalAndOp, spirv::BitwiseAndOp>,
|
||||
BitwiseOpPattern<arith::OrIOp, spirv::LogicalOrOp, spirv::BitwiseOrOp>,
|
||||
XOrIOpLogicalPattern, XOrIOpBooleanPattern,
|
||||
|
@ -889,12 +889,12 @@ void mlir::arith::populateArithmeticToSPIRVPatterns(
|
|||
CmpFOpNanNonePattern, CmpFOpPattern,
|
||||
SelectOpPattern,
|
||||
|
||||
spirv::ElementwiseOpPattern<arith::MaxFOp, spirv::GLSLFMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MaxSIOp, spirv::GLSLSMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MaxUIOp, spirv::GLSLUMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinFOp, spirv::GLSLFMinOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinSIOp, spirv::GLSLSMinOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinUIOp, spirv::GLSLUMinOp>
|
||||
spirv::ElementwiseOpPattern<arith::MaxFOp, spirv::GLFMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MaxSIOp, spirv::GLSMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MaxUIOp, spirv::GLUMaxOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinFOp, spirv::GLFMinOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinSIOp, spirv::GLSMinOp>,
|
||||
spirv::ElementwiseOpPattern<arith::MinUIOp, spirv::GLUMinOp>
|
||||
>(typeConverter, patterns.getContext());
|
||||
// clang-format on
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class CopySignPattern final : public OpConversionPattern<math::CopySignOp> {
|
|||
/// Converts math.ctlz to SPIR-V ops.
|
||||
///
|
||||
/// SPIR-V does not have a direct operations for counting leading zeros. If
|
||||
/// Shader capability is supported, we can leverage GLSL FindUMsb to calculate
|
||||
/// Shader capability is supported, we can leverage GL FindUMsb to calculate
|
||||
/// it.
|
||||
class CountLeadingZerosPattern final
|
||||
: public OpConversionPattern<math::CountLeadingZerosOp> {
|
||||
|
@ -147,11 +147,11 @@ class CountLeadingZerosPattern final
|
|||
Value val31 = getScalarOrVectorI32Constant(type, 31, rewriter, loc);
|
||||
Value val32 = getScalarOrVectorI32Constant(type, 32, rewriter, loc);
|
||||
|
||||
Value msb = rewriter.create<spirv::GLSLFindUMsbOp>(loc, input);
|
||||
Value msb = rewriter.create<spirv::GLFindUMsbOp>(loc, input);
|
||||
// We need to subtract from 31 given that the index returned by GLSL
|
||||
// FindUMsb is counted from the least significant bit. Theoretically this
|
||||
// also gives the correct result even if the integer has all zero bits, in
|
||||
// which case GLSL FindUMsb would return -1.
|
||||
// which case GL FindUMsb would return -1.
|
||||
Value subMsb = rewriter.create<spirv::ISubOp>(loc, val31, msb);
|
||||
// However, certain Vulkan implementations have driver bugs for the corner
|
||||
// case where the input is zero. And.. it can be smart to optimize a select
|
||||
|
@ -219,15 +219,15 @@ struct PowFOpPattern final : public OpConversionPattern<math::PowFOp> {
|
|||
if (!dstType)
|
||||
return failure();
|
||||
|
||||
// Per GLSL Pow extended instruction spec:
|
||||
// Per GL Pow extended instruction spec:
|
||||
// "Result is undefined if x < 0. Result is undefined if x = 0 and y <= 0."
|
||||
Location loc = powfOp.getLoc();
|
||||
Value zero =
|
||||
spirv::ConstantOp::getZero(adaptor.getLhs().getType(), loc, rewriter);
|
||||
Value lessThan =
|
||||
rewriter.create<spirv::FOrdLessThanOp>(loc, adaptor.getLhs(), zero);
|
||||
Value abs = rewriter.create<spirv::GLSLFAbsOp>(loc, adaptor.getLhs());
|
||||
Value pow = rewriter.create<spirv::GLSLPowOp>(loc, abs, adaptor.getRhs());
|
||||
Value abs = rewriter.create<spirv::GLFAbsOp>(loc, adaptor.getLhs());
|
||||
Value pow = rewriter.create<spirv::GLPowOp>(loc, abs, adaptor.getRhs());
|
||||
Value negate = rewriter.create<spirv::FNegateOp>(loc, pow);
|
||||
rewriter.replaceOpWithNewOp<spirv::SelectOp>(powfOp, lessThan, negate, pow);
|
||||
return success();
|
||||
|
@ -259,8 +259,8 @@ struct RoundOpPattern final : public OpConversionPattern<math::RoundOp> {
|
|||
loc, ty, rewriter.getFloatAttr(ety, 0.5));
|
||||
}
|
||||
|
||||
auto abs = rewriter.create<spirv::GLSLFAbsOp>(loc, operand);
|
||||
auto floor = rewriter.create<spirv::GLSLFloorOp>(loc, abs);
|
||||
auto abs = rewriter.create<spirv::GLFAbsOp>(loc, operand);
|
||||
auto floor = rewriter.create<spirv::GLFloorOp>(loc, abs);
|
||||
auto sub = rewriter.create<spirv::FSubOp>(loc, abs, floor);
|
||||
auto greater =
|
||||
rewriter.create<spirv::FOrdGreaterThanEqualOp>(loc, sub, half);
|
||||
|
@ -285,19 +285,19 @@ void populateMathToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
|
|||
|
||||
// GLSL patterns
|
||||
patterns
|
||||
.add<CountLeadingZerosPattern, Log1pOpPattern<spirv::GLSLLogOp>,
|
||||
ExpM1OpPattern<spirv::GLSLExpOp>, PowFOpPattern, RoundOpPattern,
|
||||
spirv::ElementwiseOpPattern<math::AbsOp, spirv::GLSLFAbsOp>,
|
||||
spirv::ElementwiseOpPattern<math::CeilOp, spirv::GLSLCeilOp>,
|
||||
spirv::ElementwiseOpPattern<math::CosOp, spirv::GLSLCosOp>,
|
||||
spirv::ElementwiseOpPattern<math::ExpOp, spirv::GLSLExpOp>,
|
||||
spirv::ElementwiseOpPattern<math::FloorOp, spirv::GLSLFloorOp>,
|
||||
spirv::ElementwiseOpPattern<math::FmaOp, spirv::GLSLFmaOp>,
|
||||
spirv::ElementwiseOpPattern<math::LogOp, spirv::GLSLLogOp>,
|
||||
spirv::ElementwiseOpPattern<math::RsqrtOp, spirv::GLSLInverseSqrtOp>,
|
||||
spirv::ElementwiseOpPattern<math::SinOp, spirv::GLSLSinOp>,
|
||||
spirv::ElementwiseOpPattern<math::SqrtOp, spirv::GLSLSqrtOp>,
|
||||
spirv::ElementwiseOpPattern<math::TanhOp, spirv::GLSLTanhOp>>(
|
||||
.add<CountLeadingZerosPattern, Log1pOpPattern<spirv::GLLogOp>,
|
||||
ExpM1OpPattern<spirv::GLExpOp>, PowFOpPattern, RoundOpPattern,
|
||||
spirv::ElementwiseOpPattern<math::AbsOp, spirv::GLFAbsOp>,
|
||||
spirv::ElementwiseOpPattern<math::CeilOp, spirv::GLCeilOp>,
|
||||
spirv::ElementwiseOpPattern<math::CosOp, spirv::GLCosOp>,
|
||||
spirv::ElementwiseOpPattern<math::ExpOp, spirv::GLExpOp>,
|
||||
spirv::ElementwiseOpPattern<math::FloorOp, spirv::GLFloorOp>,
|
||||
spirv::ElementwiseOpPattern<math::FmaOp, spirv::GLFmaOp>,
|
||||
spirv::ElementwiseOpPattern<math::LogOp, spirv::GLLogOp>,
|
||||
spirv::ElementwiseOpPattern<math::RsqrtOp, spirv::GLInverseSqrtOp>,
|
||||
spirv::ElementwiseOpPattern<math::SinOp, spirv::GLSinOp>,
|
||||
spirv::ElementwiseOpPattern<math::SqrtOp, spirv::GLSqrtOp>,
|
||||
spirv::ElementwiseOpPattern<math::TanhOp, spirv::GLTanhOp>>(
|
||||
typeConverter, patterns.getContext());
|
||||
|
||||
// OpenCL patterns
|
||||
|
|
|
@ -866,12 +866,12 @@ public:
|
|||
};
|
||||
|
||||
class InverseSqrtPattern
|
||||
: public SPIRVToLLVMConversion<spirv::GLSLInverseSqrtOp> {
|
||||
: public SPIRVToLLVMConversion<spirv::GLInverseSqrtOp> {
|
||||
public:
|
||||
using SPIRVToLLVMConversion<spirv::GLSLInverseSqrtOp>::SPIRVToLLVMConversion;
|
||||
using SPIRVToLLVMConversion<spirv::GLInverseSqrtOp>::SPIRVToLLVMConversion;
|
||||
|
||||
LogicalResult
|
||||
matchAndRewrite(spirv::GLSLInverseSqrtOp op, OpAdaptor adaptor,
|
||||
matchAndRewrite(spirv::GLInverseSqrtOp op, OpAdaptor adaptor,
|
||||
ConversionPatternRewriter &rewriter) const override {
|
||||
auto srcType = op.getType();
|
||||
auto dstType = typeConverter.convertType(srcType);
|
||||
|
@ -1191,12 +1191,12 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class TanPattern : public SPIRVToLLVMConversion<spirv::GLSLTanOp> {
|
||||
class TanPattern : public SPIRVToLLVMConversion<spirv::GLTanOp> {
|
||||
public:
|
||||
using SPIRVToLLVMConversion<spirv::GLSLTanOp>::SPIRVToLLVMConversion;
|
||||
using SPIRVToLLVMConversion<spirv::GLTanOp>::SPIRVToLLVMConversion;
|
||||
|
||||
LogicalResult
|
||||
matchAndRewrite(spirv::GLSLTanOp tanOp, OpAdaptor adaptor,
|
||||
matchAndRewrite(spirv::GLTanOp tanOp, OpAdaptor adaptor,
|
||||
ConversionPatternRewriter &rewriter) const override {
|
||||
auto dstType = typeConverter.convertType(tanOp.getType());
|
||||
if (!dstType)
|
||||
|
@ -1216,12 +1216,12 @@ public:
|
|||
/// -----------
|
||||
/// exp(2x) + 1
|
||||
///
|
||||
class TanhPattern : public SPIRVToLLVMConversion<spirv::GLSLTanhOp> {
|
||||
class TanhPattern : public SPIRVToLLVMConversion<spirv::GLTanhOp> {
|
||||
public:
|
||||
using SPIRVToLLVMConversion<spirv::GLSLTanhOp>::SPIRVToLLVMConversion;
|
||||
using SPIRVToLLVMConversion<spirv::GLTanhOp>::SPIRVToLLVMConversion;
|
||||
|
||||
LogicalResult
|
||||
matchAndRewrite(spirv::GLSLTanhOp tanhOp, OpAdaptor adaptor,
|
||||
matchAndRewrite(spirv::GLTanhOp tanhOp, OpAdaptor adaptor,
|
||||
ConversionPatternRewriter &rewriter) const override {
|
||||
auto srcType = tanhOp.getType();
|
||||
auto dstType = typeConverter.convertType(srcType);
|
||||
|
@ -1515,18 +1515,18 @@ void mlir::populateSPIRVToLLVMConversionPatterns(
|
|||
ErasePattern<spirv::EntryPointOp>, ExecutionModePattern,
|
||||
|
||||
// GLSL extended instruction set ops
|
||||
DirectConversionPattern<spirv::GLSLCeilOp, LLVM::FCeilOp>,
|
||||
DirectConversionPattern<spirv::GLSLCosOp, LLVM::CosOp>,
|
||||
DirectConversionPattern<spirv::GLSLExpOp, LLVM::ExpOp>,
|
||||
DirectConversionPattern<spirv::GLSLFAbsOp, LLVM::FAbsOp>,
|
||||
DirectConversionPattern<spirv::GLSLFloorOp, LLVM::FFloorOp>,
|
||||
DirectConversionPattern<spirv::GLSLFMaxOp, LLVM::MaxNumOp>,
|
||||
DirectConversionPattern<spirv::GLSLFMinOp, LLVM::MinNumOp>,
|
||||
DirectConversionPattern<spirv::GLSLLogOp, LLVM::LogOp>,
|
||||
DirectConversionPattern<spirv::GLSLSinOp, LLVM::SinOp>,
|
||||
DirectConversionPattern<spirv::GLSLSMaxOp, LLVM::SMaxOp>,
|
||||
DirectConversionPattern<spirv::GLSLSMinOp, LLVM::SMinOp>,
|
||||
DirectConversionPattern<spirv::GLSLSqrtOp, LLVM::SqrtOp>,
|
||||
DirectConversionPattern<spirv::GLCeilOp, LLVM::FCeilOp>,
|
||||
DirectConversionPattern<spirv::GLCosOp, LLVM::CosOp>,
|
||||
DirectConversionPattern<spirv::GLExpOp, LLVM::ExpOp>,
|
||||
DirectConversionPattern<spirv::GLFAbsOp, LLVM::FAbsOp>,
|
||||
DirectConversionPattern<spirv::GLFloorOp, LLVM::FFloorOp>,
|
||||
DirectConversionPattern<spirv::GLFMaxOp, LLVM::MaxNumOp>,
|
||||
DirectConversionPattern<spirv::GLFMinOp, LLVM::MinNumOp>,
|
||||
DirectConversionPattern<spirv::GLLogOp, LLVM::LogOp>,
|
||||
DirectConversionPattern<spirv::GLSinOp, LLVM::SinOp>,
|
||||
DirectConversionPattern<spirv::GLSMaxOp, LLVM::SMaxOp>,
|
||||
DirectConversionPattern<spirv::GLSMinOp, LLVM::SMinOp>,
|
||||
DirectConversionPattern<spirv::GLSqrtOp, LLVM::SqrtOp>,
|
||||
InverseSqrtPattern, TanPattern, TanhPattern,
|
||||
|
||||
// Logical ops
|
||||
|
|
|
@ -148,7 +148,7 @@ struct VectorFmaOpConvert final : public OpConversionPattern<vector::FMAOp> {
|
|||
Type dstType = getTypeConverter()->convertType(fmaOp.getType());
|
||||
if (!dstType)
|
||||
return failure();
|
||||
rewriter.replaceOpWithNewOp<spirv::GLSLFmaOp>(
|
||||
rewriter.replaceOpWithNewOp<spirv::GLFmaOp>(
|
||||
fmaOp, dstType, adaptor.getLhs(), adaptor.getRhs(), adaptor.getAcc());
|
||||
return success();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ add_public_tablegen_target(MLIRSPIRVCanonicalizationIncGen)
|
|||
add_mlir_dialect_library(MLIRSPIRVDialect
|
||||
SPIRVAttributes.cpp
|
||||
SPIRVCanonicalization.cpp
|
||||
SPIRVGLSLCanonicalization.cpp
|
||||
SPIRVGLCanonicalization.cpp
|
||||
SPIRVDialect.cpp
|
||||
SPIRVEnums.cpp
|
||||
SPIRVOps.cpp
|
||||
|
|
|
@ -41,18 +41,18 @@ def ConvertLogicalNotOfLogicalNotEqual : Pat<
|
|||
(SPV_LogicalEqualOp $lhs, $rhs)>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.Select -> spv.GLSL.*Clamp
|
||||
// spv.Select -> spv.GL.*Clamp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def ValuesAreEqual : Constraint<CPred<"$0 == $1">>;
|
||||
|
||||
foreach CmpClampPair = [
|
||||
[SPV_FOrdLessThanOp, SPV_GLSLFClampOp],
|
||||
[SPV_FOrdLessThanEqualOp, SPV_GLSLFClampOp],
|
||||
[SPV_SLessThanOp, SPV_GLSLSClampOp],
|
||||
[SPV_SLessThanEqualOp, SPV_GLSLSClampOp],
|
||||
[SPV_ULessThanOp, SPV_GLSLUClampOp],
|
||||
[SPV_ULessThanEqualOp, SPV_GLSLUClampOp]] in {
|
||||
[SPV_FOrdLessThanOp, SPV_GLFClampOp],
|
||||
[SPV_FOrdLessThanEqualOp, SPV_GLFClampOp],
|
||||
[SPV_SLessThanOp, SPV_GLSClampOp],
|
||||
[SPV_SLessThanEqualOp, SPV_GLSClampOp],
|
||||
[SPV_ULessThanOp, SPV_GLUClampOp],
|
||||
[SPV_ULessThanEqualOp, SPV_GLUClampOp]] in {
|
||||
|
||||
// Detect: $min < $input, $input < $max
|
||||
def ConvertComparisonIntoClamp1_#CmpClampPair[0] : Pat<
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===- SPIRVGLSLCanonicalization.cpp - SPIR-V GLSL canonicalization patterns =//
|
||||
//===- SPIRVGLCanonicalization.cpp - SPIR-V GLSL canonicalization patterns =//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h"
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h"
|
||||
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace {
|
|||
|
||||
namespace mlir {
|
||||
namespace spirv {
|
||||
void populateSPIRVGLSLCanonicalizationPatterns(RewritePatternSet &results) {
|
||||
void populateSPIRVGLCanonicalizationPatterns(RewritePatternSet &results) {
|
||||
results.add<ConvertComparisonIntoClamp1_SPV_FOrdLessThanOp,
|
||||
ConvertComparisonIntoClamp1_SPV_FOrdLessThanEqualOp,
|
||||
ConvertComparisonIntoClamp1_SPV_SLessThanOp,
|
|
@ -2385,44 +2385,43 @@ Operation::operand_range spirv::FunctionCallOp::getArgOperands() {
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSLFClampOp
|
||||
// spv.GLFClampOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ParseResult spirv::GLSLFClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
ParseResult spirv::GLFClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
return parseOneResultSameOperandTypeOp(parser, result);
|
||||
}
|
||||
void spirv::GLSLFClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
void spirv::GLFClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSLUClampOp
|
||||
// spv.GLUClampOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ParseResult spirv::GLSLUClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
ParseResult spirv::GLUClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
return parseOneResultSameOperandTypeOp(parser, result);
|
||||
}
|
||||
void spirv::GLSLUClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
void spirv::GLUClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSLSClampOp
|
||||
// spv.GLSClampOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ParseResult spirv::GLSLSClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
ParseResult spirv::GLSClampOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
return parseOneResultSameOperandTypeOp(parser, result);
|
||||
}
|
||||
void spirv::GLSLSClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
void spirv::GLSClampOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSLFmaOp
|
||||
// spv.GLFmaOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ParseResult spirv::GLSLFmaOp::parse(OpAsmParser &parser,
|
||||
OperationState &result) {
|
||||
ParseResult spirv::GLFmaOp::parse(OpAsmParser &parser, OperationState &result) {
|
||||
return parseOneResultSameOperandTypeOp(parser, result);
|
||||
}
|
||||
void spirv::GLSLFmaOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
void spirv::GLFmaOp::print(OpAsmPrinter &p) { printOneResultOp(*this, p); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GlobalVariable
|
||||
|
@ -4176,10 +4175,10 @@ LogicalResult spirv::SpecConstantOperationOp::verifyRegions() {
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FrexpStruct
|
||||
// spv.GL.FrexpStruct
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
LogicalResult spirv::GLSLFrexpStructOp::verify() {
|
||||
LogicalResult spirv::GLFrexpStructOp::verify() {
|
||||
spirv::StructType structTy = result().getType().dyn_cast<spirv::StructType>();
|
||||
|
||||
if (structTy.getNumElements() != 2)
|
||||
|
@ -4222,10 +4221,10 @@ LogicalResult spirv::GLSLFrexpStructOp::verify() {
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Ldexp
|
||||
// spv.GL.Ldexp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
LogicalResult spirv::GLSLLdexpOp::verify() {
|
||||
LogicalResult spirv::GLLdexpOp::verify() {
|
||||
Type significandType = x().getType();
|
||||
Type exponentType = exp().getType();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set(LLVM_OPTIONAL_SOURCES
|
||||
CanonicalizeGLSLPass.cpp
|
||||
CanonicalizeGLPass.cpp
|
||||
DecorateCompositeTypeLayoutPass.cpp
|
||||
LowerABIAttributesPass.cpp
|
||||
RewriteInsertsPass.cpp
|
||||
|
@ -21,7 +21,7 @@ add_mlir_dialect_library(MLIRSPIRVConversion
|
|||
)
|
||||
|
||||
add_mlir_dialect_library(MLIRSPIRVTransforms
|
||||
CanonicalizeGLSLPass.cpp
|
||||
CanonicalizeGLPass.cpp
|
||||
DecorateCompositeTypeLayoutPass.cpp
|
||||
LowerABIAttributesPass.cpp
|
||||
RewriteInsertsPass.cpp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===- CanonicalizeGLSLPass.cpp - GLSL Related Canonicalization Pass ------===//
|
||||
//===- CanonicalizeGLPass.cpp - GLSL Related Canonicalization Pass ------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
|
@ -7,7 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h"
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h"
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
|
||||
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
@ -16,12 +16,12 @@
|
|||
using namespace mlir;
|
||||
|
||||
namespace {
|
||||
class CanonicalizeGLSLPass final
|
||||
: public SPIRVCanonicalizeGLSLBase<CanonicalizeGLSLPass> {
|
||||
class CanonicalizeGLPass final
|
||||
: public SPIRVCanonicalizeGLBase<CanonicalizeGLPass> {
|
||||
public:
|
||||
void runOnOperation() override {
|
||||
RewritePatternSet patterns(&getContext());
|
||||
spirv::populateSPIRVGLSLCanonicalizationPatterns(patterns);
|
||||
spirv::populateSPIRVGLCanonicalizationPatterns(patterns);
|
||||
if (failed(
|
||||
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
|
||||
return signalPassFailure();
|
||||
|
@ -29,6 +29,6 @@ public:
|
|||
};
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<OperationPass<>> spirv::createCanonicalizeGLSLPass() {
|
||||
return std::make_unique<CanonicalizeGLSLPass>();
|
||||
std::unique_ptr<OperationPass<>> spirv::createCanonicalizeGLPass() {
|
||||
return std::make_unique<CanonicalizeGLPass>();
|
||||
}
|
|
@ -30,8 +30,8 @@ func.func @int32_scalar(%lhs: i32, %rhs: i32) {
|
|||
// CHECK-LABEL: @int32_scalar_srem
|
||||
// CHECK-SAME: (%[[LHS:.+]]: i32, %[[RHS:.+]]: i32)
|
||||
func.func @int32_scalar_srem(%lhs: i32, %rhs: i32) {
|
||||
// CHECK: %[[LABS:.+]] = spv.GLSL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GLSL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[LABS:.+]] = spv.GL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[ABS:.+]] = spv.UMod %[[LABS]], %[[RABS]] : i32
|
||||
// CHECK: %[[POS:.+]] = spv.IEqual %[[LHS]], %[[LABS]] : i32
|
||||
// CHECK: %[[NEG:.+]] = spv.SNegate %[[ABS]] : i32
|
||||
|
@ -62,8 +62,8 @@ func.func @index_scalar(%lhs: index, %rhs: index) {
|
|||
func.func @index_scalar_srem(%lhs: index, %rhs: index) {
|
||||
// CHECK: %[[LHS:.+]] = builtin.unrealized_conversion_cast %[[A]] : index to i32
|
||||
// CHECK: %[[RHS:.+]] = builtin.unrealized_conversion_cast %[[B]] : index to i32
|
||||
// CHECK: %[[LABS:.+]] = spv.GLSL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GLSL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[LABS:.+]] = spv.GL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[ABS:.+]] = spv.UMod %[[LABS]], %[[RABS]] : i32
|
||||
// CHECK: %[[POS:.+]] = spv.IEqual %[[LHS]], %[[LABS]] : i32
|
||||
// CHECK: %[[NEG:.+]] = spv.SNegate %[[ABS]] : i32
|
||||
|
@ -109,8 +109,8 @@ func.func @int_vector234(%arg0: vector<2xi8>, %arg1: vector<4xi64>) {
|
|||
// CHECK-LABEL: @vector_srem
|
||||
// CHECK-SAME: (%[[LHS:.+]]: vector<3xi16>, %[[RHS:.+]]: vector<3xi16>)
|
||||
func.func @vector_srem(%arg0: vector<3xi16>, %arg1: vector<3xi16>) {
|
||||
// CHECK: %[[LABS:.+]] = spv.GLSL.SAbs %[[LHS]] : vector<3xi16>
|
||||
// CHECK: %[[RABS:.+]] = spv.GLSL.SAbs %[[RHS]] : vector<3xi16>
|
||||
// CHECK: %[[LABS:.+]] = spv.GL.SAbs %[[LHS]] : vector<3xi16>
|
||||
// CHECK: %[[RABS:.+]] = spv.GL.SAbs %[[RHS]] : vector<3xi16>
|
||||
// CHECK: %[[ABS:.+]] = spv.UMod %[[LABS]], %[[RABS]] : vector<3xi16>
|
||||
// CHECK: %[[POS:.+]] = spv.IEqual %[[LHS]], %[[LABS]] : vector<3xi16>
|
||||
// CHECK: %[[NEG:.+]] = spv.SNegate %[[ABS]] : vector<3xi16>
|
||||
|
@ -1021,13 +1021,13 @@ func.func @int32_scalar(%lhs: i32, %rhs: i32) {
|
|||
%4 = arith.divui %lhs, %rhs: i32
|
||||
// CHECK: spv.UMod %{{.*}}, %{{.*}}: i32
|
||||
%5 = arith.remui %lhs, %rhs: i32
|
||||
// CHECK: spv.GLSL.SMax %{{.*}}, %{{.*}}: i32
|
||||
// CHECK: spv.GL.SMax %{{.*}}, %{{.*}}: i32
|
||||
%6 = arith.maxsi %lhs, %rhs : i32
|
||||
// CHECK: spv.GLSL.UMax %{{.*}}, %{{.*}}: i32
|
||||
// CHECK: spv.GL.UMax %{{.*}}, %{{.*}}: i32
|
||||
%7 = arith.maxui %lhs, %rhs : i32
|
||||
// CHECK: spv.GLSL.SMin %{{.*}}, %{{.*}}: i32
|
||||
// CHECK: spv.GL.SMin %{{.*}}, %{{.*}}: i32
|
||||
%8 = arith.minsi %lhs, %rhs : i32
|
||||
// CHECK: spv.GLSL.UMin %{{.*}}, %{{.*}}: i32
|
||||
// CHECK: spv.GL.UMin %{{.*}}, %{{.*}}: i32
|
||||
%9 = arith.minui %lhs, %rhs : i32
|
||||
return
|
||||
}
|
||||
|
@ -1035,8 +1035,8 @@ func.func @int32_scalar(%lhs: i32, %rhs: i32) {
|
|||
// CHECK-LABEL: @scalar_srem
|
||||
// CHECK-SAME: (%[[LHS:.+]]: i32, %[[RHS:.+]]: i32)
|
||||
func.func @scalar_srem(%lhs: i32, %rhs: i32) {
|
||||
// CHECK: %[[LABS:.+]] = spv.GLSL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GLSL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[LABS:.+]] = spv.GL.SAbs %[[LHS]] : i32
|
||||
// CHECK: %[[RABS:.+]] = spv.GL.SAbs %[[RHS]] : i32
|
||||
// CHECK: %[[ABS:.+]] = spv.UMod %[[LABS]], %[[RABS]] : i32
|
||||
// CHECK: %[[POS:.+]] = spv.IEqual %[[LHS]], %[[LABS]] : i32
|
||||
// CHECK: %[[NEG:.+]] = spv.SNegate %[[ABS]] : i32
|
||||
|
@ -1066,9 +1066,9 @@ func.func @float32_binary_scalar(%lhs: f32, %rhs: f32) {
|
|||
%3 = arith.divf %lhs, %rhs: f32
|
||||
// CHECK: spv.FRem %{{.*}}, %{{.*}}: f32
|
||||
%4 = arith.remf %lhs, %rhs: f32
|
||||
// CHECK: spv.GLSL.FMax %{{.*}}, %{{.*}}: f32
|
||||
// CHECK: spv.GL.FMax %{{.*}}, %{{.*}}: f32
|
||||
%5 = arith.maxf %lhs, %rhs: f32
|
||||
// CHECK: spv.GLSL.FMin %{{.*}}, %{{.*}}: f32
|
||||
// CHECK: spv.GL.FMin %{{.*}}, %{{.*}}: f32
|
||||
%6 = arith.minf %lhs, %rhs: f32
|
||||
return
|
||||
}
|
||||
|
@ -1086,8 +1086,8 @@ func.func @int_vector234(%arg0: vector<2xi8>, %arg1: vector<4xi64>) {
|
|||
// CHECK-LABEL: @vector_srem
|
||||
// CHECK-SAME: (%[[LHS:.+]]: vector<3xi16>, %[[RHS:.+]]: vector<3xi16>)
|
||||
func.func @vector_srem(%arg0: vector<3xi16>, %arg1: vector<3xi16>) {
|
||||
// CHECK: %[[LABS:.+]] = spv.GLSL.SAbs %[[LHS]] : vector<3xi16>
|
||||
// CHECK: %[[RABS:.+]] = spv.GLSL.SAbs %[[RHS]] : vector<3xi16>
|
||||
// CHECK: %[[LABS:.+]] = spv.GL.SAbs %[[LHS]] : vector<3xi16>
|
||||
// CHECK: %[[RABS:.+]] = spv.GL.SAbs %[[RHS]] : vector<3xi16>
|
||||
// CHECK: %[[ABS:.+]] = spv.UMod %[[LABS]], %[[RABS]] : vector<3xi16>
|
||||
// CHECK: %[[POS:.+]] = spv.IEqual %[[LHS]], %[[LABS]] : vector<3xi16>
|
||||
// CHECK: %[[NEG:.+]] = spv.SNegate %[[ABS]] : vector<3xi16>
|
||||
|
|
|
@ -6,67 +6,67 @@ module attributes {
|
|||
|
||||
// CHECK-LABEL: @float32_unary_scalar
|
||||
func.func @float32_unary_scalar(%arg0: f32) {
|
||||
// CHECK: spv.GLSL.Cos %{{.*}}: f32
|
||||
// CHECK: spv.GL.Cos %{{.*}}: f32
|
||||
%0 = math.cos %arg0 : f32
|
||||
// CHECK: spv.GLSL.Exp %{{.*}}: f32
|
||||
// CHECK: spv.GL.Exp %{{.*}}: f32
|
||||
%1 = math.exp %arg0 : f32
|
||||
// CHECK: %[[EXP:.+]] = spv.GLSL.Exp %arg0
|
||||
// CHECK: %[[EXP:.+]] = spv.GL.Exp %arg0
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant 1.000000e+00 : f32
|
||||
// CHECK: spv.FSub %[[EXP]], %[[ONE]]
|
||||
%2 = math.expm1 %arg0 : f32
|
||||
// CHECK: spv.GLSL.Log %{{.*}}: f32
|
||||
// CHECK: spv.GL.Log %{{.*}}: f32
|
||||
%3 = math.log %arg0 : f32
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant 1.000000e+00 : f32
|
||||
// CHECK: %[[ADDONE:.+]] = spv.FAdd %[[ONE]], %{{.+}}
|
||||
// CHECK: spv.GLSL.Log %[[ADDONE]]
|
||||
// CHECK: spv.GL.Log %[[ADDONE]]
|
||||
%4 = math.log1p %arg0 : f32
|
||||
// CHECK: spv.GLSL.InverseSqrt %{{.*}}: f32
|
||||
// CHECK: spv.GL.InverseSqrt %{{.*}}: f32
|
||||
%5 = math.rsqrt %arg0 : f32
|
||||
// CHECK: spv.GLSL.Sqrt %{{.*}}: f32
|
||||
// CHECK: spv.GL.Sqrt %{{.*}}: f32
|
||||
%6 = math.sqrt %arg0 : f32
|
||||
// CHECK: spv.GLSL.Tanh %{{.*}}: f32
|
||||
// CHECK: spv.GL.Tanh %{{.*}}: f32
|
||||
%7 = math.tanh %arg0 : f32
|
||||
// CHECK: spv.GLSL.Sin %{{.*}}: f32
|
||||
// CHECK: spv.GL.Sin %{{.*}}: f32
|
||||
%8 = math.sin %arg0 : f32
|
||||
// CHECK: spv.GLSL.FAbs %{{.*}}: f32
|
||||
// CHECK: spv.GL.FAbs %{{.*}}: f32
|
||||
%9 = math.abs %arg0 : f32
|
||||
// CHECK: spv.GLSL.Ceil %{{.*}}: f32
|
||||
// CHECK: spv.GL.Ceil %{{.*}}: f32
|
||||
%10 = math.ceil %arg0 : f32
|
||||
// CHECK: spv.GLSL.Floor %{{.*}}: f32
|
||||
// CHECK: spv.GL.Floor %{{.*}}: f32
|
||||
%11 = math.floor %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @float32_unary_vector
|
||||
func.func @float32_unary_vector(%arg0: vector<3xf32>) {
|
||||
// CHECK: spv.GLSL.Cos %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Cos %{{.*}}: vector<3xf32>
|
||||
%0 = math.cos %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.Exp %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Exp %{{.*}}: vector<3xf32>
|
||||
%1 = math.exp %arg0 : vector<3xf32>
|
||||
// CHECK: %[[EXP:.+]] = spv.GLSL.Exp %arg0
|
||||
// CHECK: %[[EXP:.+]] = spv.GL.Exp %arg0
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant dense<1.000000e+00> : vector<3xf32>
|
||||
// CHECK: spv.FSub %[[EXP]], %[[ONE]]
|
||||
%2 = math.expm1 %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.Log %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Log %{{.*}}: vector<3xf32>
|
||||
%3 = math.log %arg0 : vector<3xf32>
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant dense<1.000000e+00> : vector<3xf32>
|
||||
// CHECK: %[[ADDONE:.+]] = spv.FAdd %[[ONE]], %{{.+}}
|
||||
// CHECK: spv.GLSL.Log %[[ADDONE]]
|
||||
// CHECK: spv.GL.Log %[[ADDONE]]
|
||||
%4 = math.log1p %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.InverseSqrt %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.InverseSqrt %{{.*}}: vector<3xf32>
|
||||
%5 = math.rsqrt %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.Sqrt %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Sqrt %{{.*}}: vector<3xf32>
|
||||
%6 = math.sqrt %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.Tanh %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Tanh %{{.*}}: vector<3xf32>
|
||||
%7 = math.tanh %arg0 : vector<3xf32>
|
||||
// CHECK: spv.GLSL.Sin %{{.*}}: vector<3xf32>
|
||||
// CHECK: spv.GL.Sin %{{.*}}: vector<3xf32>
|
||||
%8 = math.sin %arg0 : vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @float32_ternary_scalar
|
||||
func.func @float32_ternary_scalar(%a: f32, %b: f32, %c: f32) {
|
||||
// CHECK: spv.GLSL.Fma %{{.*}}: f32
|
||||
// CHECK: spv.GL.Fma %{{.*}}: f32
|
||||
%0 = math.fma %a, %b, %c : f32
|
||||
return
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func.func @float32_ternary_scalar(%a: f32, %b: f32, %c: f32) {
|
|||
// CHECK-LABEL: @float32_ternary_vector
|
||||
func.func @float32_ternary_vector(%a: vector<4xf32>, %b: vector<4xf32>,
|
||||
%c: vector<4xf32>) {
|
||||
// CHECK: spv.GLSL.Fma %{{.*}}: vector<4xf32>
|
||||
// CHECK: spv.GL.Fma %{{.*}}: vector<4xf32>
|
||||
%0 = math.fma %a, %b, %c : vector<4xf32>
|
||||
return
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ func.func @ctlz_scalar(%val: i32) -> i32 {
|
|||
// CHECK-DAG: %[[V1:.+]] = spv.Constant 1 : i32
|
||||
// CHECK-DAG: %[[V31:.+]] = spv.Constant 31 : i32
|
||||
// CHECK-DAG: %[[V32:.+]] = spv.Constant 32 : i32
|
||||
// CHECK: %[[MSB:.+]] = spv.GLSL.FindUMsb %[[VAL]] : i32
|
||||
// CHECK: %[[MSB:.+]] = spv.GL.FindUMsb %[[VAL]] : i32
|
||||
// CHECK: %[[SUB1:.+]] = spv.ISub %[[V31]], %[[MSB]] : i32
|
||||
// CHECK: %[[SUB2:.+]] = spv.ISub %[[V32]], %[[VAL]] : i32
|
||||
// CHECK: %[[CMP:.+]] = spv.ULessThanEqual %[[VAL]], %[[V1]] : i32
|
||||
|
@ -97,7 +97,7 @@ func.func @ctlz_scalar(%val: i32) -> i32 {
|
|||
|
||||
// CHECK-LABEL: @ctlz_vector1
|
||||
func.func @ctlz_vector1(%val: vector<1xi32>) -> vector<1xi32> {
|
||||
// CHECK: spv.GLSL.FindUMsb
|
||||
// CHECK: spv.GL.FindUMsb
|
||||
// CHECK: spv.ISub
|
||||
// CHECK: spv.ULessThanEqual
|
||||
// CHECK: spv.Select
|
||||
|
@ -111,7 +111,7 @@ func.func @ctlz_vector2(%val: vector<2xi32>) -> vector<2xi32> {
|
|||
// CHECK-DAG: %[[V1:.+]] = spv.Constant dense<1> : vector<2xi32>
|
||||
// CHECK-DAG: %[[V31:.+]] = spv.Constant dense<31> : vector<2xi32>
|
||||
// CHECK-DAG: %[[V32:.+]] = spv.Constant dense<32> : vector<2xi32>
|
||||
// CHECK: %[[MSB:.+]] = spv.GLSL.FindUMsb %[[VAL]] : vector<2xi32>
|
||||
// CHECK: %[[MSB:.+]] = spv.GL.FindUMsb %[[VAL]] : vector<2xi32>
|
||||
// CHECK: %[[SUB1:.+]] = spv.ISub %[[V31]], %[[MSB]] : vector<2xi32>
|
||||
// CHECK: %[[SUB2:.+]] = spv.ISub %[[V32]], %[[VAL]] : vector<2xi32>
|
||||
// CHECK: %[[CMP:.+]] = spv.ULessThanEqual %[[VAL]], %[[V1]] : vector<2xi32>
|
||||
|
@ -125,8 +125,8 @@ func.func @ctlz_vector2(%val: vector<2xi32>) -> vector<2xi32> {
|
|||
func.func @powf_scalar(%lhs: f32, %rhs: f32) -> f32 {
|
||||
// CHECK: %[[F0:.+]] = spv.Constant 0.000000e+00 : f32
|
||||
// CHECK: %[[LT:.+]] = spv.FOrdLessThan %[[LHS]], %[[F0]] : f32
|
||||
// CHECK: %[[ABS:.+]] = spv.GLSL.FAbs %[[LHS]] : f32
|
||||
// CHECK: %[[POW:.+]] = spv.GLSL.Pow %[[ABS]], %[[RHS]] : f32
|
||||
// CHECK: %[[ABS:.+]] = spv.GL.FAbs %[[LHS]] : f32
|
||||
// CHECK: %[[POW:.+]] = spv.GL.Pow %[[ABS]], %[[RHS]] : f32
|
||||
// CHECK: %[[NEG:.+]] = spv.FNegate %[[POW]] : f32
|
||||
// CHECK: %[[SEL:.+]] = spv.Select %[[LT]], %[[NEG]], %[[POW]] : i1, f32
|
||||
%0 = math.powf %lhs, %rhs : f32
|
||||
|
@ -137,8 +137,8 @@ func.func @powf_scalar(%lhs: f32, %rhs: f32) -> f32 {
|
|||
// CHECK-LABEL: @powf_vector
|
||||
func.func @powf_vector(%lhs: vector<4xf32>, %rhs: vector<4xf32>) -> vector<4xf32> {
|
||||
// CHECK: spv.FOrdLessThan
|
||||
// CHEKC: spv.GLSL.FAbs
|
||||
// CHECK: spv.GLSL.Pow %{{.*}}: vector<4xf32>
|
||||
// CHEKC: spv.GL.FAbs
|
||||
// CHECK: spv.GL.Pow %{{.*}}: vector<4xf32>
|
||||
// CHECK: spv.FNegate
|
||||
// CHECK: spv.Select
|
||||
%0 = math.powf %lhs, %rhs : vector<4xf32>
|
||||
|
@ -150,8 +150,8 @@ func.func @round_scalar(%x: f32) -> f32 {
|
|||
// CHECK: %[[ZERO:.+]] = spv.Constant 0.000000e+00
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant 1.000000e+00
|
||||
// CHECK: %[[HALF:.+]] = spv.Constant 5.000000e-01
|
||||
// CHECK: %[[ABS:.+]] = spv.GLSL.FAbs %arg0
|
||||
// CHECK: %[[FLOOR:.+]] = spv.GLSL.Floor %[[ABS]]
|
||||
// CHECK: %[[ABS:.+]] = spv.GL.FAbs %arg0
|
||||
// CHECK: %[[FLOOR:.+]] = spv.GL.Floor %[[ABS]]
|
||||
// CHECK: %[[SUB:.+]] = spv.FSub %[[ABS]], %[[FLOOR]]
|
||||
// CHECK: %[[GE:.+]] = spv.FOrdGreaterThanEqual %[[SUB]], %[[HALF]]
|
||||
// CHECK: %[[SEL:.+]] = spv.Select %[[GE]], %[[ONE]], %[[ZERO]]
|
||||
|
@ -166,8 +166,8 @@ func.func @round_vector(%x: vector<4xf32>) -> vector<4xf32> {
|
|||
// CHECK: %[[ZERO:.+]] = spv.Constant dense<0.000000e+00>
|
||||
// CHECK: %[[ONE:.+]] = spv.Constant dense<1.000000e+00>
|
||||
// CHECK: %[[HALF:.+]] = spv.Constant dense<5.000000e-01>
|
||||
// CHECK: %[[ABS:.+]] = spv.GLSL.FAbs %arg0
|
||||
// CHECK: %[[FLOOR:.+]] = spv.GLSL.Floor %[[ABS]]
|
||||
// CHECK: %[[ABS:.+]] = spv.GL.FAbs %arg0
|
||||
// CHECK: %[[FLOOR:.+]] = spv.GL.Floor %[[ABS]]
|
||||
// CHECK: %[[SUB:.+]] = spv.FSub %[[ABS]], %[[FLOOR]]
|
||||
// CHECK: %[[GE:.+]] = spv.FOrdGreaterThanEqual %[[SUB]], %[[HALF]]
|
||||
// CHECK: %[[SEL:.+]] = spv.Select %[[GE]], %[[ONE]], %[[ZERO]]
|
|
@ -1,163 +1,163 @@
|
|||
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Ceil
|
||||
// spv.GL.Ceil
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @ceil
|
||||
spv.func @ceil(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.ceil"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Ceil %arg0 : f32
|
||||
%0 = spv.GL.Ceil %arg0 : f32
|
||||
// CHECK: "llvm.intr.ceil"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Ceil %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Ceil %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Cos
|
||||
// spv.GL.Cos
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @cos
|
||||
spv.func @cos(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.cos"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Cos %arg0 : f32
|
||||
%0 = spv.GL.Cos %arg0 : f32
|
||||
// CHECK: "llvm.intr.cos"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Cos %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Cos %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Exp
|
||||
// spv.GL.Exp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @exp
|
||||
spv.func @exp(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.exp"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Exp %arg0 : f32
|
||||
%0 = spv.GL.Exp %arg0 : f32
|
||||
// CHECK: "llvm.intr.exp"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Exp %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Exp %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FAbs
|
||||
// spv.GL.FAbs
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @fabs
|
||||
spv.func @fabs(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.fabs"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.FAbs %arg0 : f32
|
||||
%0 = spv.GL.FAbs %arg0 : f32
|
||||
// CHECK: "llvm.intr.fabs"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.FAbs %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.FAbs %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Floor
|
||||
// spv.GL.Floor
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @floor
|
||||
spv.func @floor(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.floor"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Floor %arg0 : f32
|
||||
%0 = spv.GL.Floor %arg0 : f32
|
||||
// CHECK: "llvm.intr.floor"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Floor %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Floor %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FMax
|
||||
// spv.GL.FMax
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @fmax
|
||||
spv.func @fmax(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.maxnum"(%{{.*}}, %{{.*}}) : (f32, f32) -> f32
|
||||
%0 = spv.GLSL.FMax %arg0, %arg0 : f32
|
||||
%0 = spv.GL.FMax %arg0, %arg0 : f32
|
||||
// CHECK: "llvm.intr.maxnum"(%{{.*}}, %{{.*}}) : (vector<3xf16>, vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.FMax %arg1, %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.FMax %arg1, %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FMin
|
||||
// spv.GL.FMin
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @fmin
|
||||
spv.func @fmin(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.minnum"(%{{.*}}, %{{.*}}) : (f32, f32) -> f32
|
||||
%0 = spv.GLSL.FMin %arg0, %arg0 : f32
|
||||
%0 = spv.GL.FMin %arg0, %arg0 : f32
|
||||
// CHECK: "llvm.intr.minnum"(%{{.*}}, %{{.*}}) : (vector<3xf16>, vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.FMin %arg1, %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.FMin %arg1, %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Log
|
||||
// spv.GL.Log
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @log
|
||||
spv.func @log(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.log"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Log %arg0 : f32
|
||||
%0 = spv.GL.Log %arg0 : f32
|
||||
// CHECK: "llvm.intr.log"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Log %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Log %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Sin
|
||||
// spv.GL.Sin
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @sin
|
||||
spv.func @sin(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.sin"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Sin %arg0 : f32
|
||||
%0 = spv.GL.Sin %arg0 : f32
|
||||
// CHECK: "llvm.intr.sin"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Sin %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Sin %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.SMax
|
||||
// spv.GL.SMax
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @smax
|
||||
spv.func @smax(%arg0: i16, %arg1: vector<3xi32>) "None" {
|
||||
// CHECK: "llvm.intr.smax"(%{{.*}}, %{{.*}}) : (i16, i16) -> i16
|
||||
%0 = spv.GLSL.SMax %arg0, %arg0 : i16
|
||||
%0 = spv.GL.SMax %arg0, %arg0 : i16
|
||||
// CHECK: "llvm.intr.smax"(%{{.*}}, %{{.*}}) : (vector<3xi32>, vector<3xi32>) -> vector<3xi32>
|
||||
%1 = spv.GLSL.SMax %arg1, %arg1 : vector<3xi32>
|
||||
%1 = spv.GL.SMax %arg1, %arg1 : vector<3xi32>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.SMin
|
||||
// spv.GL.SMin
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @smin
|
||||
spv.func @smin(%arg0: i16, %arg1: vector<3xi32>) "None" {
|
||||
// CHECK: "llvm.intr.smin"(%{{.*}}, %{{.*}}) : (i16, i16) -> i16
|
||||
%0 = spv.GLSL.SMin %arg0, %arg0 : i16
|
||||
%0 = spv.GL.SMin %arg0, %arg0 : i16
|
||||
// CHECK: "llvm.intr.smin"(%{{.*}}, %{{.*}}) : (vector<3xi32>, vector<3xi32>) -> vector<3xi32>
|
||||
%1 = spv.GLSL.SMin %arg1, %arg1 : vector<3xi32>
|
||||
%1 = spv.GL.SMin %arg1, %arg1 : vector<3xi32>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Sqrt
|
||||
// spv.GL.Sqrt
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @sqrt
|
||||
spv.func @sqrt(%arg0: f32, %arg1: vector<3xf16>) "None" {
|
||||
// CHECK: "llvm.intr.sqrt"(%{{.*}}) : (f32) -> f32
|
||||
%0 = spv.GLSL.Sqrt %arg0 : f32
|
||||
%0 = spv.GL.Sqrt %arg0 : f32
|
||||
// CHECK: "llvm.intr.sqrt"(%{{.*}}) : (vector<3xf16>) -> vector<3xf16>
|
||||
%1 = spv.GLSL.Sqrt %arg1 : vector<3xf16>
|
||||
%1 = spv.GL.Sqrt %arg1 : vector<3xf16>
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Tan
|
||||
// spv.GL.Tan
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @tan
|
||||
|
@ -165,12 +165,12 @@ spv.func @tan(%arg0: f32) "None" {
|
|||
// CHECK: %[[SIN:.*]] = "llvm.intr.sin"(%{{.*}}) : (f32) -> f32
|
||||
// CHECK: %[[COS:.*]] = "llvm.intr.cos"(%{{.*}}) : (f32) -> f32
|
||||
// CHECK: llvm.fdiv %[[SIN]], %[[COS]] : f32
|
||||
%0 = spv.GLSL.Tan %arg0 : f32
|
||||
%0 = spv.GL.Tan %arg0 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Tanh
|
||||
// spv.GL.Tanh
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @tanh
|
||||
|
@ -182,12 +182,12 @@ spv.func @tanh(%arg0: f32) "None" {
|
|||
// CHECK: %[[T0:.*]] = llvm.fsub %[[EXP]], %[[ONE]] : f32
|
||||
// CHECK: %[[T1:.*]] = llvm.fadd %[[EXP]], %[[ONE]] : f32
|
||||
// CHECK: llvm.fdiv %[[T0]], %[[T1]] : f32
|
||||
%0 = spv.GLSL.Tanh %arg0 : f32
|
||||
%0 = spv.GL.Tanh %arg0 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.InverseSqrt
|
||||
// spv.GL.InverseSqrt
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @inverse_sqrt
|
||||
|
@ -195,6 +195,6 @@ spv.func @inverse_sqrt(%arg0: f32) "None" {
|
|||
// CHECK: %[[ONE:.*]] = llvm.mlir.constant(1.000000e+00 : f32) : f32
|
||||
// CHECK: %[[SQRT:.*]] = "llvm.intr.sqrt"(%{{.*}}) : (f32) -> f32
|
||||
// CHECK: llvm.fdiv %[[ONE]], %[[SQRT]] : f32
|
||||
%0 = spv.GLSL.InverseSqrt %arg0 : f32
|
||||
%0 = spv.GL.InverseSqrt %arg0 : f32
|
||||
spv.Return
|
||||
}
|
|
@ -163,7 +163,7 @@ func.func @insert_size1_vector(%arg0 : vector<1xf32>, %arg1: vector<3xf32>) -> v
|
|||
|
||||
// CHECK-LABEL: @fma
|
||||
// CHECK-SAME: %[[A:.*]]: vector<4xf32>, %[[B:.*]]: vector<4xf32>, %[[C:.*]]: vector<4xf32>
|
||||
// CHECK: spv.GLSL.Fma %[[A]], %[[B]], %[[C]] : vector<4xf32>
|
||||
// CHECK: spv.GL.Fma %[[A]], %[[B]], %[[C]] : vector<4xf32>
|
||||
func.func @fma(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) -> vector<4xf32> {
|
||||
%0 = vector.fma %a, %b, %c: vector<4xf32>
|
||||
return %0 : vector<4xf32>
|
||||
|
@ -172,7 +172,7 @@ func.func @fma(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) -> vecto
|
|||
// -----
|
||||
|
||||
// CHECK-LABEL: @fma_size1_vector
|
||||
// CHECK: spv.GLSL.Fma %{{.+}} : f32
|
||||
// CHECK: spv.GL.Fma %{{.+}} : f32
|
||||
func.func @fma_size1_vector(%a: vector<1xf32>, %b: vector<1xf32>, %c: vector<1xf32>) -> vector<1xf32> {
|
||||
%0 = vector.fma %a, %b, %c: vector<1xf32>
|
||||
return %0 : vector<1xf32>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Exp
|
||||
// spv.GL.Exp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @exp(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Exp {{%.*}} : f32
|
||||
%2 = spv.GLSL.Exp %arg0 : f32
|
||||
// CHECK: spv.GL.Exp {{%.*}} : f32
|
||||
%2 = spv.GL.Exp %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @expvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Exp {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Exp %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Exp {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Exp %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ func.func @expvec(%arg0 : vector<3xf16>) -> () {
|
|||
|
||||
func.func @exp(%arg0 : i32) -> () {
|
||||
// expected-error @+1 {{op operand #0 must be 16/32-bit float or vector of 16/32-bit float values}}
|
||||
%2 = spv.GLSL.Exp %arg0 : i32
|
||||
%2 = spv.GL.Exp %arg0 : i32
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ func.func @exp(%arg0 : i32) -> () {
|
|||
|
||||
func.func @exp(%arg0 : vector<5xf32>) -> () {
|
||||
// expected-error @+1 {{op operand #0 must be 16/32-bit float or vector of 16/32-bit float values of length 2/3/4}}
|
||||
%2 = spv.GLSL.Exp %arg0 : vector<5xf32>
|
||||
%2 = spv.GL.Exp %arg0 : vector<5xf32>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func.func @exp(%arg0 : vector<5xf32>) -> () {
|
|||
|
||||
func.func @exp(%arg0 : f32, %arg1 : f32) -> () {
|
||||
// expected-error @+1 {{expected ':'}}
|
||||
%2 = spv.GLSL.Exp %arg0, %arg1 : i32
|
||||
%2 = spv.GL.Exp %arg0, %arg1 : i32
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -44,366 +44,366 @@ func.func @exp(%arg0 : f32, %arg1 : f32) -> () {
|
|||
|
||||
func.func @exp(%arg0 : i32) -> () {
|
||||
// expected-error @+1 {{expected non-function type}}
|
||||
%2 = spv.GLSL.Exp %arg0 :
|
||||
%2 = spv.GL.Exp %arg0 :
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.{F|S|U}{Max|Min}
|
||||
// spv.GL.{F|S|U}{Max|Min}
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @fmaxmin(%arg0 : f32, %arg1 : f32) {
|
||||
// CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f32
|
||||
%1 = spv.GLSL.FMax %arg0, %arg1 : f32
|
||||
// CHECK: spv.GLSL.FMin {{%.*}}, {{%.*}} : f32
|
||||
%2 = spv.GLSL.FMin %arg0, %arg1 : f32
|
||||
// CHECK: spv.GL.FMax {{%.*}}, {{%.*}} : f32
|
||||
%1 = spv.GL.FMax %arg0, %arg1 : f32
|
||||
// CHECK: spv.GL.FMin {{%.*}}, {{%.*}} : f32
|
||||
%2 = spv.GL.FMin %arg0, %arg1 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @fmaxminvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) {
|
||||
// CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%1 = spv.GLSL.FMax %arg0, %arg1 : vector<3xf16>
|
||||
// CHECK: spv.GLSL.FMin {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.FMin %arg0, %arg1 : vector<3xf16>
|
||||
// CHECK: spv.GL.FMax {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%1 = spv.GL.FMax %arg0, %arg1 : vector<3xf16>
|
||||
// CHECK: spv.GL.FMin {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.FMin %arg0, %arg1 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
func.func @fmaxminf64(%arg0 : f64, %arg1 : f64) {
|
||||
// CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f64
|
||||
%1 = spv.GLSL.FMax %arg0, %arg1 : f64
|
||||
// CHECK: spv.GLSL.FMin {{%.*}}, {{%.*}} : f64
|
||||
%2 = spv.GLSL.FMin %arg0, %arg1 : f64
|
||||
// CHECK: spv.GL.FMax {{%.*}}, {{%.*}} : f64
|
||||
%1 = spv.GL.FMax %arg0, %arg1 : f64
|
||||
// CHECK: spv.GL.FMin {{%.*}}, {{%.*}} : f64
|
||||
%2 = spv.GL.FMin %arg0, %arg1 : f64
|
||||
return
|
||||
}
|
||||
|
||||
func.func @iminmax(%arg0: i32, %arg1: i32) {
|
||||
// CHECK: spv.GLSL.SMax {{%.*}}, {{%.*}} : i32
|
||||
%1 = spv.GLSL.SMax %arg0, %arg1 : i32
|
||||
// CHECK: spv.GLSL.UMax {{%.*}}, {{%.*}} : i32
|
||||
%2 = spv.GLSL.UMax %arg0, %arg1 : i32
|
||||
// CHECK: spv.GLSL.SMin {{%.*}}, {{%.*}} : i32
|
||||
%3 = spv.GLSL.SMin %arg0, %arg1 : i32
|
||||
// CHECK: spv.GLSL.UMin {{%.*}}, {{%.*}} : i32
|
||||
%4 = spv.GLSL.UMin %arg0, %arg1 : i32
|
||||
// CHECK: spv.GL.SMax {{%.*}}, {{%.*}} : i32
|
||||
%1 = spv.GL.SMax %arg0, %arg1 : i32
|
||||
// CHECK: spv.GL.UMax {{%.*}}, {{%.*}} : i32
|
||||
%2 = spv.GL.UMax %arg0, %arg1 : i32
|
||||
// CHECK: spv.GL.SMin {{%.*}}, {{%.*}} : i32
|
||||
%3 = spv.GL.SMin %arg0, %arg1 : i32
|
||||
// CHECK: spv.GL.UMin {{%.*}}, {{%.*}} : i32
|
||||
%4 = spv.GL.UMin %arg0, %arg1 : i32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.InverseSqrt
|
||||
// spv.GL.InverseSqrt
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @inversesqrt(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.InverseSqrt {{%.*}} : f32
|
||||
%2 = spv.GLSL.InverseSqrt %arg0 : f32
|
||||
// CHECK: spv.GL.InverseSqrt {{%.*}} : f32
|
||||
%2 = spv.GL.InverseSqrt %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @inversesqrtvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.InverseSqrt {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.InverseSqrt %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.InverseSqrt {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.InverseSqrt %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Sqrt
|
||||
// spv.GL.Sqrt
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @sqrt(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Sqrt {{%.*}} : f32
|
||||
%2 = spv.GLSL.Sqrt %arg0 : f32
|
||||
// CHECK: spv.GL.Sqrt {{%.*}} : f32
|
||||
%2 = spv.GL.Sqrt %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @sqrtvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Sqrt {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Sqrt %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Sqrt {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Sqrt %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Cos
|
||||
// spv.GL.Cos
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @cos(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Cos {{%.*}} : f32
|
||||
%2 = spv.GLSL.Cos %arg0 : f32
|
||||
// CHECK: spv.GL.Cos {{%.*}} : f32
|
||||
%2 = spv.GL.Cos %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @cosvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Cos {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Cos %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Cos {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Cos %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Sin
|
||||
// spv.GL.Sin
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @sin(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Sin {{%.*}} : f32
|
||||
%2 = spv.GLSL.Sin %arg0 : f32
|
||||
// CHECK: spv.GL.Sin {{%.*}} : f32
|
||||
%2 = spv.GL.Sin %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @sinvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Sin {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Sin %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Sin {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Sin %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Tan
|
||||
// spv.GL.Tan
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @tan(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Tan {{%.*}} : f32
|
||||
%2 = spv.GLSL.Tan %arg0 : f32
|
||||
// CHECK: spv.GL.Tan {{%.*}} : f32
|
||||
%2 = spv.GL.Tan %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @tanvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Tan {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Tan %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Tan {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Tan %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Acos
|
||||
// spv.GL.Acos
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @acos(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Acos {{%.*}} : f32
|
||||
%2 = spv.GLSL.Acos %arg0 : f32
|
||||
// CHECK: spv.GL.Acos {{%.*}} : f32
|
||||
%2 = spv.GL.Acos %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @acosvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Acos {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Acos %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Acos {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Acos %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Asin
|
||||
// spv.GL.Asin
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @asin(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Asin {{%.*}} : f32
|
||||
%2 = spv.GLSL.Asin %arg0 : f32
|
||||
// CHECK: spv.GL.Asin {{%.*}} : f32
|
||||
%2 = spv.GL.Asin %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @asinvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Asin {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Asin %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Asin {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Asin %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Atan
|
||||
// spv.GL.Atan
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @atan(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Atan {{%.*}} : f32
|
||||
%2 = spv.GLSL.Atan %arg0 : f32
|
||||
// CHECK: spv.GL.Atan {{%.*}} : f32
|
||||
%2 = spv.GL.Atan %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @atanvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Atan {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Atan %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Atan {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Atan %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Sinh
|
||||
// spv.GL.Sinh
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @sinh(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Sinh {{%.*}} : f32
|
||||
%2 = spv.GLSL.Sinh %arg0 : f32
|
||||
// CHECK: spv.GL.Sinh {{%.*}} : f32
|
||||
%2 = spv.GL.Sinh %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @sinhvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Sinh {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Sinh %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Sinh {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Sinh %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Cosh
|
||||
// spv.GL.Cosh
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @cosh(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Cosh {{%.*}} : f32
|
||||
%2 = spv.GLSL.Cosh %arg0 : f32
|
||||
// CHECK: spv.GL.Cosh {{%.*}} : f32
|
||||
%2 = spv.GL.Cosh %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @coshvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Cosh {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Cosh %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Cosh {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Cosh %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Pow
|
||||
// spv.GL.Pow
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @pow(%arg0 : f32, %arg1 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Pow {{%.*}}, {{%.*}} : f32
|
||||
%2 = spv.GLSL.Pow %arg0, %arg1 : f32
|
||||
// CHECK: spv.GL.Pow {{%.*}}, {{%.*}} : f32
|
||||
%2 = spv.GL.Pow %arg0, %arg1 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @powvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Pow {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Pow %arg0, %arg1 : vector<3xf16>
|
||||
// CHECK: spv.GL.Pow {{%.*}}, {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Pow %arg0, %arg1 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Round
|
||||
// spv.GL.Round
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @round(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.Round {{%.*}} : f32
|
||||
%2 = spv.GLSL.Round %arg0 : f32
|
||||
// CHECK: spv.GL.Round {{%.*}} : f32
|
||||
%2 = spv.GL.Round %arg0 : f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @roundvec(%arg0 : vector<3xf16>) -> () {
|
||||
// CHECK: spv.GLSL.Round {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GLSL.Round %arg0 : vector<3xf16>
|
||||
// CHECK: spv.GL.Round {{%.*}} : vector<3xf16>
|
||||
%2 = spv.GL.Round %arg0 : vector<3xf16>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FClamp
|
||||
// spv.GL.FClamp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @fclamp(%arg0 : f32, %min : f32, %max : f32) -> () {
|
||||
// CHECK: spv.GLSL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%2 = spv.GLSL.FClamp %arg0, %min, %max : f32
|
||||
// CHECK: spv.GL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%2 = spv.GL.FClamp %arg0, %min, %max : f32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @fclamp(%arg0 : vector<3xf32>, %min : vector<3xf32>, %max : vector<3xf32>) -> () {
|
||||
// CHECK: spv.GLSL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
|
||||
%2 = spv.GLSL.FClamp %arg0, %min, %max : vector<3xf32>
|
||||
// CHECK: spv.GL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
|
||||
%2 = spv.GL.FClamp %arg0, %min, %max : vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.UClamp
|
||||
// spv.GL.UClamp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @uclamp(%arg0 : ui32, %min : ui32, %max : ui32) -> () {
|
||||
// CHECK: spv.GLSL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : ui32
|
||||
%2 = spv.GLSL.UClamp %arg0, %min, %max : ui32
|
||||
// CHECK: spv.GL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : ui32
|
||||
%2 = spv.GL.UClamp %arg0, %min, %max : ui32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @uclamp(%arg0 : vector<4xi32>, %min : vector<4xi32>, %max : vector<4xi32>) -> () {
|
||||
// CHECK: spv.GLSL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<4xi32>
|
||||
%2 = spv.GLSL.UClamp %arg0, %min, %max : vector<4xi32>
|
||||
// CHECK: spv.GL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<4xi32>
|
||||
%2 = spv.GL.UClamp %arg0, %min, %max : vector<4xi32>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @uclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
|
||||
// CHECK: spv.GLSL.UClamp
|
||||
%2 = spv.GLSL.UClamp %arg0, %min, %max : si32
|
||||
// CHECK: spv.GL.UClamp
|
||||
%2 = spv.GL.UClamp %arg0, %min, %max : si32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.SClamp
|
||||
// spv.GL.SClamp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @sclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
|
||||
// CHECK: spv.GLSL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : si32
|
||||
%2 = spv.GLSL.SClamp %arg0, %min, %max : si32
|
||||
// CHECK: spv.GL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : si32
|
||||
%2 = spv.GL.SClamp %arg0, %min, %max : si32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @sclamp(%arg0 : vector<4xsi32>, %min : vector<4xsi32>, %max : vector<4xsi32>) -> () {
|
||||
// CHECK: spv.GLSL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<4xsi32>
|
||||
%2 = spv.GLSL.SClamp %arg0, %min, %max : vector<4xsi32>
|
||||
// CHECK: spv.GL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<4xsi32>
|
||||
%2 = spv.GL.SClamp %arg0, %min, %max : vector<4xsi32>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @sclamp(%arg0 : i32, %min : i32, %max : i32) -> () {
|
||||
// CHECK: spv.GLSL.SClamp
|
||||
%2 = spv.GLSL.SClamp %arg0, %min, %max : i32
|
||||
// CHECK: spv.GL.SClamp
|
||||
%2 = spv.GL.SClamp %arg0, %min, %max : i32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Fma
|
||||
// spv.GL.Fma
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @fma(%a : f32, %b : f32, %c : f32) -> () {
|
||||
// CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%2 = spv.GLSL.Fma %a, %b, %c : f32
|
||||
// CHECK: spv.GL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%2 = spv.GL.Fma %a, %b, %c : f32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func.func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () {
|
||||
// CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
|
||||
%2 = spv.GLSL.Fma %a, %b, %c : vector<3xf32>
|
||||
// CHECK: spv.GL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
|
||||
%2 = spv.GL.Fma %a, %b, %c : vector<3xf32>
|
||||
return
|
||||
}
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FrexpStruct
|
||||
// spv.GL.FrexpStruct
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @frexp_struct(%arg0 : f32) -> () {
|
||||
// CHECK: spv.GLSL.FrexpStruct {{%.*}} : f32 -> !spv.struct<(f32, i32)>
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i32)>
|
||||
// CHECK: spv.GL.FrexpStruct {{%.*}} : f32 -> !spv.struct<(f32, i32)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i32)>
|
||||
return
|
||||
}
|
||||
|
||||
func.func @frexp_struct_64(%arg0 : f64) -> () {
|
||||
// CHECK: spv.GLSL.FrexpStruct {{%.*}} : f64 -> !spv.struct<(f64, i32)>
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : f64 -> !spv.struct<(f64, i32)>
|
||||
// CHECK: spv.GL.FrexpStruct {{%.*}} : f64 -> !spv.struct<(f64, i32)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : f64 -> !spv.struct<(f64, i32)>
|
||||
return
|
||||
}
|
||||
|
||||
func.func @frexp_struct_vec(%arg0 : vector<3xf32>) -> () {
|
||||
// CHECK: spv.GLSL.FrexpStruct {{%.*}} : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<3xi32>)>
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<3xi32>)>
|
||||
// CHECK: spv.GL.FrexpStruct {{%.*}} : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<3xi32>)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<3xi32>)>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ func.func @frexp_struct_vec(%arg0 : vector<3xf32>) -> () {
|
|||
|
||||
func.func @frexp_struct_mismatch_type(%arg0 : f32) -> () {
|
||||
// expected-error @+1 {{member zero of the resulting struct type must be the same type as the operand}}
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : f32 -> !spv.struct<(vector<3xf32>, i32)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : f32 -> !spv.struct<(vector<3xf32>, i32)>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ func.func @frexp_struct_mismatch_type(%arg0 : f32) -> () {
|
|||
|
||||
func.func @frexp_struct_wrong_type(%arg0 : i32) -> () {
|
||||
// expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : i32 -> !spv.struct<(i32, i32)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : i32 -> !spv.struct<(i32, i32)>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ func.func @frexp_struct_wrong_type(%arg0 : i32) -> () {
|
|||
|
||||
func.func @frexp_struct_mismatch_num_components(%arg0 : vector<3xf32>) -> () {
|
||||
// expected-error @+1 {{member one of the resulting struct type must have the same number of components as the operand type}}
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<2xi32>)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : vector<3xf32> -> !spv.struct<(vector<3xf32>, vector<2xi32>)>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -435,26 +435,26 @@ func.func @frexp_struct_mismatch_num_components(%arg0 : vector<3xf32>) -> () {
|
|||
|
||||
func.func @frexp_struct_not_i32(%arg0 : f32) -> () {
|
||||
// expected-error @+1 {{member one of the resulting struct type must be a scalar or vector of 32 bit integer type}}
|
||||
%2 = spv.GLSL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i64)>
|
||||
%2 = spv.GL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i64)>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Ldexp
|
||||
// spv.GL.Ldexp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @ldexp(%arg0 : f32, %arg1 : i32) -> () {
|
||||
// CHECK: {{%.*}} = spv.GLSL.Ldexp {{%.*}} : f32, {{%.*}} : i32 -> f32
|
||||
%0 = spv.GLSL.Ldexp %arg0 : f32, %arg1 : i32 -> f32
|
||||
// CHECK: {{%.*}} = spv.GL.Ldexp {{%.*}} : f32, {{%.*}} : i32 -> f32
|
||||
%0 = spv.GL.Ldexp %arg0 : f32, %arg1 : i32 -> f32
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
func.func @ldexp_vec(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) -> () {
|
||||
// CHECK: {{%.*}} = spv.GLSL.Ldexp {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xi32> -> vector<3xf32>
|
||||
%0 = spv.GLSL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<3xi32> -> vector<3xf32>
|
||||
// CHECK: {{%.*}} = spv.GL.Ldexp {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xi32> -> vector<3xf32>
|
||||
%0 = spv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<3xi32> -> vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ func.func @ldexp_vec(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) -> () {
|
|||
|
||||
func.func @ldexp_wrong_type_scalar(%arg0 : f32, %arg1 : vector<2xi32>) -> () {
|
||||
// expected-error @+1 {{operands must both be scalars or vectors}}
|
||||
%0 = spv.GLSL.Ldexp %arg0 : f32, %arg1 : vector<2xi32> -> f32
|
||||
%0 = spv.GL.Ldexp %arg0 : f32, %arg1 : vector<2xi32> -> f32
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ func.func @ldexp_wrong_type_scalar(%arg0 : f32, %arg1 : vector<2xi32>) -> () {
|
|||
|
||||
func.func @ldexp_wrong_type_vec_1(%arg0 : vector<3xf32>, %arg1 : i32) -> () {
|
||||
// expected-error @+1 {{operands must both be scalars or vectors}}
|
||||
%0 = spv.GLSL.Ldexp %arg0 : vector<3xf32>, %arg1 : i32 -> vector<3xf32>
|
||||
%0 = spv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : i32 -> vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -478,43 +478,43 @@ func.func @ldexp_wrong_type_vec_1(%arg0 : vector<3xf32>, %arg1 : i32) -> () {
|
|||
|
||||
func.func @ldexp_wrong_type_vec_2(%arg0 : vector<3xf32>, %arg1 : vector<2xi32>) -> () {
|
||||
// expected-error @+1 {{operands must have the same number of elements}}
|
||||
%0 = spv.GLSL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<2xi32> -> vector<3xf32>
|
||||
%0 = spv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<2xi32> -> vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.FMix
|
||||
// spv.GL.FMix
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @fmix(%arg0 : f32, %arg1 : f32, %arg2 : f32) -> () {
|
||||
// CHECK: {{%.*}} = spv.GLSL.FMix {{%.*}} : f32, {{%.*}} : f32, {{%.*}} : f32 -> f32
|
||||
%0 = spv.GLSL.FMix %arg0 : f32, %arg1 : f32, %arg2 : f32 -> f32
|
||||
// CHECK: {{%.*}} = spv.GL.FMix {{%.*}} : f32, {{%.*}} : f32, {{%.*}} : f32 -> f32
|
||||
%0 = spv.GL.FMix %arg0 : f32, %arg1 : f32, %arg2 : f32 -> f32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @fmix_vector(%arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32>) -> () {
|
||||
// CHECK: {{%.*}} = spv.GLSL.FMix {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xf32> -> vector<3xf32>
|
||||
%0 = spv.GLSL.FMix %arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32> -> vector<3xf32>
|
||||
// CHECK: {{%.*}} = spv.GL.FMix {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xf32>, {{%.*}} : vector<3xf32> -> vector<3xf32>
|
||||
%0 = spv.GL.FMix %arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32> -> vector<3xf32>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// spv.GLSL.Exp
|
||||
// spv.GL.Exp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func.func @findumsb(%arg0 : i32) -> () {
|
||||
// CHECK: spv.GLSL.FindUMsb {{%.*}} : i32
|
||||
%2 = spv.GLSL.FindUMsb %arg0 : i32
|
||||
// CHECK: spv.GL.FindUMsb {{%.*}} : i32
|
||||
%2 = spv.GL.FindUMsb %arg0 : i32
|
||||
return
|
||||
}
|
||||
|
||||
func.func @findumsb_vector(%arg0 : vector<3xi32>) -> () {
|
||||
// CHECK: spv.GLSL.FindUMsb {{%.*}} : vector<3xi32>
|
||||
%2 = spv.GLSL.FindUMsb %arg0 : vector<3xi32>
|
||||
// CHECK: spv.GL.FindUMsb {{%.*}} : vector<3xi32>
|
||||
%2 = spv.GL.FindUMsb %arg0 : vector<3xi32>
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -522,6 +522,6 @@ func.func @findumsb_vector(%arg0 : vector<3xi32>) -> () {
|
|||
|
||||
func.func @findumsb(%arg0 : i64) -> () {
|
||||
// expected-error @+1 {{operand #0 must be Int32 or vector of Int32}}
|
||||
%2 = spv.GLSL.FindUMsb %arg0 : i64
|
||||
%2 = spv.GL.FindUMsb %arg0 : i64
|
||||
return
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
// RUN: mlir-opt -split-input-file -spirv-canonicalize-glsl %s | FileCheck %s
|
||||
// RUN: mlir-opt -split-input-file -spirv-canonicalize-gl %s | FileCheck %s
|
||||
|
||||
// CHECK-LABEL: func @clamp_fordlessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
|
||||
func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.FOrdLessThan %min, %input : f32
|
||||
%mid = spv.Select %0, %input, %min : i1, f32
|
||||
%1 = spv.FOrdLessThan %mid, %max : f32
|
||||
|
@ -18,7 +18,7 @@ func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
|
|||
// CHECK-LABEL: func @clamp_fordlessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
|
||||
func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.FOrdLessThan %input, %min : f32
|
||||
%mid = spv.Select %0, %min, %input : i1, f32
|
||||
%1 = spv.FOrdLessThan %max, %input : f32
|
||||
|
@ -33,7 +33,7 @@ func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
|
|||
// CHECK-LABEL: func @clamp_fordlessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
|
||||
func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.FOrdLessThanEqual %min, %input : f32
|
||||
%mid = spv.Select %0, %input, %min : i1, f32
|
||||
%1 = spv.FOrdLessThanEqual %mid, %max : f32
|
||||
|
@ -48,7 +48,7 @@ func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
|
|||
// CHECK-LABEL: func @clamp_fordlessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
|
||||
func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.FOrdLessThanEqual %input, %min : f32
|
||||
%mid = spv.Select %0, %min, %input : i1, f32
|
||||
%1 = spv.FOrdLessThanEqual %max, %input : f32
|
||||
|
@ -63,7 +63,7 @@ func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
|
|||
// CHECK-LABEL: func @clamp_slessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
|
||||
func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.SLessThan %min, %input : si32
|
||||
%mid = spv.Select %0, %input, %min : i1, si32
|
||||
%1 = spv.SLessThan %mid, %max : si32
|
||||
|
@ -78,7 +78,7 @@ func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
|
|||
// CHECK-LABEL: func @clamp_slessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
|
||||
func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.SLessThan %input, %min : si32
|
||||
%mid = spv.Select %0, %min, %input : i1, si32
|
||||
%1 = spv.SLessThan %max, %input : si32
|
||||
|
@ -93,7 +93,7 @@ func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
|
|||
// CHECK-LABEL: func @clamp_slessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
|
||||
func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.SLessThanEqual %min, %input : si32
|
||||
%mid = spv.Select %0, %input, %min : i1, si32
|
||||
%1 = spv.SLessThanEqual %mid, %max : si32
|
||||
|
@ -108,7 +108,7 @@ func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
|
|||
// CHECK-LABEL: func @clamp_slessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
|
||||
func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.SLessThanEqual %input, %min : si32
|
||||
%mid = spv.Select %0, %min, %input : i1, si32
|
||||
%1 = spv.SLessThanEqual %max, %input : si32
|
||||
|
@ -123,7 +123,7 @@ func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
|
|||
// CHECK-LABEL: func @clamp_ulessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
|
||||
func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.ULessThan %min, %input : i32
|
||||
%mid = spv.Select %0, %input, %min : i1, i32
|
||||
%1 = spv.ULessThan %mid, %max : i32
|
||||
|
@ -138,7 +138,7 @@ func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
|
|||
// CHECK-LABEL: func @clamp_ulessthan
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
|
||||
func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.ULessThan %input, %min : i32
|
||||
%mid = spv.Select %0, %min, %input : i1, i32
|
||||
%1 = spv.ULessThan %max, %input : i32
|
||||
|
@ -153,7 +153,7 @@ func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
|
|||
// CHECK-LABEL: func @clamp_ulessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
|
||||
func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.ULessThanEqual %min, %input : i32
|
||||
%mid = spv.Select %0, %input, %min : i1, i32
|
||||
%1 = spv.ULessThanEqual %mid, %max : i32
|
||||
|
@ -168,7 +168,7 @@ func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
|
|||
// CHECK-LABEL: func @clamp_ulessthanequal
|
||||
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
|
||||
func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
|
||||
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
// CHECK: [[RES:%.*]] = spv.GL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
|
||||
%0 = spv.ULessThanEqual %input, %min : i32
|
||||
%mid = spv.Select %0, %min, %input : i1, i32
|
||||
%1 = spv.ULessThanEqual %max, %input : i32
|
|
@ -0,0 +1,84 @@
|
|||
// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
spv.func @math(%arg0 : f32, %arg1 : f32, %arg2 : i32) "None" {
|
||||
// CHECK: {{%.*}} = spv.GL.Exp {{%.*}} : f32
|
||||
%0 = spv.GL.Exp %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Sqrt {{%.*}} : f32
|
||||
%2 = spv.GL.Sqrt %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Cos {{%.*}} : f32
|
||||
%3 = spv.GL.Cos %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Sin {{%.*}} : f32
|
||||
%4 = spv.GL.Sin %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Tan {{%.*}} : f32
|
||||
%5 = spv.GL.Tan %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Acos {{%.*}} : f32
|
||||
%6 = spv.GL.Acos %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Asin {{%.*}} : f32
|
||||
%7 = spv.GL.Asin %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Atan {{%.*}} : f32
|
||||
%8 = spv.GL.Atan %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Sinh {{%.*}} : f32
|
||||
%9 = spv.GL.Sinh %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Cosh {{%.*}} : f32
|
||||
%10 = spv.GL.Cosh %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Pow {{%.*}} : f32
|
||||
%11 = spv.GL.Pow %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.Round {{%.*}} : f32
|
||||
%12 = spv.GL.Round %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.FrexpStruct {{%.*}} : f32 -> !spv.struct<(f32, i32)>
|
||||
%13 = spv.GL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i32)>
|
||||
// CHECK: {{%.*}} = spv.GL.Ldexp {{%.*}} : f32, {{%.*}} : i32 -> f32
|
||||
%14 = spv.GL.Ldexp %arg0 : f32, %arg2 : i32 -> f32
|
||||
// CHECK: {{%.*}} = spv.GL.FMix {{%.*}} : f32, {{%.*}} : f32, {{%.*}} : f32 -> f32
|
||||
%15 = spv.GL.FMix %arg0 : f32, %arg1 : f32, %arg0 : f32 -> f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @maxmin(%arg0 : f32, %arg1 : f32, %arg2 : i32, %arg3 : i32) "None" {
|
||||
// CHECK: {{%.*}} = spv.GL.FMax {{%.*}}, {{%.*}} : f32
|
||||
%1 = spv.GL.FMax %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.SMax {{%.*}}, {{%.*}} : i32
|
||||
%2 = spv.GL.SMax %arg2, %arg3 : i32
|
||||
// CHECK: {{%.*}} = spv.GL.UMax {{%.*}}, {{%.*}} : i32
|
||||
%3 = spv.GL.UMax %arg2, %arg3 : i32
|
||||
|
||||
// CHECK: {{%.*}} = spv.GL.FMin {{%.*}}, {{%.*}} : f32
|
||||
%4 = spv.GL.FMin %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GL.SMin {{%.*}}, {{%.*}} : i32
|
||||
%5 = spv.GL.SMin %arg2, %arg3 : i32
|
||||
// CHECK: {{%.*}} = spv.GL.UMin {{%.*}}, {{%.*}} : i32
|
||||
%6 = spv.GL.UMin %arg2, %arg3 : i32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @fclamp(%arg0 : f32, %arg1 : f32, %arg2 : f32) "None" {
|
||||
// CHECK: spv.GL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%13 = spv.GL.FClamp %arg0, %arg1, %arg2 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @uclamp(%arg0 : ui32, %arg1 : ui32, %arg2 : ui32) "None" {
|
||||
// CHECK: spv.GL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : i32
|
||||
%13 = spv.GL.UClamp %arg0, %arg1, %arg2 : ui32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @sclamp(%arg0 : si32, %arg1 : si32, %arg2 : si32) "None" {
|
||||
// CHECK: spv.GL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : si32
|
||||
%13 = spv.GL.SClamp %arg0, %arg1, %arg2 : si32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @fma(%arg0 : f32, %arg1 : f32, %arg2 : f32) "None" {
|
||||
// CHECK: spv.GL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%13 = spv.GL.Fma %arg0, %arg1, %arg2 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @findumsb(%arg0 : i32) "None" {
|
||||
// CHECK: spv.GL.FindUMsb {{%.*}} : i32
|
||||
%2 = spv.GL.FindUMsb %arg0 : i32
|
||||
spv.Return
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s
|
||||
|
||||
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
||||
spv.func @math(%arg0 : f32, %arg1 : f32, %arg2 : i32) "None" {
|
||||
// CHECK: {{%.*}} = spv.GLSL.Exp {{%.*}} : f32
|
||||
%0 = spv.GLSL.Exp %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Sqrt {{%.*}} : f32
|
||||
%2 = spv.GLSL.Sqrt %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Cos {{%.*}} : f32
|
||||
%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
|
||||
// CHECK: {{%.*}} = spv.GLSL.Acos {{%.*}} : f32
|
||||
%6 = spv.GLSL.Acos %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Asin {{%.*}} : f32
|
||||
%7 = spv.GLSL.Asin %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Atan {{%.*}} : f32
|
||||
%8 = spv.GLSL.Atan %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Sinh {{%.*}} : f32
|
||||
%9 = spv.GLSL.Sinh %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Cosh {{%.*}} : f32
|
||||
%10 = spv.GLSL.Cosh %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Pow {{%.*}} : f32
|
||||
%11 = spv.GLSL.Pow %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.Round {{%.*}} : f32
|
||||
%12 = spv.GLSL.Round %arg0 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.FrexpStruct {{%.*}} : f32 -> !spv.struct<(f32, i32)>
|
||||
%13 = spv.GLSL.FrexpStruct %arg0 : f32 -> !spv.struct<(f32, i32)>
|
||||
// CHECK: {{%.*}} = spv.GLSL.Ldexp {{%.*}} : f32, {{%.*}} : i32 -> f32
|
||||
%14 = spv.GLSL.Ldexp %arg0 : f32, %arg2 : i32 -> f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.FMix {{%.*}} : f32, {{%.*}} : f32, {{%.*}} : f32 -> f32
|
||||
%15 = spv.GLSL.FMix %arg0 : f32, %arg1 : f32, %arg0 : f32 -> f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @maxmin(%arg0 : f32, %arg1 : f32, %arg2 : i32, %arg3 : i32) "None" {
|
||||
// CHECK: {{%.*}} = spv.GLSL.FMax {{%.*}}, {{%.*}} : f32
|
||||
%1 = spv.GLSL.FMax %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.SMax {{%.*}}, {{%.*}} : i32
|
||||
%2 = spv.GLSL.SMax %arg2, %arg3 : i32
|
||||
// CHECK: {{%.*}} = spv.GLSL.UMax {{%.*}}, {{%.*}} : i32
|
||||
%3 = spv.GLSL.UMax %arg2, %arg3 : i32
|
||||
|
||||
// CHECK: {{%.*}} = spv.GLSL.FMin {{%.*}}, {{%.*}} : f32
|
||||
%4 = spv.GLSL.FMin %arg0, %arg1 : f32
|
||||
// CHECK: {{%.*}} = spv.GLSL.SMin {{%.*}}, {{%.*}} : i32
|
||||
%5 = spv.GLSL.SMin %arg2, %arg3 : i32
|
||||
// CHECK: {{%.*}} = spv.GLSL.UMin {{%.*}}, {{%.*}} : i32
|
||||
%6 = spv.GLSL.UMin %arg2, %arg3 : i32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @fclamp(%arg0 : f32, %arg1 : f32, %arg2 : f32) "None" {
|
||||
// CHECK: spv.GLSL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%13 = spv.GLSL.FClamp %arg0, %arg1, %arg2 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @uclamp(%arg0 : ui32, %arg1 : ui32, %arg2 : ui32) "None" {
|
||||
// CHECK: spv.GLSL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : i32
|
||||
%13 = spv.GLSL.UClamp %arg0, %arg1, %arg2 : ui32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @sclamp(%arg0 : si32, %arg1 : si32, %arg2 : si32) "None" {
|
||||
// CHECK: spv.GLSL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : si32
|
||||
%13 = spv.GLSL.SClamp %arg0, %arg1, %arg2 : si32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @fma(%arg0 : f32, %arg1 : f32, %arg2 : f32) "None" {
|
||||
// CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
|
||||
%13 = spv.GLSL.Fma %arg0, %arg1, %arg2 : f32
|
||||
spv.Return
|
||||
}
|
||||
|
||||
spv.func @findumsb(%arg0 : i32) "None" {
|
||||
// CHECK: spv.GLSL.FindUMsb {{%.*}} : i32
|
||||
%2 = spv.GLSL.FindUMsb %arg0 : i32
|
||||
spv.Return
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue