diff --git a/mlir/docs/Dialects/SPIR-V.md b/mlir/docs/Dialects/SPIR-V.md --- a/mlir/docs/Dialects/SPIR-V.md +++ b/mlir/docs/Dialects/SPIR-V.md @@ -79,7 +79,7 @@ * 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 @@ 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 diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md --- a/mlir/docs/SPIRVToLLVMDialectConversion.md +++ b/mlir/docs/SPIRVToLLVMDialectConversion.md @@ -630,14 +630,14 @@ * 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 @@ 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 diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td @@ -2080,12 +2080,12 @@ Capability<[SPV_C_Matrix]> ]; } -def SPV_D_GLSLShared : I32EnumAttrCase<"GLSLShared", 8> { +def SPV_D_GLShared : I32EnumAttrCase<"GLShared", 8> { list availability = [ Capability<[SPV_C_Shader]> ]; } -def SPV_D_GLSLPacked : I32EnumAttrCase<"GLSLPacked", 9> { +def SPV_D_GLPacked : I32EnumAttrCase<"GLPacked", 9> { list availability = [ Capability<[SPV_C_Shader]> ]; @@ -2550,7 +2550,7 @@ 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, diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h rename from mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h rename to mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h @@ -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_ diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLOps.td rename from mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td rename to mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLOps.td @@ -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 @@ // SPIR-V GLSL 4.50 opcode specification. //===----------------------------------------------------------------------===// -// Base class for all GLSL ops. -class SPV_GLSLOp traits = []> : - SPV_ExtInstOp { +// Base class for all GL ops. +class SPV_GLOp traits = []> : + SPV_ExtInstOp { let availability = [ MinVersion, @@ -32,10 +32,10 @@ ]; } -// Base class for GLSL unary ops. -class SPV_GLSLUnaryOp traits = []> : - SPV_GLSLOp { + SPV_GLOp { let arguments = (ins SPV_ScalarOrVectorOf:$operand @@ -48,19 +48,19 @@ 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 traits = []> : - SPV_GLSLUnaryOp { let assemblyFormat = "$operand `:` type($operand) attr-dict"; } -// Base class for GLSL binary ops. -class SPV_GLSLBinaryOp traits = []> : - SPV_GLSLOp { + SPV_GLOp { let arguments = (ins SPV_ScalarOrVectorOf:$lhs, @@ -74,19 +74,19 @@ 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 traits = []> : - SPV_GLSLBinaryOp { let assemblyFormat = "operands attr-dict `:` type($result)"; } -// Base class for GLSL ternary ops. -class SPV_GLSLTernaryArithmeticOp traits = []> : - SPV_GLSLOp { + SPV_GLOp { let arguments = (ins SPV_ScalarOrVectorOf:$x, @@ -104,7 +104,7 @@ // ----- -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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ 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 @@ ``` 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 @@ ``` 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 @@ ``` 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 @@ 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 @@ 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 @@ 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 @@ ``` - 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 @@ ``` - 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 @@ ``` - 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 @@ ``` - 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 @@ `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 - %3 = spv.GLSL.FrexpStruct %0 : vector<3xf32> -> !spv.struct, vector<3xi32>> + %2 = spv.GL.FrexpStruct %0 : f32 -> !spv.struct + %3 = spv.GL.FrexpStruct %0 : vector<3xf32> -> !spv.struct, vector<3xi32>> ``` }]; @@ -1130,8 +1130,8 @@ }]; } -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 @@ #### 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_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 @@ #### 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 @@ 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 @@ }]; } -#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS +#endif // MLIR_DIALECT_SPIRV_IR_GL_OPS diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td @@ -178,4 +178,4 @@ let hasVerifier = 0; } -#endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS +#endif // MLIR_DIALECT_SPIRV_IR_GL_OPS diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td @@ -30,7 +30,7 @@ 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" diff --git a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h --- a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h +++ b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h @@ -27,10 +27,10 @@ // 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> createCanonicalizeGLSLPass(); +std::unique_ptr> createCanonicalizeGLPass(); /// Creates a module pass that converts composite types used by objects in the /// StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage diff --git a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td --- a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td +++ b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td @@ -17,9 +17,9 @@ 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"> { diff --git a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp --- a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp +++ b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp @@ -51,7 +51,7 @@ /// /// 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 { +struct RemSIOpGLPattern final : public OpConversionPattern { using OpConversionPattern::OpConversionPattern; LogicalResult @@ -442,7 +442,7 @@ } //===----------------------------------------------------------------------===// -// RemSIOpGLSLPattern +// RemSIOpGLPattern //===----------------------------------------------------------------------===// /// Returns signed remainder for `lhs` and `rhs` and lets the result follow @@ -476,9 +476,9 @@ } LogicalResult -RemSIOpGLSLPattern::matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor, - ConversionPatternRewriter &rewriter) const { - Value result = emulateSignedRemainder( +RemSIOpGLPattern::matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor, + ConversionPatternRewriter &rewriter) const { + Value result = emulateSignedRemainder( op.getLoc(), adaptor.getOperands()[0], adaptor.getOperands()[1], adaptor.getOperands()[0], rewriter); rewriter.replaceOp(op, result); @@ -862,7 +862,7 @@ spirv::ElementwiseOpPattern, spirv::ElementwiseOpPattern, spirv::ElementwiseOpPattern, - RemSIOpGLSLPattern, RemSIOpCLPattern, + RemSIOpGLPattern, RemSIOpCLPattern, BitwiseOpPattern, BitwiseOpPattern, XOrIOpLogicalPattern, XOrIOpBooleanPattern, @@ -889,12 +889,12 @@ CmpFOpNanNonePattern, CmpFOpPattern, SelectOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern >(typeConverter, patterns.getContext()); // clang-format on diff --git a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp --- a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp +++ b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp @@ -119,7 +119,7 @@ /// 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 { @@ -147,11 +147,11 @@ Value val31 = getScalarOrVectorI32Constant(type, 31, rewriter, loc); Value val32 = getScalarOrVectorI32Constant(type, 32, rewriter, loc); - Value msb = rewriter.create(loc, input); + Value msb = rewriter.create(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(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 @@ 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(loc, adaptor.getLhs(), zero); - Value abs = rewriter.create(loc, adaptor.getLhs()); - Value pow = rewriter.create(loc, abs, adaptor.getRhs()); + Value abs = rewriter.create(loc, adaptor.getLhs()); + Value pow = rewriter.create(loc, abs, adaptor.getRhs()); Value negate = rewriter.create(loc, pow); rewriter.replaceOpWithNewOp(powfOp, lessThan, negate, pow); return success(); @@ -259,8 +259,8 @@ loc, ty, rewriter.getFloatAttr(ety, 0.5)); } - auto abs = rewriter.create(loc, operand); - auto floor = rewriter.create(loc, abs); + auto abs = rewriter.create(loc, operand); + auto floor = rewriter.create(loc, abs); auto sub = rewriter.create(loc, abs, floor); auto greater = rewriter.create(loc, sub, half); @@ -285,19 +285,19 @@ // GLSL patterns patterns - .add, - ExpM1OpPattern, PowFOpPattern, RoundOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern, - spirv::ElementwiseOpPattern>( + .add, + ExpM1OpPattern, PowFOpPattern, RoundOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern, + spirv::ElementwiseOpPattern>( typeConverter, patterns.getContext()); // OpenCL patterns diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp @@ -866,12 +866,12 @@ }; class InverseSqrtPattern - : public SPIRVToLLVMConversion { + : public SPIRVToLLVMConversion { public: - using SPIRVToLLVMConversion::SPIRVToLLVMConversion; + using SPIRVToLLVMConversion::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 @@ } }; -class TanPattern : public SPIRVToLLVMConversion { +class TanPattern : public SPIRVToLLVMConversion { public: - using SPIRVToLLVMConversion::SPIRVToLLVMConversion; + using SPIRVToLLVMConversion::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 @@ /// ----------- /// exp(2x) + 1 /// -class TanhPattern : public SPIRVToLLVMConversion { +class TanhPattern : public SPIRVToLLVMConversion { public: - using SPIRVToLLVMConversion::SPIRVToLLVMConversion; + using SPIRVToLLVMConversion::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 @@ ErasePattern, ExecutionModePattern, // GLSL extended instruction set ops - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, - DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, + DirectConversionPattern, InverseSqrtPattern, TanPattern, TanhPattern, // Logical ops diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -148,7 +148,7 @@ Type dstType = getTypeConverter()->convertType(fmaOp.getType()); if (!dstType) return failure(); - rewriter.replaceOpWithNewOp( + rewriter.replaceOpWithNewOp( fmaOp, dstType, adaptor.getLhs(), adaptor.getRhs(), adaptor.getAcc()); return success(); } diff --git a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt --- a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt @@ -5,7 +5,7 @@ add_mlir_dialect_library(MLIRSPIRVDialect SPIRVAttributes.cpp SPIRVCanonicalization.cpp - SPIRVGLSLCanonicalization.cpp + SPIRVGLCanonicalization.cpp SPIRVDialect.cpp SPIRVEnums.cpp SPIRVOps.cpp diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td b/mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td @@ -41,18 +41,18 @@ (SPV_LogicalEqualOp $lhs, $rhs)>; //===----------------------------------------------------------------------===// -// spv.Select -> spv.GLSL.*Clamp +// spv.Select -> spv.GL.*Clamp //===----------------------------------------------------------------------===// def ValuesAreEqual : Constraint>; 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< diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVGLCanonicalization.cpp rename from mlir/lib/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.cpp rename to mlir/lib/Dialect/SPIRV/IR/SPIRVGLCanonicalization.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVGLCanonicalization.cpp @@ -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 mlir { namespace spirv { -void populateSPIRVGLSLCanonicalizationPatterns(RewritePatternSet &results) { +void populateSPIRVGLCanonicalizationPatterns(RewritePatternSet &results) { results.add(); if (structTy.getNumElements() != 2) @@ -4222,10 +4221,10 @@ } //===----------------------------------------------------------------------===// -// spv.GLSL.Ldexp +// spv.GL.Ldexp //===----------------------------------------------------------------------===// -LogicalResult spirv::GLSLLdexpOp::verify() { +LogicalResult spirv::GLLdexpOp::verify() { Type significandType = x().getType(); Type exponentType = exp().getType(); diff --git a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt --- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt @@ -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(MLIRSPIRVTransforms - CanonicalizeGLSLPass.cpp + CanonicalizeGLPass.cpp DecorateCompositeTypeLayoutPass.cpp LowerABIAttributesPass.cpp RewriteInsertsPass.cpp diff --git a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLSLPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp rename from mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLSLPass.cpp rename to mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLSLPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.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 { +class CanonicalizeGLPass final + : public SPIRVCanonicalizeGLBase { 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 @@ }; } // namespace -std::unique_ptr> spirv::createCanonicalizeGLSLPass() { - return std::make_unique(); +std::unique_ptr> spirv::createCanonicalizeGLPass() { + return std::make_unique(); } diff --git a/mlir/test/Conversion/ArithmeticToSPIRV/arithmetic-to-spirv.mlir b/mlir/test/Conversion/ArithmeticToSPIRV/arithmetic-to-spirv.mlir --- a/mlir/test/Conversion/ArithmeticToSPIRV/arithmetic-to-spirv.mlir +++ b/mlir/test/Conversion/ArithmeticToSPIRV/arithmetic-to-spirv.mlir @@ -30,8 +30,8 @@ // 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_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 @@ // 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 @@ %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 @@ // 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 @@ %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 @@ // 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> diff --git a/mlir/test/Conversion/MathToSPIRV/math-to-glsl-spirv.mlir b/mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir rename from mlir/test/Conversion/MathToSPIRV/math-to-glsl-spirv.mlir rename to mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir --- a/mlir/test/Conversion/MathToSPIRV/math-to-glsl-spirv.mlir +++ b/mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir @@ -6,67 +6,67 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @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 @@ // 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 @@ // 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 @@ // 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]] diff --git a/mlir/test/Conversion/SPIRVToLLVM/glsl-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/gl-ops-to-llvm.mlir rename from mlir/test/Conversion/SPIRVToLLVM/glsl-ops-to-llvm.mlir rename to mlir/test/Conversion/SPIRVToLLVM/gl-ops-to-llvm.mlir --- a/mlir/test/Conversion/SPIRVToLLVM/glsl-ops-to-llvm.mlir +++ b/mlir/test/Conversion/SPIRVToLLVM/gl-ops-to-llvm.mlir @@ -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 @@ // 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 @@ // 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 @@ // 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 } diff --git a/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir b/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir --- a/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir +++ b/mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir @@ -163,7 +163,7 @@ // 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 @@ // ----- // 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> diff --git a/mlir/test/Dialect/SPIRV/IR/glsl-ops.mlir b/mlir/test/Dialect/SPIRV/IR/gl-ops.mlir rename from mlir/test/Dialect/SPIRV/IR/glsl-ops.mlir rename to mlir/test/Dialect/SPIRV/IR/gl-ops.mlir --- a/mlir/test/Dialect/SPIRV/IR/glsl-ops.mlir +++ b/mlir/test/Dialect/SPIRV/IR/gl-ops.mlir @@ -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 @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 : 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 : 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 : 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_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_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_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_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_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_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_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(%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 } diff --git a/mlir/test/Dialect/SPIRV/Transforms/glsl-canonicalize.mlir b/mlir/test/Dialect/SPIRV/Transforms/gl-canonicalize.mlir rename from mlir/test/Dialect/SPIRV/Transforms/glsl-canonicalize.mlir rename to mlir/test/Dialect/SPIRV/Transforms/gl-canonicalize.mlir --- a/mlir/test/Dialect/SPIRV/Transforms/glsl-canonicalize.mlir +++ b/mlir/test/Dialect/SPIRV/Transforms/gl-canonicalize.mlir @@ -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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 @@ // 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 diff --git a/mlir/test/Target/SPIRV/gl-ops.mlir b/mlir/test/Target/SPIRV/gl-ops.mlir new file mode 100644 --- /dev/null +++ b/mlir/test/Target/SPIRV/gl-ops.mlir @@ -0,0 +1,84 @@ +// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s + +spv.module Logical GLSL450 requires #spv.vce { + 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 + } +} diff --git a/mlir/test/Target/SPIRV/glsl-ops.mlir b/mlir/test/Target/SPIRV/glsl-ops.mlir deleted file mode 100644 --- a/mlir/test/Target/SPIRV/glsl-ops.mlir +++ /dev/null @@ -1,84 +0,0 @@ -// RUN: mlir-translate -test-spirv-roundtrip %s | FileCheck %s - -spv.module Logical GLSL450 requires #spv.vce { - 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 - } -}