128 changes: 64 additions & 64 deletions mlir/test/Dialect/SPIRV/IR/memory-ops.mlir

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions mlir/test/Dialect/SPIRV/IR/misc-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// spv.Undef
//===----------------------------------------------------------------------===//

func @undef() -> () {
func.func @undef() -> () {
// CHECK: %{{.*}} = spv.Undef : f32
%0 = spv.Undef : f32
// CHECK: %{{.*}} = spv.Undef : vector<4xf32>
Expand All @@ -14,31 +14,31 @@ func @undef() -> () {

// -----

func @undef() -> () {
func.func @undef() -> () {
// expected-error @+2{{expected non-function type}}
%0 = spv.Undef :
spv.Return
}

// -----

func @undef() -> () {
func.func @undef() -> () {
// expected-error @+2{{expected ':'}}
%0 = spv.Undef
spv.Return
}

// -----

func @assume_true(%arg : i1) -> () {
func.func @assume_true(%arg : i1) -> () {
// CHECK: spv.AssumeTrueKHR %{{.*}}
spv.AssumeTrueKHR %arg
spv.Return
}

// -----

func @assume_true(%arg : f32) -> () {
func.func @assume_true(%arg : f32) -> () {
// expected-error @+2{{use of value '%arg' expects different type than prior uses: 'i1' vs 'f32'}}
// expected-note @-2 {{prior use here}}
spv.AssumeTrueKHR %arg
Expand Down
54 changes: 27 additions & 27 deletions mlir/test/Dialect/SPIRV/IR/non-uniform-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
// spv.GroupNonUniformBallot
//===----------------------------------------------------------------------===//

func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> {
func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> {
// CHECK: %{{.*}} = spv.GroupNonUniformBallot Workgroup %{{.*}}: vector<4xi32>
%0 = spv.GroupNonUniformBallot Workgroup %predicate : vector<4xi32>
return %0: vector<4xi32>
}

// -----

func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> {
func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> {
// expected-error @+1 {{execution scope must be 'Workgroup' or 'Subgroup'}}
%0 = spv.GroupNonUniformBallot Device %predicate : vector<4xi32>
return %0: vector<4xi32>
}

// -----

func @group_non_uniform_ballot(%predicate: i1) -> vector<4xsi32> {
func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xsi32> {
// expected-error @+1 {{op result #0 must be vector of 8/16/32/64-bit signless/unsigned integer values of length 4, but got 'vector<4xsi32>'}}
%0 = spv.GroupNonUniformBallot Workgroup %predicate : vector<4xsi32>
return %0: vector<4xsi32>
Expand All @@ -32,7 +32,7 @@ func @group_non_uniform_ballot(%predicate: i1) -> vector<4xsi32> {
// spv.NonUniformGroupBroadcast
//===----------------------------------------------------------------------===//

func @group_non_uniform_broadcast_scalar(%value: f32) -> f32 {
func.func @group_non_uniform_broadcast_scalar(%value: f32) -> f32 {
%one = spv.Constant 1 : i32
// CHECK: spv.GroupNonUniformBroadcast Workgroup %{{.*}}, %{{.*}} : f32, i32
%0 = spv.GroupNonUniformBroadcast Workgroup %value, %one : f32, i32
Expand All @@ -41,7 +41,7 @@ func @group_non_uniform_broadcast_scalar(%value: f32) -> f32 {

// -----

func @group_non_uniform_broadcast_vector(%value: vector<4xf32>) -> vector<4xf32> {
func.func @group_non_uniform_broadcast_vector(%value: vector<4xf32>) -> vector<4xf32> {
%one = spv.Constant 1 : i32
// CHECK: spv.GroupNonUniformBroadcast Subgroup %{{.*}}, %{{.*}} : vector<4xf32>, i32
%0 = spv.GroupNonUniformBroadcast Subgroup %value, %one : vector<4xf32>, i32
Expand All @@ -50,7 +50,7 @@ func @group_non_uniform_broadcast_vector(%value: vector<4xf32>) -> vector<4xf32>

// -----

func @group_non_uniform_broadcast_negative_scope(%value: f32, %localid: i32 ) -> f32 {
func.func @group_non_uniform_broadcast_negative_scope(%value: f32, %localid: i32 ) -> f32 {
%one = spv.Constant 1 : i32
// expected-error @+1 {{execution scope must be 'Workgroup' or 'Subgroup'}}
%0 = spv.GroupNonUniformBroadcast Device %value, %one : f32, i32
Expand All @@ -59,7 +59,7 @@ func @group_non_uniform_broadcast_negative_scope(%value: f32, %localid: i32 ) ->

// -----

func @group_non_uniform_broadcast_negative_non_const(%value: f32, %localid: i32) -> f32 {
func.func @group_non_uniform_broadcast_negative_non_const(%value: f32, %localid: i32) -> f32 {
// expected-error @+1 {{id must be the result of a constant op}}
%0 = spv.GroupNonUniformBroadcast Subgroup %value, %localid : f32, i32
return %0: f32
Expand All @@ -72,15 +72,15 @@ func @group_non_uniform_broadcast_negative_non_const(%value: f32, %localid: i32)
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_elect
func @group_non_uniform_elect() -> i1 {
func.func @group_non_uniform_elect() -> i1 {
// CHECK: %{{.+}} = spv.GroupNonUniformElect Workgroup : i1
%0 = spv.GroupNonUniformElect Workgroup : i1
return %0: i1
}

// -----

func @group_non_uniform_elect() -> i1 {
func.func @group_non_uniform_elect() -> i1 {
// expected-error @+1 {{execution scope must be 'Workgroup' or 'Subgroup'}}
%0 = spv.GroupNonUniformElect CrossDevice : i1
return %0: i1
Expand All @@ -93,14 +93,14 @@ func @group_non_uniform_elect() -> i1 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_fadd_reduce
func @group_non_uniform_fadd_reduce(%val: f32) -> f32 {
func.func @group_non_uniform_fadd_reduce(%val: f32) -> f32 {
// CHECK: %{{.+}} = spv.GroupNonUniformFAdd "Workgroup" "Reduce" %{{.+}} : f32
%0 = spv.GroupNonUniformFAdd "Workgroup" "Reduce" %val : f32
return %0: f32
}

// CHECK-LABEL: @group_non_uniform_fadd_clustered_reduce
func @group_non_uniform_fadd_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> {
func.func @group_non_uniform_fadd_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> {
%four = spv.Constant 4 : i32
// CHECK: %{{.+}} = spv.GroupNonUniformFAdd "Workgroup" "ClusteredReduce" %{{.+}} cluster_size(%{{.+}}) : vector<2xf32>
%0 = spv.GroupNonUniformFAdd "Workgroup" "ClusteredReduce" %val cluster_size(%four) : vector<2xf32>
Expand All @@ -112,14 +112,14 @@ func @group_non_uniform_fadd_clustered_reduce(%val: vector<2xf32>) -> vector<2xf
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_fmul_reduce
func @group_non_uniform_fmul_reduce(%val: f32) -> f32 {
func.func @group_non_uniform_fmul_reduce(%val: f32) -> f32 {
// CHECK: %{{.+}} = spv.GroupNonUniformFMul "Workgroup" "Reduce" %{{.+}} : f32
%0 = spv.GroupNonUniformFMul "Workgroup" "Reduce" %val : f32
return %0: f32
}

// CHECK-LABEL: @group_non_uniform_fmul_clustered_reduce
func @group_non_uniform_fmul_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> {
func.func @group_non_uniform_fmul_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> {
%four = spv.Constant 4 : i32
// CHECK: %{{.+}} = spv.GroupNonUniformFMul "Workgroup" "ClusteredReduce" %{{.+}} cluster_size(%{{.+}}) : vector<2xf32>
%0 = spv.GroupNonUniformFMul "Workgroup" "ClusteredReduce" %val cluster_size(%four) : vector<2xf32>
Expand All @@ -133,7 +133,7 @@ func @group_non_uniform_fmul_clustered_reduce(%val: vector<2xf32>) -> vector<2xf
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_fmax_reduce
func @group_non_uniform_fmax_reduce(%val: f32) -> f32 {
func.func @group_non_uniform_fmax_reduce(%val: f32) -> f32 {
// CHECK: %{{.+}} = spv.GroupNonUniformFMax "Workgroup" "Reduce" %{{.+}} : f32
%0 = spv.GroupNonUniformFMax "Workgroup" "Reduce" %val : f32
return %0: f32
Expand All @@ -146,7 +146,7 @@ func @group_non_uniform_fmax_reduce(%val: f32) -> f32 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_fmin_reduce
func @group_non_uniform_fmin_reduce(%val: f32) -> f32 {
func.func @group_non_uniform_fmin_reduce(%val: f32) -> f32 {
// CHECK: %{{.+}} = spv.GroupNonUniformFMin "Workgroup" "Reduce" %{{.+}} : f32
%0 = spv.GroupNonUniformFMin "Workgroup" "Reduce" %val : f32
return %0: f32
Expand All @@ -159,14 +159,14 @@ func @group_non_uniform_fmin_reduce(%val: f32) -> f32 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_iadd_reduce
func @group_non_uniform_iadd_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_iadd_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformIAdd "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformIAdd "Workgroup" "Reduce" %val : i32
return %0: i32
}

// CHECK-LABEL: @group_non_uniform_iadd_clustered_reduce
func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
%four = spv.Constant 4 : i32
// CHECK: %{{.+}} = spv.GroupNonUniformIAdd "Workgroup" "ClusteredReduce" %{{.+}} cluster_size(%{{.+}}) : vector<2xi32>
%0 = spv.GroupNonUniformIAdd "Workgroup" "ClusteredReduce" %val cluster_size(%four) : vector<2xi32>
Expand All @@ -175,31 +175,31 @@ func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi

// -----

func @group_non_uniform_iadd_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_iadd_reduce(%val: i32) -> i32 {
// expected-error @+1 {{execution scope must be 'Workgroup' or 'Subgroup'}}
%0 = spv.GroupNonUniformIAdd "Device" "Reduce" %val : i32
return %0: i32
}

// -----

func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
// expected-error @+1 {{cluster size operand must be provided for 'ClusteredReduce' group operation}}
%0 = spv.GroupNonUniformIAdd "Workgroup" "ClusteredReduce" %val : vector<2xi32>
return %0: vector<2xi32>
}

// -----

func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>, %size: i32) -> vector<2xi32> {
func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>, %size: i32) -> vector<2xi32> {
// expected-error @+1 {{cluster size operand must come from a constant op}}
%0 = spv.GroupNonUniformIAdd "Workgroup" "ClusteredReduce" %val cluster_size(%size) : vector<2xi32>
return %0: vector<2xi32>
}

// -----

func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
%five = spv.Constant 5 : i32
// expected-error @+1 {{cluster size operand must be a power of two}}
%0 = spv.GroupNonUniformIAdd "Workgroup" "ClusteredReduce" %val cluster_size(%five) : vector<2xi32>
Expand All @@ -213,14 +213,14 @@ func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_imul_reduce
func @group_non_uniform_imul_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_imul_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformIMul "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformIMul "Workgroup" "Reduce" %val : i32
return %0: i32
}

// CHECK-LABEL: @group_non_uniform_imul_clustered_reduce
func @group_non_uniform_imul_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
func.func @group_non_uniform_imul_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> {
%four = spv.Constant 4 : i32
// CHECK: %{{.+}} = spv.GroupNonUniformIMul "Workgroup" "ClusteredReduce" %{{.+}} cluster_size(%{{.+}}) : vector<2xi32>
%0 = spv.GroupNonUniformIMul "Workgroup" "ClusteredReduce" %val cluster_size(%four) : vector<2xi32>
Expand All @@ -234,7 +234,7 @@ func @group_non_uniform_imul_clustered_reduce(%val: vector<2xi32>) -> vector<2xi
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_smax_reduce
func @group_non_uniform_smax_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_smax_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformSMax "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformSMax "Workgroup" "Reduce" %val : i32
return %0: i32
Expand All @@ -247,7 +247,7 @@ func @group_non_uniform_smax_reduce(%val: i32) -> i32 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_smin_reduce
func @group_non_uniform_smin_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_smin_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformSMin "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformSMin "Workgroup" "Reduce" %val : i32
return %0: i32
Expand All @@ -260,7 +260,7 @@ func @group_non_uniform_smin_reduce(%val: i32) -> i32 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_umax_reduce
func @group_non_uniform_umax_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_umax_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformUMax "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformUMax "Workgroup" "Reduce" %val : i32
return %0: i32
Expand All @@ -273,7 +273,7 @@ func @group_non_uniform_umax_reduce(%val: i32) -> i32 {
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_umin_reduce
func @group_non_uniform_umin_reduce(%val: i32) -> i32 {
func.func @group_non_uniform_umin_reduce(%val: i32) -> i32 {
// CHECK: %{{.+}} = spv.GroupNonUniformUMin "Workgroup" "Reduce" %{{.+}} : i32
%0 = spv.GroupNonUniformUMin "Workgroup" "Reduce" %val : i32
return %0: i32
Expand Down
46 changes: 23 additions & 23 deletions mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@
// spv.OCL.exp
//===----------------------------------------------------------------------===//

func @exp(%arg0 : f32) -> () {
func.func @exp(%arg0 : f32) -> () {
// CHECK: spv.OCL.exp {{%.*}} : f32
%2 = spv.OCL.exp %arg0 : f32
return
}

func @expvec(%arg0 : vector<3xf16>) -> () {
func.func @expvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.OCL.exp {{%.*}} : vector<3xf16>
%2 = spv.OCL.exp %arg0 : vector<3xf16>
return
}

// -----

func @exp(%arg0 : i32) -> () {
func.func @exp(%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.OCL.exp %arg0 : i32
return
}

// -----

func @exp(%arg0 : vector<5xf32>) -> () {
func.func @exp(%arg0 : vector<5xf32>) -> () {
// expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values of length 2/3/4}}
%2 = spv.OCL.exp %arg0 : vector<5xf32>
return
}

// -----

func @exp(%arg0 : f32, %arg1 : f32) -> () {
func.func @exp(%arg0 : f32, %arg1 : f32) -> () {
// expected-error @+1 {{expected ':'}}
%2 = spv.OCL.exp %arg0, %arg1 : i32
return
}

// -----

func @exp(%arg0 : i32) -> () {
func.func @exp(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.exp %arg0 :
return
Expand All @@ -54,51 +54,51 @@ func @exp(%arg0 : i32) -> () {
// spv.OCL.fabs
//===----------------------------------------------------------------------===//

func @fabs(%arg0 : f32) -> () {
func.func @fabs(%arg0 : f32) -> () {
// CHECK: spv.OCL.fabs {{%.*}} : f32
%2 = spv.OCL.fabs %arg0 : f32
return
}

func @fabsvec(%arg0 : vector<3xf16>) -> () {
func.func @fabsvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.OCL.fabs {{%.*}} : vector<3xf16>
%2 = spv.OCL.fabs %arg0 : vector<3xf16>
return
}

func @fabsf64(%arg0 : f64) -> () {
func.func @fabsf64(%arg0 : f64) -> () {
// CHECK: spv.OCL.fabs {{%.*}} : f64
%2 = spv.OCL.fabs %arg0 : f64
return
}

// -----

func @fabs(%arg0 : i32) -> () {
func.func @fabs(%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.OCL.fabs %arg0 : i32
return
}

// -----

func @fabs(%arg0 : vector<5xf32>) -> () {
func.func @fabs(%arg0 : vector<5xf32>) -> () {
// expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values of length 2/3/4}}
%2 = spv.OCL.fabs %arg0 : vector<5xf32>
return
}

// -----

func @fabs(%arg0 : f32, %arg1 : f32) -> () {
func.func @fabs(%arg0 : f32, %arg1 : f32) -> () {
// expected-error @+1 {{expected ':'}}
%2 = spv.OCL.fabs %arg0, %arg1 : i32
return
}

// -----

func @fabs(%arg0 : i32) -> () {
func.func @fabs(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.fabs %arg0 :
return
Expand All @@ -110,57 +110,57 @@ func @fabs(%arg0 : i32) -> () {
// spv.OCL.s_abs
//===----------------------------------------------------------------------===//

func @sabs(%arg0 : i32) -> () {
func.func @sabs(%arg0 : i32) -> () {
// CHECK: spv.OCL.s_abs {{%.*}} : i32
%2 = spv.OCL.s_abs %arg0 : i32
return
}

func @sabsvec(%arg0 : vector<3xi16>) -> () {
func.func @sabsvec(%arg0 : vector<3xi16>) -> () {
// CHECK: spv.OCL.s_abs {{%.*}} : vector<3xi16>
%2 = spv.OCL.s_abs %arg0 : vector<3xi16>
return
}

func @sabsi64(%arg0 : i64) -> () {
func.func @sabsi64(%arg0 : i64) -> () {
// CHECK: spv.OCL.s_abs {{%.*}} : i64
%2 = spv.OCL.s_abs %arg0 : i64
return
}

func @sabsi8(%arg0 : i8) -> () {
func.func @sabsi8(%arg0 : i8) -> () {
// CHECK: spv.OCL.s_abs {{%.*}} : i8
%2 = spv.OCL.s_abs %arg0 : i8
return
}

// -----

func @sabs(%arg0 : f32) -> () {
func.func @sabs(%arg0 : f32) -> () {
// expected-error @+1 {{op operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values}}
%2 = spv.OCL.s_abs %arg0 : f32
return
}

// -----

func @sabs(%arg0 : vector<5xi32>) -> () {
func.func @sabs(%arg0 : vector<5xi32>) -> () {
// expected-error @+1 {{op operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4}}
%2 = spv.OCL.s_abs %arg0 : vector<5xi32>
return
}

// -----

func @sabs(%arg0 : i32, %arg1 : i32) -> () {
func.func @sabs(%arg0 : i32, %arg1 : i32) -> () {
// expected-error @+1 {{expected ':'}}
%2 = spv.OCL.s_abs %arg0, %arg1 : i32
return
}

// -----

func @sabs(%arg0 : i32) -> () {
func.func @sabs(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.s_abs %arg0 :
return
Expand All @@ -172,15 +172,15 @@ func @sabs(%arg0 : i32) -> () {
// spv.OCL.fma
//===----------------------------------------------------------------------===//

func @fma(%a : f32, %b : f32, %c : f32) -> () {
func.func @fma(%a : f32, %b : f32, %c : f32) -> () {
// CHECK: spv.OCL.fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
%2 = spv.OCL.fma %a, %b, %c : f32
return
}

// -----

func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () {
func.func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () {
// CHECK: spv.OCL.fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
%2 = spv.OCL.fma %a, %b, %c : vector<3xf32>
return
Expand Down
24 changes: 12 additions & 12 deletions mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spv.module Logical GLSL450 {

// Allow taking address of global variables in other module-like ops
spv.GlobalVariable @var : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
func @addressof() -> () {
func.func @addressof() -> () {
// CHECK: spv.mlir.addressof @var
%1 = spv.mlir.addressof @var : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Input>
return
Expand Down Expand Up @@ -52,7 +52,7 @@ spv.module Logical GLSL450 {
// spv.Constant
//===----------------------------------------------------------------------===//

func @const() -> () {
func.func @const() -> () {
// CHECK: spv.Constant true
// CHECK: spv.Constant 42 : i32
// CHECK: spv.Constant 5.000000e-01 : f32
Expand All @@ -78,53 +78,53 @@ func @const() -> () {

// -----

func @unaccepted_std_attr() -> () {
func.func @unaccepted_std_attr() -> () {
// expected-error @+1 {{cannot have value of type 'none'}}
%0 = spv.Constant unit : none
return
}

// -----

func @array_constant() -> () {
func.func @array_constant() -> () {
// expected-error @+1 {{result or element type ('vector<2xf32>') does not match value type ('vector<2xi32>')}}
%0 = spv.Constant [dense<3.0> : vector<2xf32>, dense<4> : vector<2xi32>] : !spv.array<2xvector<2xf32>>
return
}

// -----

func @array_constant() -> () {
func.func @array_constant() -> () {
// expected-error @+1 {{must have spv.array result type for array value}}
%0 = spv.Constant [dense<3.0> : vector<2xf32>] : !spv.rtarray<vector<2xf32>>
return
}

// -----

func @non_nested_array_constant() -> () {
func.func @non_nested_array_constant() -> () {
// expected-error @+1 {{only support nested array result type}}
%0 = spv.Constant dense<3.0> : tensor<2x2xf32> : !spv.array<2xvector<2xf32>>
return
}

// -----

func @value_result_type_mismatch() -> () {
func.func @value_result_type_mismatch() -> () {
// expected-error @+1 {{result or element type ('vector<4xi32>') does not match value type ('tensor<4xi32>')}}
%0 = "spv.Constant"() {value = dense<0> : tensor<4xi32>} : () -> (vector<4xi32>)
}

// -----

func @value_result_type_mismatch() -> () {
func.func @value_result_type_mismatch() -> () {
// expected-error @+1 {{result element type ('i32') does not match value element type ('f32')}}
%0 = spv.Constant dense<1.0> : tensor<2x3xf32> : !spv.array<2 x !spv.array<3 x i32>>
}

// -----

func @value_result_num_elements_mismatch() -> () {
func.func @value_result_num_elements_mismatch() -> () {
// expected-error @+1 {{result number of elements (6) does not match value number of elements (4)}}
%0 = spv.Constant dense<1.0> : tensor<2x2xf32> : !spv.array<2 x !spv.array<3 x f32>>
return
Expand Down Expand Up @@ -546,7 +546,7 @@ spv.module Logical GLSL450 {

// Allow taking reference of spec constant in other module-like ops
spv.SpecConstant @sc = 5 : i32
func @reference_of() {
func.func @reference_of() {
// CHECK: spv.mlir.referenceof @sc
%0 = spv.mlir.referenceof @sc : i32
return
Expand All @@ -557,7 +557,7 @@ func @reference_of() {
spv.SpecConstant @sc = 5 : i32
spv.SpecConstantComposite @scc (@sc) : !spv.array<1 x i32>

func @reference_of_composite() {
func.func @reference_of_composite() {
// CHECK: spv.mlir.referenceof @scc : !spv.array<1 x i32>
%0 = spv.mlir.referenceof @scc : !spv.array<1 x i32>
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<1 x i32>
Expand Down Expand Up @@ -635,7 +635,7 @@ spv.module Logical GLSL450 {

// -----

func @use_in_function() -> () {
func.func @use_in_function() -> () {
// expected-error @+1 {{op must appear in a module-like op's block}}
spv.SpecConstant @sc = false
return
Expand Down
54 changes: 27 additions & 27 deletions mlir/test/Dialect/SPIRV/IR/target-and-abi.mlir
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s

// expected-error @+1 {{found unsupported 'spv.something' attribute on operation}}
func @unknown_attr_on_op() attributes {
func.func @unknown_attr_on_op() attributes {
spv.something = 64
} { return }

// -----

// expected-error @+1 {{found unsupported 'spv.something' attribute on region argument}}
func @unknown_attr_on_region(%arg: i32 {spv.something}) {
func.func @unknown_attr_on_region(%arg: i32 {spv.something}) {
return
}

// -----

// expected-error @+1 {{cannot attach SPIR-V attributes to region result}}
func @unknown_attr_on_region() -> (i32 {spv.something}) {
func.func @unknown_attr_on_region() -> (i32 {spv.something}) {
%0 = arith.constant 10.0 : f32
return %0: f32
}
Expand All @@ -27,20 +27,20 @@ func @unknown_attr_on_region() -> (i32 {spv.something}) {
//===----------------------------------------------------------------------===//

// expected-error @+1 {{'spv.entry_point_abi' attribute must be a dictionary attribute containing one 32-bit integer elements attribute: 'local_size'}}
func @spv_entry_point() attributes {
func.func @spv_entry_point() attributes {
spv.entry_point_abi = 64
} { return }

// -----

// expected-error @+1 {{'spv.entry_point_abi' attribute must be a dictionary attribute containing one 32-bit integer elements attribute: 'local_size'}}
func @spv_entry_point() attributes {
func.func @spv_entry_point() attributes {
spv.entry_point_abi = {local_size = 64}
} { return }

// -----

func @spv_entry_point() attributes {
func.func @spv_entry_point() attributes {
// CHECK: {spv.entry_point_abi = {local_size = dense<[64, 1, 1]> : vector<3xi32>}}
spv.entry_point_abi = {local_size = dense<[64, 1, 1]>: vector<3xi32>}
} { return }
Expand All @@ -52,49 +52,49 @@ func @spv_entry_point() attributes {
//===----------------------------------------------------------------------===//

// expected-error @+1 {{'spv.interface_var_abi' must be a spirv::InterfaceVarABIAttr}}
func @interface_var(
func.func @interface_var(
%arg0 : f32 {spv.interface_var_abi = 64}
) { return }

// -----

func @interface_var(
func.func @interface_var(
// expected-error @+1 {{missing descriptor set}}
%arg0 : f32 {spv.interface_var_abi = #spv.interface_var_abi<()>}
) { return }

// -----

func @interface_var(
func.func @interface_var(
// expected-error @+1 {{missing binding}}
%arg0 : f32 {spv.interface_var_abi = #spv.interface_var_abi<(1,)>}
) { return }

// -----

func @interface_var(
func.func @interface_var(
// expected-error @+1 {{unknown storage class: }}
%arg0 : f32 {spv.interface_var_abi = #spv.interface_var_abi<(1,2), Foo>}
) { return }

// -----

// CHECK: {spv.interface_var_abi = #spv.interface_var_abi<(0, 1), Uniform>}
func @interface_var(
func.func @interface_var(
%arg0 : f32 {spv.interface_var_abi = #spv.interface_var_abi<(0, 1), Uniform>}
) { return }

// -----

// CHECK: {spv.interface_var_abi = #spv.interface_var_abi<(0, 1)>}
func @interface_var(
func.func @interface_var(
%arg0 : f32 {spv.interface_var_abi = #spv.interface_var_abi<(0, 1)>}
) { return }

// -----

// expected-error @+1 {{'spv.interface_var_abi' attribute cannot specify storage class when attaching to a non-scalar value}}
func @interface_var(
func.func @interface_var(
%arg0 : memref<4xf32> {spv.interface_var_abi = #spv.interface_var_abi<(0, 1), Uniform>}
) { return }

Expand All @@ -104,7 +104,7 @@ func @interface_var(
// spv.target_env
//===----------------------------------------------------------------------===//

func @target_env_wrong_limits() attributes {
func.func @target_env_wrong_limits() attributes {
spv.target_env = #spv.target_env<
#spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>,
// expected-error @+1 {{limits must be a dictionary attribute containing two 32-bit integer attributes 'max_compute_workgroup_invocations' and 'max_compute_workgroup_size'}}
Expand All @@ -113,7 +113,7 @@ func @target_env_wrong_limits() attributes {

// -----

func @target_env() attributes {
func.func @target_env() attributes {
// CHECK: spv.target_env = #spv.target_env<
// CHECK-SAME: #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>,
// CHECK-SAME: {max_compute_workgroup_invocations = 128 : i32, max_compute_workgroup_size = dense<[128, 64, 64]> : vector<3xi32>}>
Expand All @@ -127,7 +127,7 @@ func @target_env() attributes {

// -----

func @target_env_vendor_id() attributes {
func.func @target_env_vendor_id() attributes {
// CHECK: spv.target_env = #spv.target_env<
// CHECK-SAME: #spv.vce<v1.0, [], []>,
// CHECK-SAME: NVIDIA,
Expand All @@ -137,7 +137,7 @@ func @target_env_vendor_id() attributes {

// -----

func @target_env_vendor_id_device_type() attributes {
func.func @target_env_vendor_id_device_type() attributes {
// CHECK: spv.target_env = #spv.target_env<
// CHECK-SAME: #spv.vce<v1.0, [], []>,
// CHECK-SAME: AMD:DiscreteGPU,
Expand All @@ -147,7 +147,7 @@ func @target_env_vendor_id_device_type() attributes {

// -----

func @target_env_vendor_id_device_type_device_id() attributes {
func.func @target_env_vendor_id_device_type_device_id() attributes {
// CHECK: spv.target_env = #spv.target_env<
// CHECK-SAME: #spv.vce<v1.0, [], []>,
// CHECK-SAME: Qualcomm:IntegratedGPU:100925441,
Expand All @@ -157,7 +157,7 @@ func @target_env_vendor_id_device_type_device_id() attributes {

// -----

func @target_env_extra_fields() attributes {
func.func @target_env_extra_fields() attributes {
// expected-error @+6 {{expected '>'}}
spv.target_env = #spv.target_env<
#spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>,
Expand All @@ -171,7 +171,7 @@ func @target_env_extra_fields() attributes {

// -----

func @target_env_cooperative_matrix() attributes{
func.func @target_env_cooperative_matrix() attributes{
// CHECK: spv.target_env = #spv.target_env<
// CHECK-SAME: SPV_NV_cooperative_matrix
// CHECK-SAME: cooperative_matrix_properties_nv = [
Expand Down Expand Up @@ -213,49 +213,49 @@ func @target_env_cooperative_matrix() attributes{
// spv.vce
//===----------------------------------------------------------------------===//

func @vce_wrong_type() attributes {
func.func @vce_wrong_type() attributes {
// expected-error @+1 {{expected valid keyword}}
vce = #spv.vce<64>
} { return }

// -----

func @vce_missing_fields() attributes {
func.func @vce_missing_fields() attributes {
// expected-error @+1 {{expected ','}}
vce = #spv.vce<v1.0>
} { return }

// -----

func @vce_wrong_version() attributes {
func.func @vce_wrong_version() attributes {
// expected-error @+1 {{unknown version: V_x_y}}
vce = #spv.vce<V_x_y, []>
} { return }

// -----

func @vce_wrong_extension_type() attributes {
func.func @vce_wrong_extension_type() attributes {
// expected-error @+1 {{expected valid keyword}}
vce = #spv.vce<v1.0, [32: i32], [Shader]>
} { return }

// -----

func @vce_wrong_extension() attributes {
func.func @vce_wrong_extension() attributes {
// expected-error @+1 {{unknown extension: SPV_Something}}
vce = #spv.vce<v1.0, [Shader], [SPV_Something]>
} { return }

// -----

func @vce_wrong_capability() attributes {
func.func @vce_wrong_capability() attributes {
// expected-error @+1 {{unknown capability: Something}}
vce = #spv.vce<v1.0, [Something], []>
} { return }

// -----

func @vce() attributes {
func.func @vce() attributes {
// CHECK: #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>
vce = #spv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>
} { return }
32 changes: 16 additions & 16 deletions mlir/test/Dialect/SPIRV/IR/target-env.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @cmp_exchange_weak_suitable_version_capabilities
func @cmp_exchange_weak_suitable_version_capabilities(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
func.func @cmp_exchange_weak_suitable_version_capabilities(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.1, [Kernel, AtomicStorage], []>, {}>
} {
// CHECK: spv.AtomicCompareExchangeWeak "Workgroup" "AcquireRelease|AtomicCounterMemory" "Acquire"
Expand All @@ -43,7 +43,7 @@ func @cmp_exchange_weak_suitable_version_capabilities(%ptr: !spv.ptr<i32, Workgr
}

// CHECK-LABEL: @cmp_exchange_weak_unsupported_version
func @cmp_exchange_weak_unsupported_version(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
func.func @cmp_exchange_weak_unsupported_version(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.4, [Kernel, AtomicStorage], []>, {}>
} {
// CHECK: test.convert_to_atomic_compare_exchange_weak_op
Expand All @@ -56,7 +56,7 @@ func @cmp_exchange_weak_unsupported_version(%ptr: !spv.ptr<i32, Workgroup>, %val
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @group_non_uniform_ballot_suitable_version
func @group_non_uniform_ballot_suitable_version(%predicate: i1) -> vector<4xi32> attributes {
func.func @group_non_uniform_ballot_suitable_version(%predicate: i1) -> vector<4xi32> attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.4, [GroupNonUniformBallot], []>, {}>
} {
// CHECK: spv.GroupNonUniformBallot Workgroup
Expand All @@ -65,7 +65,7 @@ func @group_non_uniform_ballot_suitable_version(%predicate: i1) -> vector<4xi32>
}

// CHECK-LABEL: @group_non_uniform_ballot_unsupported_version
func @group_non_uniform_ballot_unsupported_version(%predicate: i1) -> vector<4xi32> attributes {
func.func @group_non_uniform_ballot_unsupported_version(%predicate: i1) -> vector<4xi32> attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.1, [GroupNonUniformBallot], []>, {}>
} {
// CHECK: test.convert_to_group_non_uniform_ballot_op
Expand All @@ -78,7 +78,7 @@ func @group_non_uniform_ballot_unsupported_version(%predicate: i1) -> vector<4xi
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @cmp_exchange_weak_missing_capability_kernel
func @cmp_exchange_weak_missing_capability_kernel(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
func.func @cmp_exchange_weak_missing_capability_kernel(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.3, [AtomicStorage], []>, {}>
} {
// CHECK: test.convert_to_atomic_compare_exchange_weak_op
Expand All @@ -87,7 +87,7 @@ func @cmp_exchange_weak_missing_capability_kernel(%ptr: !spv.ptr<i32, Workgroup>
}

// CHECK-LABEL: @cmp_exchange_weak_missing_capability_atomic_storage
func @cmp_exchange_weak_missing_capability_atomic_storage(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
func.func @cmp_exchange_weak_missing_capability_atomic_storage(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.3, [Kernel], []>, {}>
} {
// CHECK: test.convert_to_atomic_compare_exchange_weak_op
Expand All @@ -96,7 +96,7 @@ func @cmp_exchange_weak_missing_capability_atomic_storage(%ptr: !spv.ptr<i32, Wo
}

// CHECK-LABEL: @subgroup_ballot_missing_capability
func @subgroup_ballot_missing_capability(%predicate: i1) -> vector<4xi32> attributes {
func.func @subgroup_ballot_missing_capability(%predicate: i1) -> vector<4xi32> attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.4, [], [SPV_KHR_shader_ballot]>, {}>
} {
// CHECK: test.convert_to_subgroup_ballot_op
Expand All @@ -105,7 +105,7 @@ func @subgroup_ballot_missing_capability(%predicate: i1) -> vector<4xi32> attrib
}

// CHECK-LABEL: @bit_reverse_directly_implied_capability
func @bit_reverse_directly_implied_capability(%operand: i32) -> i32 attributes {
func.func @bit_reverse_directly_implied_capability(%operand: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [Geometry], []>, {}>
} {
// CHECK: spv.BitReverse
Expand All @@ -114,7 +114,7 @@ func @bit_reverse_directly_implied_capability(%operand: i32) -> i32 attributes {
}

// CHECK-LABEL: @bit_reverse_recursively_implied_capability
func @bit_reverse_recursively_implied_capability(%operand: i32) -> i32 attributes {
func.func @bit_reverse_recursively_implied_capability(%operand: i32) -> i32 attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [GeometryPointSize], []>, {}>
} {
// CHECK: spv.BitReverse
Expand All @@ -127,7 +127,7 @@ func @bit_reverse_recursively_implied_capability(%operand: i32) -> i32 attribute
//===----------------------------------------------------------------------===//

// CHECK-LABEL: @subgroup_ballot_suitable_extension
func @subgroup_ballot_suitable_extension(%predicate: i1) -> vector<4xi32> attributes {
func.func @subgroup_ballot_suitable_extension(%predicate: i1) -> vector<4xi32> attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.4, [SubgroupBallotKHR], [SPV_KHR_shader_ballot]>, {}>
} {
// CHECK: spv.SubgroupBallotKHR
Expand All @@ -136,7 +136,7 @@ func @subgroup_ballot_suitable_extension(%predicate: i1) -> vector<4xi32> attrib
}

// CHECK-LABEL: @subgroup_ballot_missing_extension
func @subgroup_ballot_missing_extension(%predicate: i1) -> vector<4xi32> attributes {
func.func @subgroup_ballot_missing_extension(%predicate: i1) -> vector<4xi32> attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.4, [SubgroupBallotKHR], []>, {}>
} {
// CHECK: test.convert_to_subgroup_ballot_op
Expand All @@ -145,7 +145,7 @@ func @subgroup_ballot_missing_extension(%predicate: i1) -> vector<4xi32> attribu
}

// CHECK-LABEL: @module_suitable_extension1
func @module_suitable_extension1() attributes {
func.func @module_suitable_extension1() attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [VulkanMemoryModel, PhysicalStorageBufferAddresses], [SPV_KHR_vulkan_memory_model, SPV_EXT_physical_storage_buffer]>, {}>
} {
// CHECK: spv.module PhysicalStorageBuffer64 Vulkan
Expand All @@ -154,7 +154,7 @@ func @module_suitable_extension1() attributes {
}

// CHECK-LABEL: @module_suitable_extension2
func @module_suitable_extension2() attributes {
func.func @module_suitable_extension2() attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [VulkanMemoryModel, PhysicalStorageBufferAddresses], [SPV_KHR_vulkan_memory_model, SPV_KHR_physical_storage_buffer]>, {}>
} {
// CHECK: spv.module PhysicalStorageBuffer64 Vulkan
Expand All @@ -163,7 +163,7 @@ func @module_suitable_extension2() attributes {
}

// CHECK-LABEL: @module_missing_extension_mm
func @module_missing_extension_mm() attributes {
func.func @module_missing_extension_mm() attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [VulkanMemoryModel, PhysicalStorageBufferAddresses], [SPV_KHR_physical_storage_buffer]>, {}>
} {
// CHECK: test.convert_to_module_op
Expand All @@ -172,7 +172,7 @@ func @module_missing_extension_mm() attributes {
}

// CHECK-LABEL: @module_missing_extension_am
func @module_missing_extension_am() attributes {
func.func @module_missing_extension_am() attributes {
spv.target_env = #spv.target_env<#spv.vce<v1.0, [VulkanMemoryModel, PhysicalStorageBufferAddresses], [SPV_KHR_vulkan_memory_model]>, {}>
} {
// CHECK: test.convert_to_module_op
Expand All @@ -181,7 +181,7 @@ func @module_missing_extension_am() attributes {
}

// CHECK-LABEL: @module_implied_extension
func @module_implied_extension() attributes {
func.func @module_implied_extension() attributes {
// Version 1.5 implies SPV_KHR_vulkan_memory_model and SPV_KHR_physical_storage_buffer.
spv.target_env = #spv.target_env<#spv.vce<v1.5, [VulkanMemoryModel, PhysicalStorageBufferAddresses], []>, {}>
} {
Expand Down
216 changes: 108 additions & 108 deletions mlir/test/Dialect/SPIRV/IR/types.mlir

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions mlir/test/Dialect/SPIRV/Transforms/canonicalize.mlir

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions mlir/test/Dialect/SPIRV/Transforms/glsl-canonicalize.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// CHECK-LABEL: func @clamp_fordlessthan
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.FOrdLessThan %min, %input : f32
%mid = spv.Select %0, %input, %min : i1, f32
Expand All @@ -17,7 +17,7 @@ func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {

// CHECK-LABEL: func @clamp_fordlessthan
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.FOrdLessThan %input, %min : f32
%mid = spv.Select %0, %min, %input : i1, f32
Expand All @@ -32,7 +32,7 @@ func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 {

// CHECK-LABEL: func @clamp_fordlessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.FOrdLessThanEqual %min, %input : f32
%mid = spv.Select %0, %input, %min : i1, f32
Expand All @@ -47,7 +47,7 @@ func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {

// CHECK-LABEL: func @clamp_fordlessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: f32, %[[MIN:.*]]: f32, %[[MAX:.*]]: f32)
func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {
// CHECK: [[RES:%.*]] = spv.GLSL.FClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.FOrdLessThanEqual %input, %min : f32
%mid = spv.Select %0, %min, %input : i1, f32
Expand All @@ -62,7 +62,7 @@ func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 {

// CHECK-LABEL: func @clamp_slessthan
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.SLessThan %min, %input : si32
%mid = spv.Select %0, %input, %min : i1, si32
Expand All @@ -77,7 +77,7 @@ func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {

// CHECK-LABEL: func @clamp_slessthan
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.SLessThan %input, %min : si32
%mid = spv.Select %0, %min, %input : i1, si32
Expand All @@ -92,7 +92,7 @@ func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 {

// CHECK-LABEL: func @clamp_slessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.SLessThanEqual %min, %input : si32
%mid = spv.Select %0, %input, %min : i1, si32
Expand All @@ -107,7 +107,7 @@ func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {

// CHECK-LABEL: func @clamp_slessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: si32, %[[MIN:.*]]: si32, %[[MAX:.*]]: si32)
func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {
// CHECK: [[RES:%.*]] = spv.GLSL.SClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.SLessThanEqual %input, %min : si32
%mid = spv.Select %0, %min, %input : i1, si32
Expand All @@ -122,7 +122,7 @@ func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 {

// CHECK-LABEL: func @clamp_ulessthan
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.ULessThan %min, %input : i32
%mid = spv.Select %0, %input, %min : i1, i32
Expand All @@ -137,7 +137,7 @@ func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {

// CHECK-LABEL: func @clamp_ulessthan
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.ULessThan %input, %min : i32
%mid = spv.Select %0, %min, %input : i1, i32
Expand All @@ -152,7 +152,7 @@ func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 {

// CHECK-LABEL: func @clamp_ulessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.ULessThanEqual %min, %input : i32
%mid = spv.Select %0, %input, %min : i1, i32
Expand All @@ -167,7 +167,7 @@ func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {

// CHECK-LABEL: func @clamp_ulessthanequal
// CHECK-SAME: (%[[INPUT:.*]]: i32, %[[MIN:.*]]: i32, %[[MAX:.*]]: i32)
func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 {
// CHECK: [[RES:%.*]] = spv.GLSL.UClamp %[[INPUT]], %[[MIN]], %[[MAX]]
%0 = spv.ULessThanEqual %input, %min : i32
%mid = spv.Select %0, %min, %input : i1, i32
Expand Down