[mlir][NFC] Update textual references of `func` to `func.func` in SPIRV tests

The special case parsing of `func` operations is being removed.
This commit is contained in:
River Riddle 2022-04-20 16:19:21 -07:00
parent fb35cd3baf
commit 2c7836ef15
24 changed files with 658 additions and 658 deletions

View File

@ -4,7 +4,7 @@
// spv.FAdd
//===----------------------------------------------------------------------===//
func @fadd_scalar(%arg: f32) -> f32 {
func.func @fadd_scalar(%arg: f32) -> f32 {
// CHECK: spv.FAdd
%0 = spv.FAdd %arg, %arg : f32
return %0 : f32
@ -16,7 +16,7 @@ func @fadd_scalar(%arg: f32) -> f32 {
// spv.FDiv
//===----------------------------------------------------------------------===//
func @fdiv_scalar(%arg: f32) -> f32 {
func.func @fdiv_scalar(%arg: f32) -> f32 {
// CHECK: spv.FDiv
%0 = spv.FDiv %arg, %arg : f32
return %0 : f32
@ -28,7 +28,7 @@ func @fdiv_scalar(%arg: f32) -> f32 {
// spv.FMod
//===----------------------------------------------------------------------===//
func @fmod_scalar(%arg: f32) -> f32 {
func.func @fmod_scalar(%arg: f32) -> f32 {
// CHECK: spv.FMod
%0 = spv.FMod %arg, %arg : f32
return %0 : f32
@ -40,13 +40,13 @@ func @fmod_scalar(%arg: f32) -> f32 {
// spv.FMul
//===----------------------------------------------------------------------===//
func @fmul_scalar(%arg: f32) -> f32 {
func.func @fmul_scalar(%arg: f32) -> f32 {
// CHECK: spv.FMul
%0 = spv.FMul %arg, %arg : f32
return %0 : f32
}
func @fmul_vector(%arg: vector<4xf32>) -> vector<4xf32> {
func.func @fmul_vector(%arg: vector<4xf32>) -> vector<4xf32> {
// CHECK: spv.FMul
%0 = spv.FMul %arg, %arg : vector<4xf32>
return %0 : vector<4xf32>
@ -54,7 +54,7 @@ func @fmul_vector(%arg: vector<4xf32>) -> vector<4xf32> {
// -----
func @fmul_i32(%arg: i32) -> i32 {
func.func @fmul_i32(%arg: i32) -> i32 {
// expected-error @+1 {{operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
%0 = spv.FMul %arg, %arg : i32
return %0 : i32
@ -62,7 +62,7 @@ func @fmul_i32(%arg: i32) -> i32 {
// -----
func @fmul_bf16(%arg: bf16) -> bf16 {
func.func @fmul_bf16(%arg: bf16) -> bf16 {
// expected-error @+1 {{operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
%0 = spv.FMul %arg, %arg : bf16
return %0 : bf16
@ -70,7 +70,7 @@ func @fmul_bf16(%arg: bf16) -> bf16 {
// -----
func @fmul_tensor(%arg: tensor<4xf32>) -> tensor<4xf32> {
func.func @fmul_tensor(%arg: tensor<4xf32>) -> tensor<4xf32> {
// expected-error @+1 {{operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
%0 = spv.FMul %arg, %arg : tensor<4xf32>
return %0 : tensor<4xf32>
@ -82,7 +82,7 @@ func @fmul_tensor(%arg: tensor<4xf32>) -> tensor<4xf32> {
// spv.FNegate
//===----------------------------------------------------------------------===//
func @fnegate_scalar(%arg: f32) -> f32 {
func.func @fnegate_scalar(%arg: f32) -> f32 {
// CHECK: spv.FNegate
%0 = spv.FNegate %arg : f32
return %0 : f32
@ -94,7 +94,7 @@ func @fnegate_scalar(%arg: f32) -> f32 {
// spv.FRem
//===----------------------------------------------------------------------===//
func @frem_scalar(%arg: f32) -> f32 {
func.func @frem_scalar(%arg: f32) -> f32 {
// CHECK: spv.FRem
%0 = spv.FRem %arg, %arg : f32
return %0 : f32
@ -106,7 +106,7 @@ func @frem_scalar(%arg: f32) -> f32 {
// spv.FSub
//===----------------------------------------------------------------------===//
func @fsub_scalar(%arg: f32) -> f32 {
func.func @fsub_scalar(%arg: f32) -> f32 {
// CHECK: spv.FSub
%0 = spv.FSub %arg, %arg : f32
return %0 : f32
@ -118,7 +118,7 @@ func @fsub_scalar(%arg: f32) -> f32 {
// spv.IAdd
//===----------------------------------------------------------------------===//
func @iadd_scalar(%arg: i32) -> i32 {
func.func @iadd_scalar(%arg: i32) -> i32 {
// CHECK: spv.IAdd
%0 = spv.IAdd %arg, %arg : i32
return %0 : i32
@ -130,7 +130,7 @@ func @iadd_scalar(%arg: i32) -> i32 {
// spv.IMul
//===----------------------------------------------------------------------===//
func @imul_scalar(%arg: i32) -> i32 {
func.func @imul_scalar(%arg: i32) -> i32 {
// CHECK: spv.IMul
%0 = spv.IMul %arg, %arg : i32
return %0 : i32
@ -142,7 +142,7 @@ func @imul_scalar(%arg: i32) -> i32 {
// spv.ISub
//===----------------------------------------------------------------------===//
func @isub_scalar(%arg: i32) -> i32 {
func.func @isub_scalar(%arg: i32) -> i32 {
// CHECK: spv.ISub
%0 = spv.ISub %arg, %arg : i32
return %0 : i32
@ -154,7 +154,7 @@ func @isub_scalar(%arg: i32) -> i32 {
// spv.SDiv
//===----------------------------------------------------------------------===//
func @sdiv_scalar(%arg: i32) -> i32 {
func.func @sdiv_scalar(%arg: i32) -> i32 {
// CHECK: spv.SDiv
%0 = spv.SDiv %arg, %arg : i32
return %0 : i32
@ -166,7 +166,7 @@ func @sdiv_scalar(%arg: i32) -> i32 {
// spv.SMod
//===----------------------------------------------------------------------===//
func @smod_scalar(%arg: i32) -> i32 {
func.func @smod_scalar(%arg: i32) -> i32 {
// CHECK: spv.SMod
%0 = spv.SMod %arg, %arg : i32
return %0 : i32
@ -178,7 +178,7 @@ func @smod_scalar(%arg: i32) -> i32 {
// spv.SNegate
//===----------------------------------------------------------------------===//
func @snegate_scalar(%arg: i32) -> i32 {
func.func @snegate_scalar(%arg: i32) -> i32 {
// CHECK: spv.SNegate
%0 = spv.SNegate %arg : i32
return %0 : i32
@ -189,7 +189,7 @@ func @snegate_scalar(%arg: i32) -> i32 {
// spv.SRem
//===----------------------------------------------------------------------===//
func @srem_scalar(%arg: i32) -> i32 {
func.func @srem_scalar(%arg: i32) -> i32 {
// CHECK: spv.SRem
%0 = spv.SRem %arg, %arg : i32
return %0 : i32
@ -201,7 +201,7 @@ func @srem_scalar(%arg: i32) -> i32 {
// spv.UDiv
//===----------------------------------------------------------------------===//
func @udiv_scalar(%arg: i32) -> i32 {
func.func @udiv_scalar(%arg: i32) -> i32 {
// CHECK: spv.UDiv
%0 = spv.UDiv %arg, %arg : i32
return %0 : i32
@ -213,7 +213,7 @@ func @udiv_scalar(%arg: i32) -> i32 {
// spv.UMod
//===----------------------------------------------------------------------===//
func @umod_scalar(%arg: i32) -> i32 {
func.func @umod_scalar(%arg: i32) -> i32 {
// CHECK: spv.UMod
%0 = spv.UMod %arg, %arg : i32
return %0 : i32
@ -224,7 +224,7 @@ func @umod_scalar(%arg: i32) -> i32 {
// spv.VectorTimesScalar
//===----------------------------------------------------------------------===//
func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<4xf32> {
func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<4xf32> {
// CHECK: spv.VectorTimesScalar %{{.+}}, %{{.+}} : (vector<4xf32>, f32) -> vector<4xf32>
%0 = spv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f32) -> vector<4xf32>
return %0 : vector<4xf32>
@ -232,7 +232,7 @@ func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<4xf32>
// -----
func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f16) -> vector<4xf32> {
func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f16) -> vector<4xf32> {
// expected-error @+1 {{scalar operand and result element type match}}
%0 = spv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f16) -> vector<4xf32>
return %0 : vector<4xf32>
@ -240,7 +240,7 @@ func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f16) -> vector<4xf32>
// -----
func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<3xf32> {
func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<3xf32> {
// expected-error @+1 {{vector operand and result type mismatch}}
%0 = spv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f32) -> vector<3xf32>
return %0 : vector<3xf32>

View File

@ -1,6 +1,6 @@
// RUN: mlir-opt %s -split-input-file | FileCheck %s
func @const() -> () {
func.func @const() -> () {
// CHECK: %true
%0 = spv.Constant true
// CHECK: %false

View File

@ -4,7 +4,7 @@
// spv.AtomicAnd
//===----------------------------------------------------------------------===//
func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicAnd "Device" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicAnd "Device" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -12,7 +12,7 @@ func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// -----
func @atomic_and(%ptr : !spv.ptr<f32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_and(%ptr : !spv.ptr<f32, StorageBuffer>, %value : i32) -> i32 {
// expected-error @+1 {{pointer operand must point to an integer value, found 'f32'}}
%0 = "spv.AtomicAnd"(%ptr, %value) {memory_scope = 4: i32, semantics = 0x4 : i32} : (!spv.ptr<f32, StorageBuffer>, i32) -> (i32)
return %0 : i32
@ -21,7 +21,7 @@ func @atomic_and(%ptr : !spv.ptr<f32, StorageBuffer>, %value : i32) -> i32 {
// -----
func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i64) -> i64 {
func.func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i64) -> i64 {
// expected-error @+1 {{expected value to have the same type as the pointer operand's pointee type 'i32', but found 'i64'}}
%0 = "spv.AtomicAnd"(%ptr, %value) {memory_scope = 2: i32, semantics = 0x8 : i32} : (!spv.ptr<i32, StorageBuffer>, i64) -> (i64)
return %0 : i64
@ -29,7 +29,7 @@ func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i64) -> i64 {
// -----
func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// expected-error @+1 {{expected at most one of these four memory constraints to be set: `Acquire`, `Release`,`AcquireRelease` or `SequentiallyConsistent`}}
%0 = spv.AtomicAnd "Device" "Acquire|Release" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -41,7 +41,7 @@ func @atomic_and(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicCompareExchange
//===----------------------------------------------------------------------===//
func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
// CHECK: spv.AtomicCompareExchange "Workgroup" "Release" "Acquire" %{{.*}}, %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup>
%0 = spv.AtomicCompareExchange "Workgroup" "Release" "Acquire" %ptr, %value, %comparator: !spv.ptr<i32, Workgroup>
return %0: i32
@ -49,7 +49,7 @@ func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comp
// -----
func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64, %comparator: i32) -> i32 {
// expected-error @+1 {{value operand must have the same type as the op result, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicCompareExchange"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i32, Workgroup>, i64, i32) -> (i32)
return %0: i32
@ -57,7 +57,7 @@ func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64, %comp
// -----
func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i16) -> i32 {
func.func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i16) -> i32 {
// expected-error @+1 {{comparator operand must have the same type as the op result, but found 'i16' vs 'i32'}}
%0 = "spv.AtomicCompareExchange"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i32, Workgroup>, i32, i16) -> (i32)
return %0: i32
@ -65,7 +65,7 @@ func @atomic_compare_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comp
// -----
func @atomic_compare_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32, %comparator: i32) -> i32 {
// expected-error @+1 {{pointer operand's pointee type must have the same as the op result type, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicCompareExchange"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i64, Workgroup>, i32, i32) -> (i32)
return %0: i32
@ -77,7 +77,7 @@ func @atomic_compare_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32, %comp
// spv.AtomicCompareExchangeWeak
//===----------------------------------------------------------------------===//
func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
// CHECK: spv.AtomicCompareExchangeWeak "Workgroup" "Release" "Acquire" %{{.*}}, %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup>
%0 = spv.AtomicCompareExchangeWeak "Workgroup" "Release" "Acquire" %ptr, %value, %comparator: !spv.ptr<i32, Workgroup>
return %0: i32
@ -85,7 +85,7 @@ func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32,
// -----
func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i64, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i64, %comparator: i32) -> i32 {
// expected-error @+1 {{value operand must have the same type as the op result, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicCompareExchangeWeak"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i32, Workgroup>, i64, i32) -> (i32)
return %0: i32
@ -93,7 +93,7 @@ func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i64,
// -----
func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i16) -> i32 {
func.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i16) -> i32 {
// expected-error @+1 {{comparator operand must have the same type as the op result, but found 'i16' vs 'i32'}}
%0 = "spv.AtomicCompareExchangeWeak"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i32, Workgroup>, i32, i16) -> (i32)
return %0: i32
@ -101,7 +101,7 @@ func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32,
// -----
func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i64, Workgroup>, %value: i32, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i64, Workgroup>, %value: i32, %comparator: i32) -> i32 {
// expected-error @+1 {{pointer operand's pointee type must have the same as the op result type, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicCompareExchangeWeak"(%ptr, %value, %comparator) {memory_scope = 4: i32, equal_semantics = 0x4: i32, unequal_semantics = 0x2:i32} : (!spv.ptr<i64, Workgroup>, i32, i32) -> (i32)
return %0: i32
@ -113,7 +113,7 @@ func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i64, Workgroup>, %value: i32,
// spv.AtomicExchange
//===----------------------------------------------------------------------===//
func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32) -> i32 {
func.func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32) -> i32 {
// CHECK: spv.AtomicExchange "Workgroup" "Release" %{{.*}}, %{{.*}} : !spv.ptr<i32, Workgroup>
%0 = spv.AtomicExchange "Workgroup" "Release" %ptr, %value: !spv.ptr<i32, Workgroup>
return %0: i32
@ -121,7 +121,7 @@ func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i32) -> i32 {
// -----
func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64) -> i32 {
func.func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64) -> i32 {
// expected-error @+1 {{value operand must have the same type as the op result, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicExchange"(%ptr, %value) {memory_scope = 4: i32, semantics = 0x4: i32} : (!spv.ptr<i32, Workgroup>, i64) -> (i32)
return %0: i32
@ -129,7 +129,7 @@ func @atomic_exchange(%ptr: !spv.ptr<i32, Workgroup>, %value: i64) -> i32 {
// -----
func @atomic_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32) -> i32 {
func.func @atomic_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32) -> i32 {
// expected-error @+1 {{pointer operand's pointee type must have the same as the op result type, but found 'i64' vs 'i32'}}
%0 = "spv.AtomicExchange"(%ptr, %value) {memory_scope = 4: i32, semantics = 0x4: i32} : (!spv.ptr<i64, Workgroup>, i32) -> (i32)
return %0: i32
@ -141,7 +141,7 @@ func @atomic_exchange(%ptr: !spv.ptr<i64, Workgroup>, %value: i32) -> i32 {
// spv.AtomicIAdd
//===----------------------------------------------------------------------===//
func @atomic_iadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_iadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicIAdd "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicIAdd "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -151,7 +151,7 @@ func @atomic_iadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicIDecrement
//===----------------------------------------------------------------------===//
func @atomic_idecrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
func.func @atomic_idecrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// CHECK: spv.AtomicIDecrement "Workgroup" "None" %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicIDecrement "Workgroup" "None" %ptr : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -161,7 +161,7 @@ func @atomic_idecrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// spv.AtomicIIncrement
//===----------------------------------------------------------------------===//
func @atomic_iincrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
func.func @atomic_iincrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// CHECK: spv.AtomicIIncrement "Workgroup" "None" %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicIIncrement "Workgroup" "None" %ptr : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -171,7 +171,7 @@ func @atomic_iincrement(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// spv.AtomicISub
//===----------------------------------------------------------------------===//
func @atomic_isub(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_isub(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicISub "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicISub "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -181,7 +181,7 @@ func @atomic_isub(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicOr
//===----------------------------------------------------------------------===//
func @atomic_or(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_or(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicOr "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicOr "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -191,7 +191,7 @@ func @atomic_or(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicSMax
//===----------------------------------------------------------------------===//
func @atomic_smax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_smax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicSMax "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicSMax "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -201,7 +201,7 @@ func @atomic_smax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicSMin
//===----------------------------------------------------------------------===//
func @atomic_smin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_smin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicSMin "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicSMin "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -211,7 +211,7 @@ func @atomic_smin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicUMax
//===----------------------------------------------------------------------===//
func @atomic_umax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_umax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicUMax "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicUMax "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -221,7 +221,7 @@ func @atomic_umax(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicUMin
//===----------------------------------------------------------------------===//
func @atomic_umin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_umin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicUMin "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicUMin "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -231,7 +231,7 @@ func @atomic_umin(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicXor
//===----------------------------------------------------------------------===//
func @atomic_xor(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
func.func @atomic_xor(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// CHECK: spv.AtomicXor "Workgroup" "None" %{{.*}}, %{{.*}} : !spv.ptr<i32, StorageBuffer>
%0 = spv.AtomicXor "Workgroup" "None" %ptr, %value : !spv.ptr<i32, StorageBuffer>
return %0 : i32
@ -243,7 +243,7 @@ func @atomic_xor(%ptr : !spv.ptr<i32, StorageBuffer>, %value : i32) -> i32 {
// spv.AtomicFAddEXT
//===----------------------------------------------------------------------===//
func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
// CHECK: spv.AtomicFAddEXT "Device" "None" %{{.*}}, %{{.*}} : !spv.ptr<f32, StorageBuffer>
%0 = spv.AtomicFAddEXT "Device" "None" %ptr, %value : !spv.ptr<f32, StorageBuffer>
return %0 : f32
@ -251,7 +251,7 @@ func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
// -----
func @atomic_fadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : f32) -> f32 {
func.func @atomic_fadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : f32) -> f32 {
// expected-error @+1 {{pointer operand must point to an float value, found 'i32'}}
%0 = "spv.AtomicFAddEXT"(%ptr, %value) {memory_scope = 4: i32, semantics = 0x4 : i32} : (!spv.ptr<i32, StorageBuffer>, f32) -> (f32)
return %0 : f32
@ -259,7 +259,7 @@ func @atomic_fadd(%ptr : !spv.ptr<i32, StorageBuffer>, %value : f32) -> f32 {
// -----
func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f64) -> f64 {
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f64) -> f64 {
// expected-error @+1 {{expected value to have the same type as the pointer operand's pointee type 'f32', but found 'f64'}}
%0 = "spv.AtomicFAddEXT"(%ptr, %value) {memory_scope = 2: i32, semantics = 0x8 : i32} : (!spv.ptr<f32, StorageBuffer>, f64) -> (f64)
return %0 : f64
@ -267,7 +267,7 @@ func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f64) -> f64 {
// -----
func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
func.func @atomic_fadd(%ptr : !spv.ptr<f32, StorageBuffer>, %value : f32) -> f32 {
// expected-error @+1 {{expected at most one of these four memory constraints to be set: `Acquire`, `Release`,`AcquireRelease` or `SequentiallyConsistent`}}
%0 = spv.AtomicFAddEXT "Device" "Acquire|Release" %ptr, %value : !spv.ptr<f32, StorageBuffer>
return %0 : f32

View File

@ -1,7 +1,7 @@
// RUN: mlir-opt -mlir-disable-threading -test-spirv-op-availability %s | FileCheck %s
// CHECK-LABEL: iadd
func @iadd(%arg: i32) -> i32 {
func.func @iadd(%arg: i32) -> i32 {
// CHECK: min version: v1.0
// CHECK: max version: v1.5
// CHECK: extensions: [ ]
@ -11,7 +11,7 @@ func @iadd(%arg: i32) -> i32 {
}
// CHECK: atomic_compare_exchange_weak
func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
func.func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32, %comparator: i32) -> i32 {
// CHECK: min version: v1.0
// CHECK: max version: v1.3
// CHECK: extensions: [ ]
@ -21,7 +21,7 @@ func @atomic_compare_exchange_weak(%ptr: !spv.ptr<i32, Workgroup>, %value: i32,
}
// CHECK-LABEL: subgroup_ballot
func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
// CHECK: min version: v1.3
// CHECK: max version: v1.5
// CHECK: extensions: [ ]
@ -31,7 +31,7 @@ func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
}
// CHECK-LABEL: module_logical_glsl450
func @module_logical_glsl450() {
func.func @module_logical_glsl450() {
// CHECK: spv.module min version: v1.0
// CHECK: spv.module max version: v1.5
// CHECK: spv.module extensions: [ ]
@ -41,7 +41,7 @@ func @module_logical_glsl450() {
}
// CHECK-LABEL: module_physical_storage_buffer64_vulkan
func @module_physical_storage_buffer64_vulkan() {
func.func @module_physical_storage_buffer64_vulkan() {
// CHECK: spv.module min version: v1.0
// CHECK: spv.module max version: v1.5
// CHECK: spv.module extensions: [ [SPV_EXT_physical_storage_buffer, SPV_KHR_physical_storage_buffer] [SPV_KHR_vulkan_memory_model] ]

View File

@ -4,7 +4,7 @@
// spv.ControlBarrier
//===----------------------------------------------------------------------===//
func @control_barrier_0() -> () {
func.func @control_barrier_0() -> () {
// CHECK: spv.ControlBarrier Workgroup, Device, "Acquire|UniformMemory"
spv.ControlBarrier Workgroup, Device, "Acquire|UniformMemory"
return
@ -12,7 +12,7 @@ func @control_barrier_0() -> () {
// -----
func @control_barrier_1() -> () {
func.func @control_barrier_1() -> () {
// expected-error @+1 {{expected string or keyword containing one of the following enum values}}
spv.ControlBarrier Something, Device, "Acquire|UniformMemory"
return
@ -25,7 +25,7 @@ func @control_barrier_1() -> () {
// spv.MemoryBarrier
//===----------------------------------------------------------------------===//
func @memory_barrier_0() -> () {
func.func @memory_barrier_0() -> () {
// CHECK: spv.MemoryBarrier Device, "Acquire|UniformMemory"
spv.MemoryBarrier Device, "Acquire|UniformMemory"
return
@ -33,7 +33,7 @@ func @memory_barrier_0() -> () {
// -----
func @memory_barrier_1() -> () {
func.func @memory_barrier_1() -> () {
// CHECK: spv.MemoryBarrier Workgroup, Acquire
spv.MemoryBarrier Workgroup, Acquire
return
@ -41,7 +41,7 @@ func @memory_barrier_1() -> () {
// -----
func @memory_barrier_2() -> () {
func.func @memory_barrier_2() -> () {
// expected-error @+1 {{expected at most one of these four memory constraints to be set: `Acquire`, `Release`,`AcquireRelease` or `SequentiallyConsistent`}}
spv.MemoryBarrier Device, "Acquire|Release"
return

View File

@ -4,7 +4,7 @@
// spv.BitCount
//===----------------------------------------------------------------------===//
func @bitcount(%arg: i32) -> i32 {
func.func @bitcount(%arg: i32) -> i32 {
// CHECK: spv.BitCount {{%.*}} : i32
%0 = spv.BitCount %arg : i32
spv.ReturnValue %0 : i32
@ -16,7 +16,7 @@ func @bitcount(%arg: i32) -> i32 {
// spv.BitFieldInsert
//===----------------------------------------------------------------------===//
func @bit_field_insert_vec(%base: vector<3xi32>, %insert: vector<3xi32>, %offset: i32, %count: i16) -> vector<3xi32> {
func.func @bit_field_insert_vec(%base: vector<3xi32>, %insert: vector<3xi32>, %offset: i32, %count: i16) -> vector<3xi32> {
// CHECK: {{%.*}} = spv.BitFieldInsert {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : vector<3xi32>, i32, i16
%0 = spv.BitFieldInsert %base, %insert, %offset, %count : vector<3xi32>, i32, i16
spv.ReturnValue %0 : vector<3xi32>
@ -24,7 +24,7 @@ func @bit_field_insert_vec(%base: vector<3xi32>, %insert: vector<3xi32>, %offset
// -----
func @bit_field_insert_invalid_insert_type(%base: vector<3xi32>, %insert: vector<2xi32>, %offset: i32, %count: i16) -> vector<3xi32> {
func.func @bit_field_insert_invalid_insert_type(%base: vector<3xi32>, %insert: vector<2xi32>, %offset: i32, %count: i16) -> vector<3xi32> {
// TODO: expand post change in verification order. This is currently only
// verifying that the type verification is failing but not the specific error
// message. In final state the error should refer to mismatch in base and
@ -40,7 +40,7 @@ func @bit_field_insert_invalid_insert_type(%base: vector<3xi32>, %insert: vector
// spv.BitFieldSExtract
//===----------------------------------------------------------------------===//
func @bit_field_s_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> {
func.func @bit_field_s_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> {
// CHECK: {{%.*}} = spv.BitFieldSExtract {{%.*}}, {{%.*}}, {{%.*}} : vector<3xi32>, i8, i8
%0 = spv.BitFieldSExtract %base, %offset, %count : vector<3xi32>, i8, i8
spv.ReturnValue %0 : vector<3xi32>
@ -50,7 +50,7 @@ func @bit_field_s_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) ->
// spv.BitFieldUExtract
//===----------------------------------------------------------------------===//
func @bit_field_u_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> {
func.func @bit_field_u_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> {
// CHECK: {{%.*}} = spv.BitFieldUExtract {{%.*}}, {{%.*}}, {{%.*}} : vector<3xi32>, i8, i8
%0 = spv.BitFieldUExtract %base, %offset, %count : vector<3xi32>, i8, i8
spv.ReturnValue %0 : vector<3xi32>
@ -58,7 +58,7 @@ func @bit_field_u_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) ->
// -----
func @bit_field_u_extract_invalid_result_type(%base: vector<3xi32>, %offset: i32, %count: i16) -> vector<4xi32> {
func.func @bit_field_u_extract_invalid_result_type(%base: vector<3xi32>, %offset: i32, %count: i16) -> vector<4xi32> {
// expected-error @+1 {{failed to verify that all of {base, result} have same type}}
%0 = "spv.BitFieldUExtract" (%base, %offset, %count) : (vector<3xi32>, i32, i16) -> vector<4xi32>
spv.ReturnValue %0 : vector<4xi32>
@ -70,7 +70,7 @@ func @bit_field_u_extract_invalid_result_type(%base: vector<3xi32>, %offset: i32
// spv.BitReverse
//===----------------------------------------------------------------------===//
func @bitreverse(%arg: i32) -> i32 {
func.func @bitreverse(%arg: i32) -> i32 {
// CHECK: spv.BitReverse {{%.*}} : i32
%0 = spv.BitReverse %arg : i32
spv.ReturnValue %0 : i32
@ -82,13 +82,13 @@ func @bitreverse(%arg: i32) -> i32 {
// spv.BitwiseOr
//===----------------------------------------------------------------------===//
func @bitwise_or_scalar(%arg: i32) -> i32 {
func.func @bitwise_or_scalar(%arg: i32) -> i32 {
// CHECK: spv.BitwiseOr
%0 = spv.BitwiseOr %arg, %arg : i32
return %0 : i32
}
func @bitwise_or_vector(%arg: vector<4xi32>) -> vector<4xi32> {
func.func @bitwise_or_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// CHECK: spv.BitwiseOr
%0 = spv.BitwiseOr %arg, %arg : vector<4xi32>
return %0 : vector<4xi32>
@ -96,7 +96,7 @@ func @bitwise_or_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// -----
func @bitwise_or_float(%arg0: f16, %arg1: f16) -> f16 {
func.func @bitwise_or_float(%arg0: f16, %arg1: f16) -> f16 {
// expected-error @+1 {{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}}
%0 = spv.BitwiseOr %arg0, %arg1 : f16
return %0 : f16
@ -108,13 +108,13 @@ func @bitwise_or_float(%arg0: f16, %arg1: f16) -> f16 {
// spv.BitwiseXor
//===----------------------------------------------------------------------===//
func @bitwise_xor_scalar(%arg: i32) -> i32 {
func.func @bitwise_xor_scalar(%arg: i32) -> i32 {
// CHECK: spv.BitwiseXor
%0 = spv.BitwiseXor %arg, %arg : i32
return %0 : i32
}
func @bitwise_xor_vector(%arg: vector<4xi32>) -> vector<4xi32> {
func.func @bitwise_xor_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// CHECK: spv.BitwiseXor
%0 = spv.BitwiseXor %arg, %arg : vector<4xi32>
return %0 : vector<4xi32>
@ -122,7 +122,7 @@ func @bitwise_xor_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// -----
func @bitwise_xor_float(%arg0: f16, %arg1: f16) -> f16 {
func.func @bitwise_xor_float(%arg0: f16, %arg1: f16) -> f16 {
// expected-error @+1 {{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}}
%0 = spv.BitwiseXor %arg0, %arg1 : f16
return %0 : f16
@ -134,13 +134,13 @@ func @bitwise_xor_float(%arg0: f16, %arg1: f16) -> f16 {
// spv.BitwiseAnd
//===----------------------------------------------------------------------===//
func @bitwise_and_scalar(%arg: i32) -> i32 {
func.func @bitwise_and_scalar(%arg: i32) -> i32 {
// CHECK: spv.BitwiseAnd
%0 = spv.BitwiseAnd %arg, %arg : i32
return %0 : i32
}
func @bitwise_and_vector(%arg: vector<4xi32>) -> vector<4xi32> {
func.func @bitwise_and_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// CHECK: spv.BitwiseAnd
%0 = spv.BitwiseAnd %arg, %arg : vector<4xi32>
return %0 : vector<4xi32>
@ -148,7 +148,7 @@ func @bitwise_and_vector(%arg: vector<4xi32>) -> vector<4xi32> {
// -----
func @bitwise_and_float(%arg0: f16, %arg1: f16) -> f16 {
func.func @bitwise_and_float(%arg0: f16, %arg1: f16) -> f16 {
// expected-error @+1 {{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}}
%0 = spv.BitwiseAnd %arg0, %arg1 : f16
return %0 : f16
@ -160,7 +160,7 @@ func @bitwise_and_float(%arg0: f16, %arg1: f16) -> f16 {
// spv.Not
//===----------------------------------------------------------------------===//
func @not(%arg: i32) -> i32 {
func.func @not(%arg: i32) -> i32 {
// CHECK: spv.Not {{%.*}} : i32
%0 = spv.Not %arg : i32
spv.ReturnValue %0 : i32
@ -172,7 +172,7 @@ func @not(%arg: i32) -> i32 {
// spv.ShiftLeftLogical
//===----------------------------------------------------------------------===//
func @shift_left_logical(%arg0: i32, %arg1 : i16) -> i32 {
func.func @shift_left_logical(%arg0: i32, %arg1 : i16) -> i32 {
// CHECK: {{%.*}} = spv.ShiftLeftLogical {{%.*}}, {{%.*}} : i32, i16
%0 = spv.ShiftLeftLogical %arg0, %arg1: i32, i16
spv.ReturnValue %0 : i32
@ -180,7 +180,7 @@ func @shift_left_logical(%arg0: i32, %arg1 : i16) -> i32 {
// -----
func @shift_left_logical_invalid_result_type(%arg0: i32, %arg1 : i16) -> i16 {
func.func @shift_left_logical_invalid_result_type(%arg0: i32, %arg1 : i16) -> i16 {
// expected-error @+1 {{op failed to verify that all of {operand1, result} have same type}}
%0 = "spv.ShiftLeftLogical" (%arg0, %arg1) : (i32, i16) -> (i16)
spv.ReturnValue %0 : i16
@ -192,7 +192,7 @@ func @shift_left_logical_invalid_result_type(%arg0: i32, %arg1 : i16) -> i16 {
// spv.ShiftRightArithmetic
//===----------------------------------------------------------------------===//
func @shift_right_arithmetic(%arg0: vector<4xi32>, %arg1 : vector<4xi8>) -> vector<4xi32> {
func.func @shift_right_arithmetic(%arg0: vector<4xi32>, %arg1 : vector<4xi8>) -> vector<4xi32> {
// CHECK: {{%.*}} = spv.ShiftRightArithmetic {{%.*}}, {{%.*}} : vector<4xi32>, vector<4xi8>
%0 = spv.ShiftRightArithmetic %arg0, %arg1: vector<4xi32>, vector<4xi8>
spv.ReturnValue %0 : vector<4xi32>
@ -204,7 +204,7 @@ func @shift_right_arithmetic(%arg0: vector<4xi32>, %arg1 : vector<4xi8>) -> vect
// spv.ShiftRightLogical
//===----------------------------------------------------------------------===//
func @shift_right_logical(%arg0: vector<2xi32>, %arg1 : vector<2xi8>) -> vector<2xi32> {
func.func @shift_right_logical(%arg0: vector<2xi32>, %arg1 : vector<2xi8>) -> vector<2xi32> {
// CHECK: {{%.*}} = spv.ShiftRightLogical {{%.*}}, {{%.*}} : vector<2xi32>, vector<2xi8>
%0 = spv.ShiftRightLogical %arg0, %arg1: vector<2xi32>, vector<2xi8>
spv.ReturnValue %0 : vector<2xi32>

View File

@ -4,37 +4,37 @@
// spv.Bitcast
//===----------------------------------------------------------------------===//
func @cast1(%arg0 : f32) {
func.func @cast1(%arg0 : f32) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : f32 to i32
%0 = spv.Bitcast %arg0 : f32 to i32
return
}
func @cast2(%arg0 : vector<2xf32>) {
func.func @cast2(%arg0 : vector<2xf32>) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : vector<2xf32> to vector<2xi32>
%0 = spv.Bitcast %arg0 : vector<2xf32> to vector<2xi32>
return
}
func @cast3(%arg0 : vector<2xf32>) {
func.func @cast3(%arg0 : vector<2xf32>) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : vector<2xf32> to i64
%0 = spv.Bitcast %arg0 : vector<2xf32> to i64
return
}
func @cast4(%arg0 : !spv.ptr<f32, Function>) {
func.func @cast4(%arg0 : !spv.ptr<f32, Function>) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : !spv.ptr<f32, Function> to !spv.ptr<i32, Function>
%0 = spv.Bitcast %arg0 : !spv.ptr<f32, Function> to !spv.ptr<i32, Function>
return
}
func @cast5(%arg0 : !spv.ptr<f32, Function>) {
func.func @cast5(%arg0 : !spv.ptr<f32, Function>) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : !spv.ptr<f32, Function> to !spv.ptr<vector<2xi32>, Function>
%0 = spv.Bitcast %arg0 : !spv.ptr<f32, Function> to !spv.ptr<vector<2xi32>, Function>
return
}
func @cast6(%arg0 : vector<4xf32>) {
func.func @cast6(%arg0 : vector<4xf32>) {
// CHECK: {{%.*}} = spv.Bitcast {{%.*}} : vector<4xf32> to vector<2xi64>
%0 = spv.Bitcast %arg0 : vector<4xf32> to vector<2xi64>
return
@ -42,7 +42,7 @@ func @cast6(%arg0 : vector<4xf32>) {
// -----
func @cast1(%arg0 : f32) {
func.func @cast1(%arg0 : f32) {
// expected-error @+1 {{result type must be different from operand type}}
%0 = spv.Bitcast %arg0 : f32 to f32
return
@ -50,7 +50,7 @@ func @cast1(%arg0 : f32) {
// -----
func @cast1(%arg0 : f32) {
func.func @cast1(%arg0 : f32) {
// expected-error @+1 {{mismatch in result type bitwidth 64 and operand type bitwidth 32}}
%0 = spv.Bitcast %arg0 : f32 to i64
return
@ -58,7 +58,7 @@ func @cast1(%arg0 : f32) {
// -----
func @cast1(%arg0 : vector<2xf32>) {
func.func @cast1(%arg0 : vector<2xf32>) {
// expected-error @+1 {{mismatch in result type bitwidth 96 and operand type bitwidth 64}}
%0 = spv.Bitcast %arg0 : vector<2xf32> to vector<3xf32>
return
@ -66,7 +66,7 @@ func @cast1(%arg0 : vector<2xf32>) {
// -----
func @cast3(%arg0 : !spv.ptr<f32, Function>) {
func.func @cast3(%arg0 : !spv.ptr<f32, Function>) {
// expected-error @+1 {{unhandled bit cast conversion from pointer type to non-pointer type}}
%0 = spv.Bitcast %arg0 : !spv.ptr<f32, Function> to i64
return
@ -74,7 +74,7 @@ func @cast3(%arg0 : !spv.ptr<f32, Function>) {
// -----
func @cast3(%arg0 : i64) {
func.func @cast3(%arg0 : i64) {
// expected-error @+1 {{unhandled bit cast conversion from non-pointer type to pointer type}}
%0 = spv.Bitcast %arg0 : i64 to !spv.ptr<f32, Function>
return
@ -86,7 +86,7 @@ func @cast3(%arg0 : i64) {
// spv.ConvertFToS
//===----------------------------------------------------------------------===//
func @convert_f_to_s_scalar(%arg0 : f32) -> i32 {
func.func @convert_f_to_s_scalar(%arg0 : f32) -> i32 {
// CHECK: {{%.*}} = spv.ConvertFToS {{%.*}} : f32 to i32
%0 = spv.ConvertFToS %arg0 : f32 to i32
spv.ReturnValue %0 : i32
@ -94,7 +94,7 @@ func @convert_f_to_s_scalar(%arg0 : f32) -> i32 {
// -----
func @convert_f64_to_s32_scalar(%arg0 : f64) -> i32 {
func.func @convert_f64_to_s32_scalar(%arg0 : f64) -> i32 {
// CHECK: {{%.*}} = spv.ConvertFToS {{%.*}} : f64 to i32
%0 = spv.ConvertFToS %arg0 : f64 to i32
spv.ReturnValue %0 : i32
@ -102,7 +102,7 @@ func @convert_f64_to_s32_scalar(%arg0 : f64) -> i32 {
// -----
func @convert_f_to_s_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
func.func @convert_f_to_s_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
// CHECK: {{%.*}} = spv.ConvertFToS {{%.*}} : vector<3xf32> to vector<3xi32>
%0 = spv.ConvertFToS %arg0 : vector<3xf32> to vector<3xi32>
spv.ReturnValue %0 : vector<3xi32>
@ -114,7 +114,7 @@ func @convert_f_to_s_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
// spv.ConvertFToU
//===----------------------------------------------------------------------===//
func @convert_f_to_u_scalar(%arg0 : f32) -> i32 {
func.func @convert_f_to_u_scalar(%arg0 : f32) -> i32 {
// CHECK: {{%.*}} = spv.ConvertFToU {{%.*}} : f32 to i32
%0 = spv.ConvertFToU %arg0 : f32 to i32
spv.ReturnValue %0 : i32
@ -122,7 +122,7 @@ func @convert_f_to_u_scalar(%arg0 : f32) -> i32 {
// -----
func @convert_f64_to_u32_scalar(%arg0 : f64) -> i32 {
func.func @convert_f64_to_u32_scalar(%arg0 : f64) -> i32 {
// CHECK: {{%.*}} = spv.ConvertFToU {{%.*}} : f64 to i32
%0 = spv.ConvertFToU %arg0 : f64 to i32
spv.ReturnValue %0 : i32
@ -130,7 +130,7 @@ func @convert_f64_to_u32_scalar(%arg0 : f64) -> i32 {
// -----
func @convert_f_to_u_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
func.func @convert_f_to_u_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
// CHECK: {{%.*}} = spv.ConvertFToU {{%.*}} : vector<3xf32> to vector<3xi32>
%0 = spv.ConvertFToU %arg0 : vector<3xf32> to vector<3xi32>
spv.ReturnValue %0 : vector<3xi32>
@ -138,7 +138,7 @@ func @convert_f_to_u_vector(%arg0 : vector<3xf32>) -> vector<3xi32> {
// -----
func @convert_f_to_u_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
func.func @convert_f_to_u_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
// CHECK: {{%.*}} = spv.ConvertFToU {{%.*}} : !spv.coopmatrix<8x16xf32, Subgroup> to !spv.coopmatrix<8x16xi32, Subgroup>
%0 = spv.ConvertFToU %arg0 : !spv.coopmatrix<8x16xf32, Subgroup> to !spv.coopmatrix<8x16xi32, Subgroup>
spv.Return
@ -150,7 +150,7 @@ func @convert_f_to_u_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
// spv.ConvertSToF
//===----------------------------------------------------------------------===//
func @convert_s_to_f_scalar(%arg0 : i32) -> f32 {
func.func @convert_s_to_f_scalar(%arg0 : i32) -> f32 {
// CHECK: {{%.*}} = spv.ConvertSToF {{%.*}} : i32 to f32
%0 = spv.ConvertSToF %arg0 : i32 to f32
spv.ReturnValue %0 : f32
@ -158,7 +158,7 @@ func @convert_s_to_f_scalar(%arg0 : i32) -> f32 {
// -----
func @convert_s64_to_f32_scalar(%arg0 : i64) -> f32 {
func.func @convert_s64_to_f32_scalar(%arg0 : i64) -> f32 {
// CHECK: {{%.*}} = spv.ConvertSToF {{%.*}} : i64 to f32
%0 = spv.ConvertSToF %arg0 : i64 to f32
spv.ReturnValue %0 : f32
@ -166,7 +166,7 @@ func @convert_s64_to_f32_scalar(%arg0 : i64) -> f32 {
// -----
func @convert_s_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
func.func @convert_s_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
// CHECK: {{%.*}} = spv.ConvertSToF {{%.*}} : vector<3xi32> to vector<3xf32>
%0 = spv.ConvertSToF %arg0 : vector<3xi32> to vector<3xf32>
spv.ReturnValue %0 : vector<3xf32>
@ -178,7 +178,7 @@ func @convert_s_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
// spv.ConvertUToF
//===----------------------------------------------------------------------===//
func @convert_u_to_f_scalar(%arg0 : i32) -> f32 {
func.func @convert_u_to_f_scalar(%arg0 : i32) -> f32 {
// CHECK: {{%.*}} = spv.ConvertUToF {{%.*}} : i32 to f32
%0 = spv.ConvertUToF %arg0 : i32 to f32
spv.ReturnValue %0 : f32
@ -186,7 +186,7 @@ func @convert_u_to_f_scalar(%arg0 : i32) -> f32 {
// -----
func @convert_u64_to_f32_scalar(%arg0 : i64) -> f32 {
func.func @convert_u64_to_f32_scalar(%arg0 : i64) -> f32 {
// CHECK: {{%.*}} = spv.ConvertUToF {{%.*}} : i64 to f32
%0 = spv.ConvertUToF %arg0 : i64 to f32
spv.ReturnValue %0 : f32
@ -194,7 +194,7 @@ func @convert_u64_to_f32_scalar(%arg0 : i64) -> f32 {
// -----
func @convert_u_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
func.func @convert_u_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
// CHECK: {{%.*}} = spv.ConvertUToF {{%.*}} : vector<3xi32> to vector<3xf32>
%0 = spv.ConvertUToF %arg0 : vector<3xi32> to vector<3xf32>
spv.ReturnValue %0 : vector<3xf32>
@ -206,7 +206,7 @@ func @convert_u_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> {
// spv.FConvert
//===----------------------------------------------------------------------===//
func @f_convert_scalar(%arg0 : f32) -> f64 {
func.func @f_convert_scalar(%arg0 : f32) -> f64 {
// CHECK: {{%.*}} = spv.FConvert {{%.*}} : f32 to f64
%0 = spv.FConvert %arg0 : f32 to f64
spv.ReturnValue %0 : f64
@ -214,7 +214,7 @@ func @f_convert_scalar(%arg0 : f32) -> f64 {
// -----
func @f_convert_vector(%arg0 : vector<3xf32>) -> vector<3xf64> {
func.func @f_convert_vector(%arg0 : vector<3xf32>) -> vector<3xf64> {
// CHECK: {{%.*}} = spv.FConvert {{%.*}} : vector<3xf32> to vector<3xf64>
%0 = spv.FConvert %arg0 : vector<3xf32> to vector<3xf64>
spv.ReturnValue %0 : vector<3xf64>
@ -222,7 +222,7 @@ func @f_convert_vector(%arg0 : vector<3xf32>) -> vector<3xf64> {
// -----
func @f_convert_coop_matrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
func.func @f_convert_coop_matrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
// CHECK: {{%.*}} = spv.FConvert {{%.*}} : !spv.coopmatrix<8x16xf32, Subgroup> to !spv.coopmatrix<8x16xf64, Subgroup>
%0 = spv.FConvert %arg0 : !spv.coopmatrix<8x16xf32, Subgroup> to !spv.coopmatrix<8x16xf64, Subgroup>
spv.Return
@ -230,7 +230,7 @@ func @f_convert_coop_matrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) {
// -----
func @f_convert_vector(%arg0 : f32) -> f32 {
func.func @f_convert_vector(%arg0 : f32) -> f32 {
// expected-error @+1 {{expected the different bit widths for operand type and result type, but provided 'f32' and 'f32'}}
%0 = spv.FConvert %arg0 : f32 to f32
spv.ReturnValue %0 : f32
@ -242,7 +242,7 @@ func @f_convert_vector(%arg0 : f32) -> f32 {
// spv.SConvert
//===----------------------------------------------------------------------===//
func @s_convert_scalar(%arg0 : i32) -> i64 {
func.func @s_convert_scalar(%arg0 : i32) -> i64 {
// CHECK: {{%.*}} = spv.SConvert {{%.*}} : i32 to i64
%0 = spv.SConvert %arg0 : i32 to i64
spv.ReturnValue %0 : i64
@ -254,7 +254,7 @@ func @s_convert_scalar(%arg0 : i32) -> i64 {
// spv.UConvert
//===----------------------------------------------------------------------===//
func @u_convert_scalar(%arg0 : i32) -> i64 {
func.func @u_convert_scalar(%arg0 : i32) -> i64 {
// CHECK: {{%.*}} = spv.UConvert {{%.*}} : i32 to i64
%0 = spv.UConvert %arg0 : i32 to i64
spv.ReturnValue %0 : i64

View File

@ -4,7 +4,7 @@
// spv.CompositeConstruct
//===----------------------------------------------------------------------===//
func @composite_construct_vector(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> {
func.func @composite_construct_vector(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> {
// CHECK: spv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : vector<3xf32>
%0 = spv.CompositeConstruct %arg0, %arg1, %arg2 : vector<3xf32>
return %0: vector<3xf32>
@ -12,7 +12,7 @@ func @composite_construct_vector(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<
// -----
func @composite_construct_struct(%arg0: vector<3xf32>, %arg1: !spv.array<4xf32>, %arg2 : !spv.struct<(f32)>) -> !spv.struct<(vector<3xf32>, !spv.array<4xf32>, !spv.struct<(f32)>)> {
func.func @composite_construct_struct(%arg0: vector<3xf32>, %arg1: !spv.array<4xf32>, %arg2 : !spv.struct<(f32)>) -> !spv.struct<(vector<3xf32>, !spv.array<4xf32>, !spv.struct<(f32)>)> {
// CHECK: spv.CompositeConstruct %arg0, %arg1, %arg2 : !spv.struct<(vector<3xf32>, !spv.array<4 x f32>, !spv.struct<(f32)>)>
%0 = spv.CompositeConstruct %arg0, %arg1, %arg2 : !spv.struct<(vector<3xf32>, !spv.array<4xf32>, !spv.struct<(f32)>)>
return %0: !spv.struct<(vector<3xf32>, !spv.array<4xf32>, !spv.struct<(f32)>)>
@ -20,7 +20,7 @@ func @composite_construct_struct(%arg0: vector<3xf32>, %arg1: !spv.array<4xf32>,
// -----
func @composite_construct_coopmatrix(%arg0 : f32) -> !spv.coopmatrix<8x16xf32, Subgroup> {
func.func @composite_construct_coopmatrix(%arg0 : f32) -> !spv.coopmatrix<8x16xf32, Subgroup> {
// CHECK: spv.CompositeConstruct {{%.*}} : !spv.coopmatrix<8x16xf32, Subgroup>
%0 = spv.CompositeConstruct %arg0 : !spv.coopmatrix<8x16xf32, Subgroup>
return %0: !spv.coopmatrix<8x16xf32, Subgroup>
@ -28,7 +28,7 @@ func @composite_construct_coopmatrix(%arg0 : f32) -> !spv.coopmatrix<8x16xf32, S
// -----
func @composite_construct_empty_struct() -> !spv.struct<()> {
func.func @composite_construct_empty_struct() -> !spv.struct<()> {
// CHECK: spv.CompositeConstruct : !spv.struct<()>
%0 = spv.CompositeConstruct : !spv.struct<()>
return %0: !spv.struct<()>
@ -36,7 +36,7 @@ func @composite_construct_empty_struct() -> !spv.struct<()> {
// -----
func @composite_construct_invalid_num_of_elements(%arg0: f32) -> f32 {
func.func @composite_construct_invalid_num_of_elements(%arg0: f32) -> f32 {
// expected-error @+1 {{result type must be a composite type, but provided 'f32'}}
%0 = spv.CompositeConstruct %arg0 : f32
return %0: f32
@ -44,7 +44,7 @@ func @composite_construct_invalid_num_of_elements(%arg0: f32) -> f32 {
// -----
func @composite_construct_invalid_result_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> {
func.func @composite_construct_invalid_result_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> {
// expected-error @+1 {{has incorrect number of operands: expected 3, but provided 2}}
%0 = spv.CompositeConstruct %arg0, %arg2 : vector<3xf32>
return %0: vector<3xf32>
@ -52,7 +52,7 @@ func @composite_construct_invalid_result_type(%arg0: f32, %arg1: f32, %arg2 : f3
// -----
func @composite_construct_invalid_operand_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xi32> {
func.func @composite_construct_invalid_operand_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xi32> {
// expected-error @+1 {{operand type mismatch: expected operand type 'i32', but provided 'f32'}}
%0 = "spv.CompositeConstruct" (%arg0, %arg1, %arg2) : (f32, f32, f32) -> vector<3xi32>
return %0: vector<3xi32>
@ -60,7 +60,7 @@ func @composite_construct_invalid_operand_type(%arg0: f32, %arg1: f32, %arg2 : f
// -----
func @composite_construct_coopmatrix(%arg0 : f32, %arg1 : f32) -> !spv.coopmatrix<8x16xf32, Subgroup> {
func.func @composite_construct_coopmatrix(%arg0 : f32, %arg1 : f32) -> !spv.coopmatrix<8x16xf32, Subgroup> {
// expected-error @+1 {{has incorrect number of operands: expected 1, but provided 2}}
%0 = spv.CompositeConstruct %arg0, %arg1 : !spv.coopmatrix<8x16xf32, Subgroup>
return %0: !spv.coopmatrix<8x16xf32, Subgroup>
@ -72,7 +72,7 @@ func @composite_construct_coopmatrix(%arg0 : f32, %arg1 : f32) -> !spv.coopmatri
// spv.CompositeExtractOp
//===----------------------------------------------------------------------===//
func @composite_extract_array(%arg0: !spv.array<4xf32>) -> f32 {
func.func @composite_extract_array(%arg0: !spv.array<4xf32>) -> f32 {
// CHECK: {{%.*}} = spv.CompositeExtract {{%.*}}[1 : i32] : !spv.array<4 x f32>
%0 = spv.CompositeExtract %arg0[1 : i32] : !spv.array<4xf32>
return %0: f32
@ -80,7 +80,7 @@ func @composite_extract_array(%arg0: !spv.array<4xf32>) -> f32 {
// -----
func @composite_extract_struct(%arg0 : !spv.struct<(f32, !spv.array<4xf32>)>) -> f32 {
func.func @composite_extract_struct(%arg0 : !spv.struct<(f32, !spv.array<4xf32>)>) -> f32 {
// CHECK: {{%.*}} = spv.CompositeExtract {{%.*}}[1 : i32, 2 : i32] : !spv.struct<(f32, !spv.array<4 x f32>)>
%0 = spv.CompositeExtract %arg0[1 : i32, 2 : i32] : !spv.struct<(f32, !spv.array<4xf32>)>
return %0 : f32
@ -88,7 +88,7 @@ func @composite_extract_struct(%arg0 : !spv.struct<(f32, !spv.array<4xf32>)>) ->
// -----
func @composite_extract_vector(%arg0 : vector<4xf32>) -> f32 {
func.func @composite_extract_vector(%arg0 : vector<4xf32>) -> f32 {
// CHECK: {{%.*}} = spv.CompositeExtract {{%.*}}[1 : i32] : vector<4xf32>
%0 = spv.CompositeExtract %arg0[1 : i32] : vector<4xf32>
return %0 : f32
@ -96,7 +96,7 @@ func @composite_extract_vector(%arg0 : vector<4xf32>) -> f32 {
// -----
func @composite_extract_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) -> f32 {
func.func @composite_extract_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>) -> f32 {
// CHECK: {{%.*}} = spv.CompositeExtract {{%.*}}[2 : i32] : !spv.coopmatrix<8x16xf32, Subgroup>
%0 = spv.CompositeExtract %arg0[2 : i32] : !spv.coopmatrix<8x16xf32, Subgroup>
return %0 : f32
@ -104,7 +104,7 @@ func @composite_extract_coopmatrix(%arg0 : !spv.coopmatrix<8x16xf32, Subgroup>)
// -----
func @composite_extract_no_ssa_operand() -> () {
func.func @composite_extract_no_ssa_operand() -> () {
// expected-error @+1 {{expected SSA operand}}
%0 = spv.CompositeExtract [4 : i32, 1 : i32] : !spv.array<4x!spv.array<4xf32>>
return
@ -112,7 +112,7 @@ func @composite_extract_no_ssa_operand() -> () {
// -----
func @composite_extract_invalid_index_type_1() -> () {
func.func @composite_extract_invalid_index_type_1() -> () {
%0 = spv.Constant 10 : i32
%1 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
%2 = spv.Load "Function" %1 ["Volatile"] : !spv.array<4x!spv.array<4xf32>>
@ -123,7 +123,7 @@ func @composite_extract_invalid_index_type_1() -> () {
// -----
func @composite_extract_invalid_index_type_2(%arg0 : !spv.array<4x!spv.array<4xf32>>) -> () {
func.func @composite_extract_invalid_index_type_2(%arg0 : !spv.array<4x!spv.array<4xf32>>) -> () {
// expected-error @+1 {{attribute 'indices' failed to satisfy constraint: 32-bit integer array attribute}}
%0 = spv.CompositeExtract %arg0[1] : !spv.array<4x!spv.array<4xf32>>
return
@ -131,7 +131,7 @@ func @composite_extract_invalid_index_type_2(%arg0 : !spv.array<4x!spv.array<4xf
// -----
func @composite_extract_invalid_index_identifier(%arg0 : !spv.array<4x!spv.array<4xf32>>) -> () {
func.func @composite_extract_invalid_index_identifier(%arg0 : !spv.array<4x!spv.array<4xf32>>) -> () {
// expected-error @+1 {{expected non-function type}}
%0 = spv.CompositeExtract %arg0 ]1 : i32) : !spv.array<4x!spv.array<4xf32>>
return
@ -139,7 +139,7 @@ func @composite_extract_invalid_index_identifier(%arg0 : !spv.array<4x!spv.array
// -----
func @composite_extract_2D_array_out_of_bounds_access_1(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
func.func @composite_extract_2D_array_out_of_bounds_access_1(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
// expected-error @+1 {{index 4 out of bounds for '!spv.array<4 x !spv.array<4 x f32>>'}}
%0 = spv.CompositeExtract %arg0[4 : i32, 1 : i32] : !spv.array<4x!spv.array<4xf32>>
return
@ -147,7 +147,7 @@ func @composite_extract_2D_array_out_of_bounds_access_1(%arg0: !spv.array<4x!spv
// -----
func @composite_extract_2D_array_out_of_bounds_access_2(%arg0: !spv.array<4x!spv.array<4xf32>>
func.func @composite_extract_2D_array_out_of_bounds_access_2(%arg0: !spv.array<4x!spv.array<4xf32>>
) -> () {
// expected-error @+1 {{index 4 out of bounds for '!spv.array<4 x f32>'}}
%0 = spv.CompositeExtract %arg0[1 : i32, 4 : i32] : !spv.array<4x!spv.array<4xf32>>
@ -156,7 +156,7 @@ func @composite_extract_2D_array_out_of_bounds_access_2(%arg0: !spv.array<4x!spv
// -----
func @composite_extract_struct_element_out_of_bounds_access(%arg0 : !spv.struct<(f32, !spv.array<4xf32>)>) -> () {
func.func @composite_extract_struct_element_out_of_bounds_access(%arg0 : !spv.struct<(f32, !spv.array<4xf32>)>) -> () {
// expected-error @+1 {{index 2 out of bounds for '!spv.struct<(f32, !spv.array<4 x f32>)>'}}
%0 = spv.CompositeExtract %arg0[2 : i32, 0 : i32] : !spv.struct<(f32, !spv.array<4xf32>)>
return
@ -164,7 +164,7 @@ func @composite_extract_struct_element_out_of_bounds_access(%arg0 : !spv.struct<
// -----
func @composite_extract_vector_out_of_bounds_access(%arg0: vector<4xf32>) -> () {
func.func @composite_extract_vector_out_of_bounds_access(%arg0: vector<4xf32>) -> () {
// expected-error @+1 {{index 4 out of bounds for 'vector<4xf32>'}}
%0 = spv.CompositeExtract %arg0[4 : i32] : vector<4xf32>
return
@ -172,7 +172,7 @@ func @composite_extract_vector_out_of_bounds_access(%arg0: vector<4xf32>) -> ()
// -----
func @composite_extract_invalid_types_1(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
func.func @composite_extract_invalid_types_1(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
// expected-error @+1 {{cannot extract from non-composite type 'f32' with index 3}}
%0 = spv.CompositeExtract %arg0[1 : i32, 2 : i32, 3 : i32] : !spv.array<4x!spv.array<4xf32>>
return
@ -180,7 +180,7 @@ func @composite_extract_invalid_types_1(%arg0: !spv.array<4x!spv.array<4xf32>>)
// -----
func @composite_extract_invalid_types_2(%arg0: f32) -> () {
func.func @composite_extract_invalid_types_2(%arg0: f32) -> () {
// expected-error @+1 {{cannot extract from non-composite type 'f32' with index 1}}
%0 = spv.CompositeExtract %arg0[1 : i32] : f32
return
@ -188,7 +188,7 @@ func @composite_extract_invalid_types_2(%arg0: f32) -> () {
// -----
func @composite_extract_invalid_extracted_type(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
func.func @composite_extract_invalid_extracted_type(%arg0: !spv.array<4x!spv.array<4xf32>>) -> () {
// expected-error @+1 {{expected at least one index for spv.CompositeExtract}}
%0 = spv.CompositeExtract %arg0[] : !spv.array<4x!spv.array<4xf32>>
return
@ -196,7 +196,7 @@ func @composite_extract_invalid_extracted_type(%arg0: !spv.array<4x!spv.array<4x
// -----
func @composite_extract_result_type_mismatch(%arg0: !spv.array<4xf32>) -> i32 {
func.func @composite_extract_result_type_mismatch(%arg0: !spv.array<4xf32>) -> i32 {
// expected-error @+1 {{invalid result type: expected 'f32' but provided 'i32'}}
%0 = "spv.CompositeExtract"(%arg0) {indices = [2: i32]} : (!spv.array<4xf32>) -> (i32)
return %0: i32
@ -208,7 +208,7 @@ func @composite_extract_result_type_mismatch(%arg0: !spv.array<4xf32>) -> i32 {
// spv.CompositeInsert
//===----------------------------------------------------------------------===//
func @composite_insert_array(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
func.func @composite_insert_array(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
// CHECK: {{%.*}} = spv.CompositeInsert {{%.*}}, {{%.*}}[1 : i32] : f32 into !spv.array<4 x f32>
%0 = spv.CompositeInsert %arg1, %arg0[1 : i32] : f32 into !spv.array<4xf32>
return %0: !spv.array<4xf32>
@ -216,7 +216,7 @@ func @composite_insert_array(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array
// -----
func @composite_insert_struct(%arg0: !spv.struct<(!spv.array<4xf32>, f32)>, %arg1: !spv.array<4xf32>) -> !spv.struct<(!spv.array<4xf32>, f32)> {
func.func @composite_insert_struct(%arg0: !spv.struct<(!spv.array<4xf32>, f32)>, %arg1: !spv.array<4xf32>) -> !spv.struct<(!spv.array<4xf32>, f32)> {
// CHECK: {{%.*}} = spv.CompositeInsert {{%.*}}, {{%.*}}[0 : i32] : !spv.array<4 x f32> into !spv.struct<(!spv.array<4 x f32>, f32)>
%0 = spv.CompositeInsert %arg1, %arg0[0 : i32] : !spv.array<4xf32> into !spv.struct<(!spv.array<4xf32>, f32)>
return %0: !spv.struct<(!spv.array<4xf32>, f32)>
@ -224,7 +224,7 @@ func @composite_insert_struct(%arg0: !spv.struct<(!spv.array<4xf32>, f32)>, %arg
// -----
func @composite_insert_coopmatrix(%arg0: !spv.coopmatrix<8x16xi32, Subgroup>, %arg1: i32) -> !spv.coopmatrix<8x16xi32, Subgroup> {
func.func @composite_insert_coopmatrix(%arg0: !spv.coopmatrix<8x16xi32, Subgroup>, %arg1: i32) -> !spv.coopmatrix<8x16xi32, Subgroup> {
// CHECK: {{%.*}} = spv.CompositeInsert {{%.*}}, {{%.*}}[5 : i32] : i32 into !spv.coopmatrix<8x16xi32, Subgroup>
%0 = spv.CompositeInsert %arg1, %arg0[5 : i32] : i32 into !spv.coopmatrix<8x16xi32, Subgroup>
return %0: !spv.coopmatrix<8x16xi32, Subgroup>
@ -232,7 +232,7 @@ func @composite_insert_coopmatrix(%arg0: !spv.coopmatrix<8x16xi32, Subgroup>, %a
// -----
func @composite_insert_no_indices(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
func.func @composite_insert_no_indices(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
// expected-error @+1 {{expected at least one index}}
%0 = spv.CompositeInsert %arg1, %arg0[] : f32 into !spv.array<4xf32>
return %0: !spv.array<4xf32>
@ -240,7 +240,7 @@ func @composite_insert_no_indices(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.
// -----
func @composite_insert_out_of_bounds(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
func.func @composite_insert_out_of_bounds(%arg0: !spv.array<4xf32>, %arg1: f32) -> !spv.array<4xf32> {
// expected-error @+1 {{index 4 out of bounds}}
%0 = spv.CompositeInsert %arg1, %arg0[4 : i32] : f32 into !spv.array<4xf32>
return %0: !spv.array<4xf32>
@ -248,7 +248,7 @@ func @composite_insert_out_of_bounds(%arg0: !spv.array<4xf32>, %arg1: f32) -> !s
// -----
func @composite_insert_invalid_object_type(%arg0: !spv.array<4xf32>, %arg1: f64) -> !spv.array<4xf32> {
func.func @composite_insert_invalid_object_type(%arg0: !spv.array<4xf32>, %arg1: f64) -> !spv.array<4xf32> {
// expected-error @+1 {{object operand type should be 'f32', but found 'f64'}}
%0 = spv.CompositeInsert %arg1, %arg0[3 : i32] : f64 into !spv.array<4xf32>
return %0: !spv.array<4xf32>
@ -256,7 +256,7 @@ func @composite_insert_invalid_object_type(%arg0: !spv.array<4xf32>, %arg1: f64)
// -----
func @composite_insert_invalid_result_type(%arg0: !spv.array<4xf32>, %arg1 : f32) -> !spv.array<4xf64> {
func.func @composite_insert_invalid_result_type(%arg0: !spv.array<4xf32>, %arg1 : f32) -> !spv.array<4xf64> {
// expected-error @+1 {{result type should be the same as the composite type, but found '!spv.array<4 x f32>' vs '!spv.array<4 x f64>'}}
%0 = "spv.CompositeInsert"(%arg1, %arg0) {indices = [0: i32]} : (f32, !spv.array<4xf32>) -> !spv.array<4xf64>
return %0: !spv.array<4xf64>
@ -268,7 +268,7 @@ func @composite_insert_invalid_result_type(%arg0: !spv.array<4xf32>, %arg1 : f32
// spv.VectorExtractDynamic
//===----------------------------------------------------------------------===//
func @vector_dynamic_extract(%vec: vector<4xf32>, %id : i32) -> f32 {
func.func @vector_dynamic_extract(%vec: vector<4xf32>, %id : i32) -> f32 {
// CHECK: spv.VectorExtractDynamic %{{.*}}[%{{.*}}] : vector<4xf32>, i32
%0 = spv.VectorExtractDynamic %vec[%id] : vector<4xf32>, i32
return %0 : f32
@ -278,7 +278,7 @@ func @vector_dynamic_extract(%vec: vector<4xf32>, %id : i32) -> f32 {
// spv.VectorInsertDynamic
//===----------------------------------------------------------------------===//
func @vector_dynamic_insert(%val: f32, %vec: vector<4xf32>, %id : i32) -> vector<4xf32> {
func.func @vector_dynamic_insert(%val: f32, %vec: vector<4xf32>, %id : i32) -> vector<4xf32> {
// CHECK: spv.VectorInsertDynamic %{{.*}}, %{{.*}}[%{{.*}}] : vector<4xf32>, i32
%0 = spv.VectorInsertDynamic %val, %vec[%id] : vector<4xf32>, i32
return %0 : vector<4xf32>
@ -290,7 +290,7 @@ func @vector_dynamic_insert(%val: f32, %vec: vector<4xf32>, %id : i32) -> vector
// spv.VectorShuffle
//===----------------------------------------------------------------------===//
func @vector_shuffle(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
func.func @vector_shuffle(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
// CHECK: %{{.+}} = spv.VectorShuffle [1 : i32, 3 : i32, -1 : i32] %{{.+}} : vector<4xf32>, %arg1 : vector<2xf32> -> vector<3xf32>
%0 = spv.VectorShuffle [1: i32, 3: i32, 0xffffffff: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32>
return %0: vector<3xf32>
@ -298,7 +298,7 @@ func @vector_shuffle(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector
// -----
func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
func.func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
// expected-error @+1 {{result type element count (3) mismatch with the number of component selectors (4)}}
%0 = spv.VectorShuffle [1: i32, 3: i32, 5: i32, 2: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32>
return %0: vector<3xf32>
@ -306,7 +306,7 @@ func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2x
// -----
func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
func.func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> {
// expected-error @+1 {{component selector 7 out of range: expected to be in [0, 6) or 0xffffffff}}
%0 = spv.VectorShuffle [1: i32, 7: i32, 5: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32>
return %0: vector<3xf32>

View File

@ -4,7 +4,7 @@
// spv.Branch
//===----------------------------------------------------------------------===//
func @branch() -> () {
func.func @branch() -> () {
// CHECK: spv.Branch ^bb1
spv.Branch ^next
^next:
@ -13,7 +13,7 @@ func @branch() -> () {
// -----
func @branch_argument() -> () {
func.func @branch_argument() -> () {
%zero = spv.Constant 0 : i32
// CHECK: spv.Branch ^bb1(%{{.*}}, %{{.*}} : i32, i32)
spv.Branch ^next(%zero, %zero: i32, i32)
@ -23,14 +23,14 @@ func @branch_argument() -> () {
// -----
func @missing_accessor() -> () {
func.func @missing_accessor() -> () {
// expected-error @+2 {{expected block name}}
spv.Branch
}
// -----
func @wrong_accessor_count() -> () {
func.func @wrong_accessor_count() -> () {
%true = spv.Constant true
// expected-error @+1 {{requires 1 successor but found 2}}
"spv.Branch"()[^one, ^two] : () -> ()
@ -46,7 +46,7 @@ func @wrong_accessor_count() -> () {
// spv.BranchConditional
//===----------------------------------------------------------------------===//
func @cond_branch() -> () {
func.func @cond_branch() -> () {
%true = spv.Constant true
// CHECK: spv.BranchConditional %{{.*}}, ^bb1, ^bb2
spv.BranchConditional %true, ^one, ^two
@ -60,7 +60,7 @@ func @cond_branch() -> () {
// -----
func @cond_branch_argument() -> () {
func.func @cond_branch_argument() -> () {
%true = spv.Constant true
%zero = spv.Constant 0 : i32
// CHECK: spv.BranchConditional %{{.*}}, ^bb1(%{{.*}}, %{{.*}} : i32, i32), ^bb2
@ -78,7 +78,7 @@ func @cond_branch_argument() -> () {
// -----
func @cond_branch_with_weights() -> () {
func.func @cond_branch_with_weights() -> () {
%true = spv.Constant true
// CHECK: spv.BranchConditional %{{.*}} [5, 10]
spv.BranchConditional %true [5, 10], ^one, ^two
@ -90,7 +90,7 @@ func @cond_branch_with_weights() -> () {
// -----
func @missing_condition() -> () {
func.func @missing_condition() -> () {
// expected-error @+1 {{expected SSA operand}}
spv.BranchConditional ^one, ^two
^one:
@ -101,7 +101,7 @@ func @missing_condition() -> () {
// -----
func @wrong_condition_type() -> () {
func.func @wrong_condition_type() -> () {
// expected-note @+1 {{prior use here}}
%zero = spv.Constant 0 : i32
// expected-error @+1 {{use of value '%zero' expects different type than prior uses: 'i1' vs 'i32'}}
@ -114,7 +114,7 @@ func @wrong_condition_type() -> () {
// -----
func @wrong_accessor_count() -> () {
func.func @wrong_accessor_count() -> () {
%true = spv.Constant true
// expected-error @+1 {{requires 2 successors but found 1}}
"spv.BranchConditional"(%true)[^one] {operand_segment_sizes = dense<[1, 0, 0]>: vector<3xi32>} : (i1) -> ()
@ -126,7 +126,7 @@ func @wrong_accessor_count() -> () {
// -----
func @wrong_number_of_weights() -> () {
func.func @wrong_number_of_weights() -> () {
%true = spv.Constant true
// expected-error @+1 {{must have exactly two branch weights}}
"spv.BranchConditional"(%true)[^one, ^two] {branch_weights = [1 : i32, 2 : i32, 3 : i32],
@ -139,7 +139,7 @@ func @wrong_number_of_weights() -> () {
// -----
func @weights_cannot_both_be_zero() -> () {
func.func @weights_cannot_both_be_zero() -> () {
%true = spv.Constant true
// expected-error @+1 {{branch weights cannot both be zero}}
spv.BranchConditional %true [0, 0], ^one, ^two
@ -192,7 +192,7 @@ spv.func @callee() "None" {
spv.Return
}
func @caller() {
func.func @caller() {
// CHECK: spv.FunctionCall
spv.FunctionCall @callee() : () -> ()
spv.Return
@ -267,7 +267,7 @@ spv.module Logical GLSL450 {
//===----------------------------------------------------------------------===//
// for (int i = 0; i < count; ++i) {}
func @loop(%count : i32) -> () {
func.func @loop(%count : i32) -> () {
%zero = spv.Constant 0: i32
%one = spv.Constant 1: i32
%var = spv.Variable init(%zero) : !spv.ptr<i32, Function>
@ -308,7 +308,7 @@ func @loop(%count : i32) -> () {
// -----
// CHECK-LABEL: @empty_region
func @empty_region() -> () {
func.func @empty_region() -> () {
// CHECK: spv.mlir.loop
spv.mlir.loop {
}
@ -318,7 +318,7 @@ func @empty_region() -> () {
// -----
// CHECK-LABEL: @loop_with_control
func @loop_with_control() -> () {
func.func @loop_with_control() -> () {
// CHECK: spv.mlir.loop control(Unroll)
spv.mlir.loop control(Unroll) {
}
@ -327,7 +327,7 @@ func @loop_with_control() -> () {
// -----
func @wrong_merge_block() -> () {
func.func @wrong_merge_block() -> () {
// expected-error @+1 {{last block must be the merge block with only one 'spv.mlir.merge' op}}
spv.mlir.loop {
spv.Return
@ -337,7 +337,7 @@ func @wrong_merge_block() -> () {
// -----
func @missing_entry_block() -> () {
func.func @missing_entry_block() -> () {
// expected-error @+1 {{must have an entry block branching to the loop header block}}
spv.mlir.loop {
spv.mlir.merge
@ -347,7 +347,7 @@ func @missing_entry_block() -> () {
// -----
func @missing_header_block() -> () {
func.func @missing_header_block() -> () {
// expected-error @+1 {{must have a loop header block branched from the entry block}}
spv.mlir.loop {
^entry:
@ -360,7 +360,7 @@ func @missing_header_block() -> () {
// -----
func @entry_should_branch_to_header() -> () {
func.func @entry_should_branch_to_header() -> () {
// expected-error @+1 {{entry block must only have one 'spv.Branch' op to the second block}}
spv.mlir.loop {
^entry:
@ -375,7 +375,7 @@ func @entry_should_branch_to_header() -> () {
// -----
func @missing_continue_block() -> () {
func.func @missing_continue_block() -> () {
// expected-error @+1 {{requires a loop continue block branching to the loop header block}}
spv.mlir.loop {
^entry:
@ -390,7 +390,7 @@ func @missing_continue_block() -> () {
// -----
func @continue_should_branch_to_header() -> () {
func.func @continue_should_branch_to_header() -> () {
// expected-error @+1 {{second to last block must be the loop continue block that branches to the loop header block}}
spv.mlir.loop {
^entry:
@ -407,7 +407,7 @@ func @continue_should_branch_to_header() -> () {
// -----
func @only_entry_and_continue_branch_to_header() -> () {
func.func @only_entry_and_continue_branch_to_header() -> () {
// expected-error @+1 {{can only have the entry and loop continue block branching to the loop header block}}
spv.mlir.loop {
^entry:
@ -430,14 +430,14 @@ func @only_entry_and_continue_branch_to_header() -> () {
// spv.mlir.merge
//===----------------------------------------------------------------------===//
func @merge() -> () {
func.func @merge() -> () {
// expected-error @+1 {{expected parent op to be 'spv.mlir.selection' or 'spv.mlir.loop'}}
spv.mlir.merge
}
// -----
func @only_allowed_in_last_block(%cond : i1) -> () {
func.func @only_allowed_in_last_block(%cond : i1) -> () {
%zero = spv.Constant 0: i32
%one = spv.Constant 1: i32
%var = spv.Variable init(%zero) : !spv.ptr<i32, Function>
@ -459,7 +459,7 @@ func @only_allowed_in_last_block(%cond : i1) -> () {
// -----
func @only_allowed_in_last_block() -> () {
func.func @only_allowed_in_last_block() -> () {
%true = spv.Constant true
spv.mlir.loop {
spv.Branch ^header
@ -483,7 +483,7 @@ func @only_allowed_in_last_block() -> () {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: func @in_selection
func @in_selection(%cond : i1) -> () {
func.func @in_selection(%cond : i1) -> () {
spv.mlir.selection {
spv.BranchConditional %cond, ^then, ^merge
^then:
@ -496,7 +496,7 @@ func @in_selection(%cond : i1) -> () {
}
// CHECK-LABEL: func @in_loop
func @in_loop(%cond : i1) -> () {
func.func @in_loop(%cond : i1) -> () {
spv.mlir.loop {
spv.Branch ^header
^header:
@ -513,7 +513,7 @@ func @in_loop(%cond : i1) -> () {
}
// CHECK-LABEL: in_other_func_like_op
func @in_other_func_like_op() {
func.func @in_other_func_like_op() {
// CHECK: spv.Return
spv.Return
}
@ -559,14 +559,14 @@ spv.module Logical GLSL450 {
// spv.ReturnValue
//===----------------------------------------------------------------------===//
func @ret_val() -> (i32) {
func.func @ret_val() -> (i32) {
%0 = spv.Constant 42 : i32
// CHECK: spv.ReturnValue %{{.*}} : i32
spv.ReturnValue %0 : i32
}
// CHECK-LABEL: func @in_selection
func @in_selection(%cond : i1) -> (i32) {
func.func @in_selection(%cond : i1) -> (i32) {
spv.mlir.selection {
spv.BranchConditional %cond, ^then, ^merge
^then:
@ -581,7 +581,7 @@ func @in_selection(%cond : i1) -> (i32) {
}
// CHECK-LABEL: func @in_loop
func @in_loop(%cond : i1) -> (i32) {
func.func @in_loop(%cond : i1) -> (i32) {
spv.mlir.loop {
spv.Branch ^header
^header:
@ -600,7 +600,7 @@ func @in_loop(%cond : i1) -> (i32) {
}
// CHECK-LABEL: in_other_func_like_op
func @in_other_func_like_op(%arg: i32) -> i32 {
func.func @in_other_func_like_op(%arg: i32) -> i32 {
// CHECK: spv.ReturnValue
spv.ReturnValue %arg: i32
}
@ -657,7 +657,7 @@ spv.module Logical GLSL450 {
// spv.mlir.selection
//===----------------------------------------------------------------------===//
func @selection(%cond: i1) -> () {
func.func @selection(%cond: i1) -> () {
%zero = spv.Constant 0: i32
%one = spv.Constant 1: i32
%var = spv.Variable init(%zero) : !spv.ptr<i32, Function>
@ -684,7 +684,7 @@ func @selection(%cond: i1) -> () {
// -----
func @selection(%cond: i1) -> () {
func.func @selection(%cond: i1) -> () {
%zero = spv.Constant 0: i32
%one = spv.Constant 1: i32
%two = spv.Constant 2: i32
@ -719,7 +719,7 @@ func @selection(%cond: i1) -> () {
// -----
// CHECK-LABEL: @empty_region
func @empty_region() -> () {
func.func @empty_region() -> () {
// CHECK: spv.mlir.selection
spv.mlir.selection {
}
@ -729,7 +729,7 @@ func @empty_region() -> () {
// -----
// CHECK-LABEL: @selection_with_control
func @selection_with_control() -> () {
func.func @selection_with_control() -> () {
// CHECK: spv.mlir.selection control(Flatten)
spv.mlir.selection control(Flatten) {
}
@ -738,7 +738,7 @@ func @selection_with_control() -> () {
// -----
func @wrong_merge_block() -> () {
func.func @wrong_merge_block() -> () {
// expected-error @+1 {{last block must be the merge block with only one 'spv.mlir.merge' op}}
spv.mlir.selection {
spv.Return
@ -748,7 +748,7 @@ func @wrong_merge_block() -> () {
// -----
func @missing_entry_block() -> () {
func.func @missing_entry_block() -> () {
// expected-error @+1 {{must have a selection header block}}
spv.mlir.selection {
spv.mlir.merge
@ -763,7 +763,7 @@ func @missing_entry_block() -> () {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: func @unreachable_no_pred
func @unreachable_no_pred() {
func.func @unreachable_no_pred() {
spv.Return
^next:
@ -772,7 +772,7 @@ func @unreachable_no_pred() {
}
// CHECK-LABEL: func @unreachable_with_pred
func @unreachable_with_pred() {
func.func @unreachable_with_pred() {
spv.Return
^parent:
@ -785,7 +785,7 @@ func @unreachable_with_pred() {
// -----
func @unreachable() {
func.func @unreachable() {
// expected-error @+1 {{cannot be used in reachable block}}
spv.Unreachable
}

View File

@ -4,13 +4,13 @@
// spv.GLSL.Exp
//===----------------------------------------------------------------------===//
func @exp(%arg0 : f32) -> () {
func.func @exp(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Exp {{%.*}} : f32
%2 = spv.GLSL.Exp %arg0 : f32
return
}
func @expvec(%arg0 : vector<3xf16>) -> () {
func.func @expvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Exp {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Exp %arg0 : vector<3xf16>
return
@ -18,7 +18,7 @@ func @expvec(%arg0 : vector<3xf16>) -> () {
// -----
func @exp(%arg0 : i32) -> () {
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
return
@ -26,7 +26,7 @@ func @exp(%arg0 : i32) -> () {
// -----
func @exp(%arg0 : vector<5xf32>) -> () {
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>
return
@ -34,7 +34,7 @@ func @exp(%arg0 : vector<5xf32>) -> () {
// -----
func @exp(%arg0 : f32, %arg1 : f32) -> () {
func.func @exp(%arg0 : f32, %arg1 : f32) -> () {
// expected-error @+1 {{expected ':'}}
%2 = spv.GLSL.Exp %arg0, %arg1 : i32
return
@ -42,7 +42,7 @@ func @exp(%arg0 : f32, %arg1 : f32) -> () {
// -----
func @exp(%arg0 : i32) -> () {
func.func @exp(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.GLSL.Exp %arg0 :
return
@ -54,7 +54,7 @@ func @exp(%arg0 : i32) -> () {
// spv.GLSL.{F|S|U}{Max|Min}
//===----------------------------------------------------------------------===//
func @fmaxmin(%arg0 : f32, %arg1 : f32) {
func.func @fmaxmin(%arg0 : f32, %arg1 : f32) {
// CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f32
%1 = spv.GLSL.FMax %arg0, %arg1 : f32
// CHECK: spv.GLSL.FMin {{%.*}}, {{%.*}} : f32
@ -62,7 +62,7 @@ func @fmaxmin(%arg0 : f32, %arg1 : f32) {
return
}
func @fmaxminvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) {
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>
@ -70,7 +70,7 @@ func @fmaxminvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) {
return
}
func @fmaxminf64(%arg0 : f64, %arg1 : f64) {
func.func @fmaxminf64(%arg0 : f64, %arg1 : f64) {
// CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f64
%1 = spv.GLSL.FMax %arg0, %arg1 : f64
// CHECK: spv.GLSL.FMin {{%.*}}, {{%.*}} : f64
@ -78,7 +78,7 @@ func @fmaxminf64(%arg0 : f64, %arg1 : f64) {
return
}
func @iminmax(%arg0: i32, %arg1: i32) {
func.func @iminmax(%arg0: i32, %arg1: i32) {
// CHECK: spv.GLSL.SMax {{%.*}}, {{%.*}} : i32
%1 = spv.GLSL.SMax %arg0, %arg1 : i32
// CHECK: spv.GLSL.UMax {{%.*}}, {{%.*}} : i32
@ -96,13 +96,13 @@ func @iminmax(%arg0: i32, %arg1: i32) {
// spv.GLSL.InverseSqrt
//===----------------------------------------------------------------------===//
func @inversesqrt(%arg0 : f32) -> () {
func.func @inversesqrt(%arg0 : f32) -> () {
// CHECK: spv.GLSL.InverseSqrt {{%.*}} : f32
%2 = spv.GLSL.InverseSqrt %arg0 : f32
return
}
func @inversesqrtvec(%arg0 : vector<3xf16>) -> () {
func.func @inversesqrtvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.InverseSqrt {{%.*}} : vector<3xf16>
%2 = spv.GLSL.InverseSqrt %arg0 : vector<3xf16>
return
@ -114,13 +114,13 @@ func @inversesqrtvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Sqrt
//===----------------------------------------------------------------------===//
func @sqrt(%arg0 : f32) -> () {
func.func @sqrt(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Sqrt {{%.*}} : f32
%2 = spv.GLSL.Sqrt %arg0 : f32
return
}
func @sqrtvec(%arg0 : vector<3xf16>) -> () {
func.func @sqrtvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Sqrt {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Sqrt %arg0 : vector<3xf16>
return
@ -130,13 +130,13 @@ func @sqrtvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Cos
//===----------------------------------------------------------------------===//
func @cos(%arg0 : f32) -> () {
func.func @cos(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Cos {{%.*}} : f32
%2 = spv.GLSL.Cos %arg0 : f32
return
}
func @cosvec(%arg0 : vector<3xf16>) -> () {
func.func @cosvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Cos {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Cos %arg0 : vector<3xf16>
return
@ -146,13 +146,13 @@ func @cosvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Sin
//===----------------------------------------------------------------------===//
func @sin(%arg0 : f32) -> () {
func.func @sin(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Sin {{%.*}} : f32
%2 = spv.GLSL.Sin %arg0 : f32
return
}
func @sinvec(%arg0 : vector<3xf16>) -> () {
func.func @sinvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Sin {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Sin %arg0 : vector<3xf16>
return
@ -162,13 +162,13 @@ func @sinvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Tan
//===----------------------------------------------------------------------===//
func @tan(%arg0 : f32) -> () {
func.func @tan(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Tan {{%.*}} : f32
%2 = spv.GLSL.Tan %arg0 : f32
return
}
func @tanvec(%arg0 : vector<3xf16>) -> () {
func.func @tanvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Tan {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Tan %arg0 : vector<3xf16>
return
@ -178,13 +178,13 @@ func @tanvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Acos
//===----------------------------------------------------------------------===//
func @acos(%arg0 : f32) -> () {
func.func @acos(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Acos {{%.*}} : f32
%2 = spv.GLSL.Acos %arg0 : f32
return
}
func @acosvec(%arg0 : vector<3xf16>) -> () {
func.func @acosvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Acos {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Acos %arg0 : vector<3xf16>
return
@ -194,13 +194,13 @@ func @acosvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Asin
//===----------------------------------------------------------------------===//
func @asin(%arg0 : f32) -> () {
func.func @asin(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Asin {{%.*}} : f32
%2 = spv.GLSL.Asin %arg0 : f32
return
}
func @asinvec(%arg0 : vector<3xf16>) -> () {
func.func @asinvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Asin {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Asin %arg0 : vector<3xf16>
return
@ -210,13 +210,13 @@ func @asinvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Atan
//===----------------------------------------------------------------------===//
func @atan(%arg0 : f32) -> () {
func.func @atan(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Atan {{%.*}} : f32
%2 = spv.GLSL.Atan %arg0 : f32
return
}
func @atanvec(%arg0 : vector<3xf16>) -> () {
func.func @atanvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Atan {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Atan %arg0 : vector<3xf16>
return
@ -226,13 +226,13 @@ func @atanvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Sinh
//===----------------------------------------------------------------------===//
func @sinh(%arg0 : f32) -> () {
func.func @sinh(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Sinh {{%.*}} : f32
%2 = spv.GLSL.Sinh %arg0 : f32
return
}
func @sinhvec(%arg0 : vector<3xf16>) -> () {
func.func @sinhvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Sinh {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Sinh %arg0 : vector<3xf16>
return
@ -242,13 +242,13 @@ func @sinhvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Cosh
//===----------------------------------------------------------------------===//
func @cosh(%arg0 : f32) -> () {
func.func @cosh(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Cosh {{%.*}} : f32
%2 = spv.GLSL.Cosh %arg0 : f32
return
}
func @coshvec(%arg0 : vector<3xf16>) -> () {
func.func @coshvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Cosh {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Cosh %arg0 : vector<3xf16>
return
@ -258,13 +258,13 @@ func @coshvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.Pow
//===----------------------------------------------------------------------===//
func @pow(%arg0 : f32, %arg1 : f32) -> () {
func.func @pow(%arg0 : f32, %arg1 : f32) -> () {
// CHECK: spv.GLSL.Pow {{%.*}}, {{%.*}} : f32
%2 = spv.GLSL.Pow %arg0, %arg1 : f32
return
}
func @powvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () {
func.func @powvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Pow {{%.*}}, {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Pow %arg0, %arg1 : vector<3xf16>
return
@ -276,13 +276,13 @@ func @powvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () {
// spv.GLSL.Round
//===----------------------------------------------------------------------===//
func @round(%arg0 : f32) -> () {
func.func @round(%arg0 : f32) -> () {
// CHECK: spv.GLSL.Round {{%.*}} : f32
%2 = spv.GLSL.Round %arg0 : f32
return
}
func @roundvec(%arg0 : vector<3xf16>) -> () {
func.func @roundvec(%arg0 : vector<3xf16>) -> () {
// CHECK: spv.GLSL.Round {{%.*}} : vector<3xf16>
%2 = spv.GLSL.Round %arg0 : vector<3xf16>
return
@ -294,7 +294,7 @@ func @roundvec(%arg0 : vector<3xf16>) -> () {
// spv.GLSL.FClamp
//===----------------------------------------------------------------------===//
func @fclamp(%arg0 : f32, %min : f32, %max : f32) -> () {
func.func @fclamp(%arg0 : f32, %min : f32, %max : f32) -> () {
// CHECK: spv.GLSL.FClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
%2 = spv.GLSL.FClamp %arg0, %min, %max : f32
return
@ -302,7 +302,7 @@ func @fclamp(%arg0 : f32, %min : f32, %max : f32) -> () {
// -----
func @fclamp(%arg0 : vector<3xf32>, %min : vector<3xf32>, %max : vector<3xf32>) -> () {
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>
return
@ -314,7 +314,7 @@ func @fclamp(%arg0 : vector<3xf32>, %min : vector<3xf32>, %max : vector<3xf32>)
// spv.GLSL.UClamp
//===----------------------------------------------------------------------===//
func @uclamp(%arg0 : ui32, %min : ui32, %max : ui32) -> () {
func.func @uclamp(%arg0 : ui32, %min : ui32, %max : ui32) -> () {
// CHECK: spv.GLSL.UClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : ui32
%2 = spv.GLSL.UClamp %arg0, %min, %max : ui32
return
@ -322,7 +322,7 @@ func @uclamp(%arg0 : ui32, %min : ui32, %max : ui32) -> () {
// -----
func @uclamp(%arg0 : vector<4xi32>, %min : vector<4xi32>, %max : vector<4xi32>) -> () {
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>
return
@ -330,7 +330,7 @@ func @uclamp(%arg0 : vector<4xi32>, %min : vector<4xi32>, %max : vector<4xi32>)
// -----
func @uclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
func.func @uclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
// CHECK: spv.GLSL.UClamp
%2 = spv.GLSL.UClamp %arg0, %min, %max : si32
return
@ -342,7 +342,7 @@ func @uclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
// spv.GLSL.SClamp
//===----------------------------------------------------------------------===//
func @sclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
func.func @sclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
// CHECK: spv.GLSL.SClamp {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : si32
%2 = spv.GLSL.SClamp %arg0, %min, %max : si32
return
@ -350,7 +350,7 @@ func @sclamp(%arg0 : si32, %min : si32, %max : si32) -> () {
// -----
func @sclamp(%arg0 : vector<4xsi32>, %min : vector<4xsi32>, %max : vector<4xsi32>) -> () {
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>
return
@ -358,7 +358,7 @@ func @sclamp(%arg0 : vector<4xsi32>, %min : vector<4xsi32>, %max : vector<4xsi32
// -----
func @sclamp(%arg0 : i32, %min : i32, %max : i32) -> () {
func.func @sclamp(%arg0 : i32, %min : i32, %max : i32) -> () {
// CHECK: spv.GLSL.SClamp
%2 = spv.GLSL.SClamp %arg0, %min, %max : i32
return
@ -370,7 +370,7 @@ func @sclamp(%arg0 : i32, %min : i32, %max : i32) -> () {
// spv.GLSL.Fma
//===----------------------------------------------------------------------===//
func @fma(%a : f32, %b : f32, %c : f32) -> () {
func.func @fma(%a : f32, %b : f32, %c : f32) -> () {
// CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
%2 = spv.GLSL.Fma %a, %b, %c : f32
return
@ -378,7 +378,7 @@ func @fma(%a : f32, %b : f32, %c : f32) -> () {
// -----
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.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32>
%2 = spv.GLSL.Fma %a, %b, %c : vector<3xf32>
return
@ -389,19 +389,19 @@ func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () {
// spv.GLSL.FrexpStruct
//===----------------------------------------------------------------------===//
func @frexp_struct(%arg0 : f32) -> () {
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)>
return
}
func @frexp_struct_64(%arg0 : f64) -> () {
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)>
return
}
func @frexp_struct_vec(%arg0 : vector<3xf32>) -> () {
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>)>
return
@ -409,7 +409,7 @@ func @frexp_struct_vec(%arg0 : vector<3xf32>) -> () {
// -----
func @frexp_struct_mismatch_type(%arg0 : f32) -> () {
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)>
return
@ -417,7 +417,7 @@ func @frexp_struct_mismatch_type(%arg0 : f32) -> () {
// -----
func @frexp_struct_wrong_type(%arg0 : i32) -> () {
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)>
return
@ -425,7 +425,7 @@ func @frexp_struct_wrong_type(%arg0 : i32) -> () {
// -----
func @frexp_struct_mismatch_num_components(%arg0 : vector<3xf32>) -> () {
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>)>
return
@ -433,7 +433,7 @@ func @frexp_struct_mismatch_num_components(%arg0 : vector<3xf32>) -> () {
// -----
func @frexp_struct_not_i32(%arg0 : f32) -> () {
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)>
return
@ -445,14 +445,14 @@ func @frexp_struct_not_i32(%arg0 : f32) -> () {
// spv.GLSL.Ldexp
//===----------------------------------------------------------------------===//
func @ldexp(%arg0 : f32, %arg1 : i32) -> () {
func.func @ldexp(%arg0 : f32, %arg1 : i32) -> () {
// CHECK: {{%.*}} = spv.GLSL.Ldexp {{%.*}} : f32, {{%.*}} : i32 -> f32
%0 = spv.GLSL.Ldexp %arg0 : f32, %arg1 : i32 -> f32
return
}
// -----
func @ldexp_vec(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) -> () {
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>
return
@ -460,7 +460,7 @@ func @ldexp_vec(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) -> () {
// -----
func @ldexp_wrong_type_scalar(%arg0 : f32, %arg1 : vector<2xi32>) -> () {
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
return
@ -468,7 +468,7 @@ func @ldexp_wrong_type_scalar(%arg0 : f32, %arg1 : vector<2xi32>) -> () {
// -----
func @ldexp_wrong_type_vec_1(%arg0 : vector<3xf32>, %arg1 : i32) -> () {
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>
return
@ -476,7 +476,7 @@ func @ldexp_wrong_type_vec_1(%arg0 : vector<3xf32>, %arg1 : i32) -> () {
// -----
func @ldexp_wrong_type_vec_2(%arg0 : vector<3xf32>, %arg1 : vector<2xi32>) -> () {
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>
return
@ -488,14 +488,14 @@ func @ldexp_wrong_type_vec_2(%arg0 : vector<3xf32>, %arg1 : vector<2xi32>) -> ()
// spv.GLSL.FMix
//===----------------------------------------------------------------------===//
func @fmix(%arg0 : f32, %arg1 : f32, %arg2 : f32) -> () {
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
return
}
// -----
func @fmix_vector(%arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32>) -> () {
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>
return

View File

@ -4,7 +4,7 @@
// spv.SubgroupBallotKHR
//===----------------------------------------------------------------------===//
func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
// CHECK: %{{.*}} = spv.SubgroupBallotKHR %{{.*}} : vector<4xi32>
%0 = spv.SubgroupBallotKHR %predicate: vector<4xi32>
return %0: vector<4xi32>
@ -16,7 +16,7 @@ func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
// spv.GroupBroadcast
//===----------------------------------------------------------------------===//
func @group_broadcast_scalar(%value: f32, %localid: i32 ) -> f32 {
func.func @group_broadcast_scalar(%value: f32, %localid: i32 ) -> f32 {
// CHECK: spv.GroupBroadcast Workgroup %{{.*}}, %{{.*}} : f32, i32
%0 = spv.GroupBroadcast Workgroup %value, %localid : f32, i32
return %0: f32
@ -24,7 +24,7 @@ func @group_broadcast_scalar(%value: f32, %localid: i32 ) -> f32 {
// -----
func @group_broadcast_scalar_vector(%value: f32, %localid: vector<3xi32> ) -> f32 {
func.func @group_broadcast_scalar_vector(%value: f32, %localid: vector<3xi32> ) -> f32 {
// CHECK: spv.GroupBroadcast Workgroup %{{.*}}, %{{.*}} : f32, vector<3xi32>
%0 = spv.GroupBroadcast Workgroup %value, %localid : f32, vector<3xi32>
return %0: f32
@ -32,7 +32,7 @@ func @group_broadcast_scalar_vector(%value: f32, %localid: vector<3xi32> ) -> f3
// -----
func @group_broadcast_vector(%value: vector<4xf32>, %localid: vector<3xi32> ) -> vector<4xf32> {
func.func @group_broadcast_vector(%value: vector<4xf32>, %localid: vector<3xi32> ) -> vector<4xf32> {
// CHECK: spv.GroupBroadcast Subgroup %{{.*}}, %{{.*}} : vector<4xf32>, vector<3xi32>
%0 = spv.GroupBroadcast Subgroup %value, %localid : vector<4xf32>, vector<3xi32>
return %0: vector<4xf32>
@ -40,7 +40,7 @@ func @group_broadcast_vector(%value: vector<4xf32>, %localid: vector<3xi32> ) ->
// -----
func @group_broadcast_negative_scope(%value: f32, %localid: vector<3xi32> ) -> f32 {
func.func @group_broadcast_negative_scope(%value: f32, %localid: vector<3xi32> ) -> f32 {
// expected-error @+1 {{execution scope must be 'Workgroup' or 'Subgroup'}}
%0 = spv.GroupBroadcast Device %value, %localid : f32, vector<3xi32>
return %0: f32
@ -48,7 +48,7 @@ func @group_broadcast_negative_scope(%value: f32, %localid: vector<3xi32> ) -> f
// -----
func @group_broadcast_negative_locid_dtype(%value: f32, %localid: vector<3xf32> ) -> f32 {
func.func @group_broadcast_negative_locid_dtype(%value: f32, %localid: vector<3xf32> ) -> f32 {
// expected-error @+1 {{operand #1 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values}}
%0 = spv.GroupBroadcast Subgroup %value, %localid : f32, vector<3xf32>
return %0: f32
@ -56,7 +56,7 @@ func @group_broadcast_negative_locid_dtype(%value: f32, %localid: vector<3xf32>
// -----
func @group_broadcast_negative_locid_vec4(%value: f32, %localid: vector<4xi32> ) -> f32 {
func.func @group_broadcast_negative_locid_vec4(%value: f32, %localid: vector<4xi32> ) -> f32 {
// expected-error @+1 {{localid is a vector and can be with only 2 or 3 components, actual number is 4}}
%0 = spv.GroupBroadcast Subgroup %value, %localid : f32, vector<4xi32>
return %0: f32
@ -68,7 +68,7 @@ func @group_broadcast_negative_locid_vec4(%value: f32, %localid: vector<4xi32> )
// spv.SubgroupBallotKHR
//===----------------------------------------------------------------------===//
func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
%0 = spv.SubgroupBallotKHR %predicate: vector<4xi32>
return %0: vector<4xi32>
}
@ -79,7 +79,7 @@ func @subgroup_ballot(%predicate: i1) -> vector<4xi32> {
// spv.SubgroupBlockReadINTEL
//===----------------------------------------------------------------------===//
func @subgroup_block_read_intel(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
func.func @subgroup_block_read_intel(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// CHECK: spv.SubgroupBlockReadINTEL %{{.*}} : i32
%0 = spv.SubgroupBlockReadINTEL "StorageBuffer" %ptr : i32
return %0: i32
@ -87,7 +87,7 @@ func @subgroup_block_read_intel(%ptr : !spv.ptr<i32, StorageBuffer>) -> i32 {
// -----
func @subgroup_block_read_intel_vector(%ptr : !spv.ptr<i32, StorageBuffer>) -> vector<3xi32> {
func.func @subgroup_block_read_intel_vector(%ptr : !spv.ptr<i32, StorageBuffer>) -> vector<3xi32> {
// CHECK: spv.SubgroupBlockReadINTEL %{{.*}} : vector<3xi32>
%0 = spv.SubgroupBlockReadINTEL "StorageBuffer" %ptr : vector<3xi32>
return %0: vector<3xi32>
@ -99,7 +99,7 @@ func @subgroup_block_read_intel_vector(%ptr : !spv.ptr<i32, StorageBuffer>) -> v
// spv.SubgroupBlockWriteINTEL
//===----------------------------------------------------------------------===//
func @subgroup_block_write_intel(%ptr : !spv.ptr<i32, StorageBuffer>, %value: i32) -> () {
func.func @subgroup_block_write_intel(%ptr : !spv.ptr<i32, StorageBuffer>, %value: i32) -> () {
// CHECK: spv.SubgroupBlockWriteINTEL %{{.*}}, %{{.*}} : i32
spv.SubgroupBlockWriteINTEL "StorageBuffer" %ptr, %value : i32
return
@ -107,7 +107,7 @@ func @subgroup_block_write_intel(%ptr : !spv.ptr<i32, StorageBuffer>, %value: i3
// -----
func @subgroup_block_write_intel_vector(%ptr : !spv.ptr<i32, StorageBuffer>, %value: vector<3xi32>) -> () {
func.func @subgroup_block_write_intel_vector(%ptr : !spv.ptr<i32, StorageBuffer>, %value: vector<3xi32>) -> () {
// CHECK: spv.SubgroupBlockWriteINTEL %{{.*}}, %{{.*}} : vector<3xi32>
spv.SubgroupBlockWriteINTEL "StorageBuffer" %ptr, %value : vector<3xi32>
return

View File

@ -4,7 +4,7 @@
// spv.ImageDrefGather
//===----------------------------------------------------------------------===//
func @image_dref_gather(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// CHECK: spv.ImageDrefGather {{.*}} : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, {{.*}} : vector<4xf32>, {{.*}} : f32 -> vector<4xi32>
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32>
spv.Return
@ -12,7 +12,7 @@ func @image_dref_gather(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDept
// -----
func @image_dref_gather_with_single_imageoperands(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_with_single_imageoperands(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// CHECK: spv.ImageDrefGather {{.*}} ["NonPrivateTexel"] -> vector<4xi32>
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 ["NonPrivateTexel"] -> vector<4xi32>
spv.Return
@ -20,7 +20,7 @@ func @image_dref_gather_with_single_imageoperands(%arg0 : !spv.sampled_image<!sp
// -----
func @image_dref_gather_with_mismatch_imageoperands(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_with_mismatch_imageoperands(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// expected-error @+1 {{the Image Operands should encode what operands follow, as per Image Operands}}
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 (%arg2, %arg2 : f32, f32) -> vector<4xi32>
spv.Return
@ -28,7 +28,7 @@ func @image_dref_gather_with_mismatch_imageoperands(%arg0 : !spv.sampled_image<!
// -----
func @image_dref_gather_error_result_type(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_error_result_type(%arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// expected-error @+1 {{result type must be a vector of four components}}
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<3xi32>
spv.Return
@ -36,7 +36,7 @@ func @image_dref_gather_error_result_type(%arg0 : !spv.sampled_image<!spv.image<
// -----
func @image_dref_gather_error_same_type(%arg0 : !spv.sampled_image<!spv.image<i32, Rect, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_error_same_type(%arg0 : !spv.sampled_image<!spv.image<i32, Rect, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// expected-error @+1 {{the component type of result must be the same as sampled type of the underlying image type}}
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Rect, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xf32>
spv.Return
@ -44,7 +44,7 @@ func @image_dref_gather_error_same_type(%arg0 : !spv.sampled_image<!spv.image<i3
// -----
func @image_dref_gather_error_dim(%arg0 : !spv.sampled_image<!spv.image<i32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_error_dim(%arg0 : !spv.sampled_image<!spv.image<i32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// expected-error @+1 {{the Dim operand of the underlying image type must be 2D, Cube, or Rect}}
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32>
spv.Return
@ -52,7 +52,7 @@ func @image_dref_gather_error_dim(%arg0 : !spv.sampled_image<!spv.image<i32, Dim
// -----
func @image_dref_gather_error_ms(%arg0 : !spv.sampled_image<!spv.image<i32, Cube, NoDepth, NonArrayed, MultiSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
func.func @image_dref_gather_error_ms(%arg0 : !spv.sampled_image<!spv.image<i32, Cube, NoDepth, NonArrayed, MultiSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32) -> () {
// expected-error @+1 {{the MS operand of the underlying image type must be 0}}
%0 = spv.ImageDrefGather %arg0 : !spv.sampled_image<!spv.image<i32, Cube, NoDepth, NonArrayed, MultiSampled, NoSampler, Unknown>>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32>
spv.Return
@ -64,7 +64,7 @@ func @image_dref_gather_error_ms(%arg0 : !spv.sampled_image<!spv.image<i32, Cube
// spv.Image
//===----------------------------------------------------------------------===//
func @image(%arg0 : !spv.sampled_image<!spv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>) -> () {
func.func @image(%arg0 : !spv.sampled_image<!spv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>) -> () {
// CHECK: spv.Image {{.*}} : !spv.sampled_image<!spv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>
%0 = spv.Image %arg0 : !spv.sampled_image<!spv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>
return
@ -76,7 +76,7 @@ func @image(%arg0 : !spv.sampled_image<!spv.image<f32, Dim2D, NoDepth, NonArraye
// spv.ImageQuerySize
//===----------------------------------------------------------------------===//
func @image_query_size(%arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
func.func @image_query_size(%arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
// CHECK: {{%.*}} = spv.ImageQuerySize %arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown> -> i32
%0 = spv.ImageQuerySize %arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown> -> i32
spv.Return
@ -84,7 +84,7 @@ func @image_query_size(%arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, Singl
// -----
func @image_query_size_error_dim(%arg0 : !spv.image<f32, SubpassData, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
func.func @image_query_size_error_dim(%arg0 : !spv.image<f32, SubpassData, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
// expected-error @+1 {{the Dim operand of the image type must be 1D, 2D, 3D, Buffer, Cube, or Rect}}
%0 = spv.ImageQuerySize %arg0 : !spv.image<f32, SubpassData, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown> -> i32
spv.Return
@ -92,7 +92,7 @@ func @image_query_size_error_dim(%arg0 : !spv.image<f32, SubpassData, NoDepth, N
// -----
func @image_query_size_error_dim_sample(%arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>) -> () {
func.func @image_query_size_error_dim_sample(%arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>) -> () {
// expected-error @+1 {{if Dim is 1D, 2D, 3D, or Cube, it must also have either an MS of 1 or a Sampled of 0 or 2}}
%0 = spv.ImageQuerySize %arg0 : !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown> -> i32
spv.Return
@ -100,7 +100,7 @@ func @image_query_size_error_dim_sample(%arg0 : !spv.image<f32, Dim1D, NoDepth,
// -----
func @image_query_size_error_result1(%arg0 : !spv.image<f32, Dim3D, NoDepth, Arrayed, SingleSampled, NoSampler, Unknown>) -> () {
func.func @image_query_size_error_result1(%arg0 : !spv.image<f32, Dim3D, NoDepth, Arrayed, SingleSampled, NoSampler, Unknown>) -> () {
// expected-error @+1 {{expected the result to have 4 component(s), but found 3 component(s)}}
%0 = spv.ImageQuerySize %arg0 : !spv.image<f32, Dim3D, NoDepth, Arrayed, SingleSampled, NoSampler, Unknown> -> vector<3xi32>
spv.Return
@ -108,7 +108,7 @@ func @image_query_size_error_result1(%arg0 : !spv.image<f32, Dim3D, NoDepth, Arr
// -----
func @image_query_size_error_result2(%arg0 : !spv.image<f32, Buffer, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
func.func @image_query_size_error_result2(%arg0 : !spv.image<f32, Buffer, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>) -> () {
// expected-error @+1 {{expected the result to have 1 component(s), but found 2 component(s)}}
%0 = spv.ImageQuerySize %arg0 : !spv.image<f32, Buffer, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown> -> vector<2xi32>
spv.Return

View File

@ -4,7 +4,7 @@
// spv.IEqual
//===----------------------------------------------------------------------===//
func @iequal_scalar(%arg0: i32, %arg1: i32) -> i1 {
func.func @iequal_scalar(%arg0: i32, %arg1: i32) -> i1 {
// CHECK: spv.IEqual {{.*}}, {{.*}} : i32
%0 = spv.IEqual %arg0, %arg1 : i32
return %0 : i1
@ -12,7 +12,7 @@ func @iequal_scalar(%arg0: i32, %arg1: i32) -> i1 {
// -----
func @iequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @iequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.IEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.IEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -24,7 +24,7 @@ func @iequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1>
// spv.INotEqual
//===----------------------------------------------------------------------===//
func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.INotEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.INotEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -36,13 +36,13 @@ func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi
// spv.IsInf
//===----------------------------------------------------------------------===//
func @isinf_scalar(%arg0: f32) -> i1 {
func.func @isinf_scalar(%arg0: f32) -> i1 {
// CHECK: spv.IsInf {{.*}} : f32
%0 = spv.IsInf %arg0 : f32
return %0 : i1
}
func @isinf_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
func.func @isinf_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
// CHECK: spv.IsInf {{.*}} : vector<2xf32>
%0 = spv.IsInf %arg0 : vector<2xf32>
return %0 : vector<2xi1>
@ -54,13 +54,13 @@ func @isinf_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
// spv.IsNan
//===----------------------------------------------------------------------===//
func @isnan_scalar(%arg0: f32) -> i1 {
func.func @isnan_scalar(%arg0: f32) -> i1 {
// CHECK: spv.IsNan {{.*}} : f32
%0 = spv.IsNan %arg0 : f32
return %0 : i1
}
func @isnan_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
func.func @isnan_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
// CHECK: spv.IsNan {{.*}} : vector<2xf32>
%0 = spv.IsNan %arg0 : vector<2xf32>
return %0 : vector<2xi1>
@ -70,7 +70,7 @@ func @isnan_vector(%arg0: vector<2xf32>) -> vector<2xi1> {
// spv.LogicalAnd
//===----------------------------------------------------------------------===//
func @logicalBinary(%arg0 : i1, %arg1 : i1, %arg2 : i1)
func.func @logicalBinary(%arg0 : i1, %arg1 : i1, %arg2 : i1)
{
// CHECK: [[TMP:%.*]] = spv.LogicalAnd {{%.*}}, {{%.*}} : i1
%0 = spv.LogicalAnd %arg0, %arg1 : i1
@ -79,7 +79,7 @@ func @logicalBinary(%arg0 : i1, %arg1 : i1, %arg2 : i1)
return
}
func @logicalBinary2(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>)
func.func @logicalBinary2(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>)
{
// CHECK: {{%.*}} = spv.LogicalAnd {{%.*}}, {{%.*}} : vector<4xi1>
%0 = spv.LogicalAnd %arg0, %arg1 : vector<4xi1>
@ -88,7 +88,7 @@ func @logicalBinary2(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>)
// -----
func @logicalBinary(%arg0 : i1, %arg1 : i1)
func.func @logicalBinary(%arg0 : i1, %arg1 : i1)
{
// expected-error @+2 {{expected ':'}}
%0 = spv.LogicalAnd %arg0, %arg1
@ -97,7 +97,7 @@ func @logicalBinary(%arg0 : i1, %arg1 : i1)
// -----
func @logicalBinary(%arg0 : i1, %arg1 : i1)
func.func @logicalBinary(%arg0 : i1, %arg1 : i1)
{
// expected-error @+2 {{expected non-function type}}
%0 = spv.LogicalAnd %arg0, %arg1 :
@ -106,7 +106,7 @@ func @logicalBinary(%arg0 : i1, %arg1 : i1)
// -----
func @logicalBinary(%arg0 : i1, %arg1 : i1)
func.func @logicalBinary(%arg0 : i1, %arg1 : i1)
{
// expected-error @+1 {{expected ','}}
%0 = spv.LogicalAnd %arg0 : i1
@ -119,7 +119,7 @@ func @logicalBinary(%arg0 : i1, %arg1 : i1)
// spv.LogicalNot
//===----------------------------------------------------------------------===//
func @logicalUnary(%arg0 : i1, %arg1 : i1)
func.func @logicalUnary(%arg0 : i1, %arg1 : i1)
{
// CHECK: [[TMP:%.*]] = spv.LogicalNot {{%.*}} : i1
%0 = spv.LogicalNot %arg0 : i1
@ -128,7 +128,7 @@ func @logicalUnary(%arg0 : i1, %arg1 : i1)
return
}
func @logicalUnary2(%arg0 : vector<4xi1>)
func.func @logicalUnary2(%arg0 : vector<4xi1>)
{
// CHECK: {{%.*}} = spv.LogicalNot {{%.*}} : vector<4xi1>
%0 = spv.LogicalNot %arg0 : vector<4xi1>
@ -137,7 +137,7 @@ func @logicalUnary2(%arg0 : vector<4xi1>)
// -----
func @logicalUnary(%arg0 : i1)
func.func @logicalUnary(%arg0 : i1)
{
// expected-error @+2 {{expected ':'}}
%0 = spv.LogicalNot %arg0
@ -146,7 +146,7 @@ func @logicalUnary(%arg0 : i1)
// -----
func @logicalUnary(%arg0 : i1)
func.func @logicalUnary(%arg0 : i1)
{
// expected-error @+2 {{expected non-function type}}
%0 = spv.LogicalNot %arg0 :
@ -155,7 +155,7 @@ func @logicalUnary(%arg0 : i1)
// -----
func @logicalUnary(%arg0 : i1)
func.func @logicalUnary(%arg0 : i1)
{
// expected-error @+1 {{expected SSA operand}}
%0 = spv.LogicalNot : i1
@ -164,7 +164,7 @@ func @logicalUnary(%arg0 : i1)
// -----
func @logicalUnary(%arg0 : i32)
func.func @logicalUnary(%arg0 : i32)
{
// expected-error @+1 {{'operand' must be bool or vector of bool values of length 2/3/4/8/16, but got 'i32'}}
%0 = spv.LogicalNot %arg0 : i32
@ -177,7 +177,7 @@ func @logicalUnary(%arg0 : i32)
// spv.SelectOp
//===----------------------------------------------------------------------===//
func @select_op_bool(%arg0: i1) -> () {
func.func @select_op_bool(%arg0: i1) -> () {
%0 = spv.Constant true
%1 = spv.Constant false
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : i1, i1
@ -185,7 +185,7 @@ func @select_op_bool(%arg0: i1) -> () {
return
}
func @select_op_int(%arg0: i1) -> () {
func.func @select_op_int(%arg0: i1) -> () {
%0 = spv.Constant 2 : i32
%1 = spv.Constant 3 : i32
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : i1, i32
@ -193,7 +193,7 @@ func @select_op_int(%arg0: i1) -> () {
return
}
func @select_op_float(%arg0: i1) -> () {
func.func @select_op_float(%arg0: i1) -> () {
%0 = spv.Constant 2.0 : f32
%1 = spv.Constant 3.0 : f32
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : i1, f32
@ -201,7 +201,7 @@ func @select_op_float(%arg0: i1) -> () {
return
}
func @select_op_ptr(%arg0: i1) -> () {
func.func @select_op_ptr(%arg0: i1) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<f32, Function>
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : i1, !spv.ptr<f32, Function>
@ -209,7 +209,7 @@ func @select_op_ptr(%arg0: i1) -> () {
return
}
func @select_op_vec(%arg0: i1) -> () {
func.func @select_op_vec(%arg0: i1) -> () {
%0 = spv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32>
%1 = spv.Constant dense<[5.0, 6.0, 7.0]> : vector<3xf32>
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : i1, vector<3xf32>
@ -217,7 +217,7 @@ func @select_op_vec(%arg0: i1) -> () {
return
}
func @select_op_vec_condn_vec(%arg0: vector<3xi1>) -> () {
func.func @select_op_vec_condn_vec(%arg0: vector<3xi1>) -> () {
%0 = spv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32>
%1 = spv.Constant dense<[5.0, 6.0, 7.0]> : vector<3xf32>
// CHECK : spv.Select {{%.*}}, {{%.*}}, {{%.*}} : vector<3xi1>, vector<3xf32>
@ -227,7 +227,7 @@ func @select_op_vec_condn_vec(%arg0: vector<3xi1>) -> () {
// -----
func @select_op(%arg0: i1) -> () {
func.func @select_op(%arg0: i1) -> () {
%0 = spv.Constant 2 : i32
%1 = spv.Constant 3 : i32
// expected-error @+2 {{expected ','}}
@ -237,7 +237,7 @@ func @select_op(%arg0: i1) -> () {
// -----
func @select_op(%arg1: vector<3xi1>) -> () {
func.func @select_op(%arg1: vector<3xi1>) -> () {
%0 = spv.Constant 2 : i32
%1 = spv.Constant 3 : i32
// expected-error @+1 {{result expected to be of vector type when condition is of vector type}}
@ -247,7 +247,7 @@ func @select_op(%arg1: vector<3xi1>) -> () {
// -----
func @select_op(%arg1: vector<4xi1>) -> () {
func.func @select_op(%arg1: vector<4xi1>) -> () {
%0 = spv.Constant dense<[2, 3, 4]> : vector<3xi32>
%1 = spv.Constant dense<[5, 6, 7]> : vector<3xi32>
// expected-error @+1 {{result should have the same number of elements as the condition when condition is of vector type}}
@ -257,7 +257,7 @@ func @select_op(%arg1: vector<4xi1>) -> () {
// -----
func @select_op(%arg1: vector<4xi1>) -> () {
func.func @select_op(%arg1: vector<4xi1>) -> () {
%0 = spv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32>
%1 = spv.Constant dense<[5, 6, 7]> : vector<3xi32>
// expected-error @+1 {{all of {true_value, false_value, result} have same type}}
@ -267,7 +267,7 @@ func @select_op(%arg1: vector<4xi1>) -> () {
// -----
func @select_op(%arg1: vector<4xi1>) -> () {
func.func @select_op(%arg1: vector<4xi1>) -> () {
%0 = spv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32>
%1 = spv.Constant dense<[5, 6, 7]> : vector<3xi32>
// TODO: expand post change in verification order. This is currently only
@ -285,7 +285,7 @@ func @select_op(%arg1: vector<4xi1>) -> () {
// spv.SGreaterThan
//===----------------------------------------------------------------------===//
func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.SGreaterThan {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.SGreaterThan %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -297,7 +297,7 @@ func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.SGreaterThanEqual
//===----------------------------------------------------------------------===//
func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.SGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.SGreaterThanEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -309,7 +309,7 @@ func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.SLessThan
//===----------------------------------------------------------------------===//
func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.SLessThan {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.SLessThan %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -321,7 +321,7 @@ func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.SLessThanEqual
//===----------------------------------------------------------------------===//
func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.SLessThanEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.SLessThanEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -333,7 +333,7 @@ func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.UGreaterThan
//===----------------------------------------------------------------------===//
func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.UGreaterThan {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.UGreaterThan %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -345,7 +345,7 @@ func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.UGreaterThanEqual
//===----------------------------------------------------------------------===//
func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.UGreaterThanEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.UGreaterThanEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -357,7 +357,7 @@ func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.ULessThan
//===----------------------------------------------------------------------===//
func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.ULessThan {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.ULessThan %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>
@ -369,7 +369,7 @@ func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// spv.ULessThanEqual
//===----------------------------------------------------------------------===//
func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
func.func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> {
// CHECK: spv.ULessThanEqual {{.*}}, {{.*}} : vector<4xi32>
%0 = spv.ULessThanEqual %arg0, %arg1 : vector<4xi32>
return %0 : vector<4xi1>

View File

@ -39,35 +39,35 @@ spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
// -----
func @input_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f16) -> () {
func.func @input_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f16) -> () {
// expected-error @+1 {{input matrix components' type and scaling value must have the same type}}
%result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, f16 -> !spv.matrix<3 x vector<3xf32>>
}
// -----
func @input_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f64) -> () {
func.func @input_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f64) -> () {
// expected-error @+1 {{input matrix components' type and scaling value must have the same type}}
%result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, f64 -> !spv.matrix<3 x vector<3xf32>>
}
// -----
func @input_output_component_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> () {
func.func @input_output_component_type_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> () {
// expected-error @+1 {{input and result matrices' columns must have the same component type}}
%result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, f32 -> !spv.matrix<3 x vector<3xf64>>
}
// -----
func @input_output_size_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> () {
func.func @input_output_size_mismatch(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> () {
// expected-error @+1 {{input and result matrices must have the same number of columns}}
%result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, f32 -> !spv.matrix<4 x vector<3xf32>>
}
// -----
func @transpose_op_shape_mismatch_1(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
func.func @transpose_op_shape_mismatch_1(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
// expected-error @+1 {{input matrix rows count must be equal to output matrix columns count}}
%result = spv.Transpose %arg0 : !spv.matrix<3 x vector<4xf32>> -> !spv.matrix<3 x vector<3xf32>>
spv.Return
@ -75,7 +75,7 @@ func @transpose_op_shape_mismatch_1(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> (
// -----
func @transpose_op_shape_mismatch_2(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
func.func @transpose_op_shape_mismatch_2(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
// expected-error @+1 {{input matrix rows count must be equal to output matrix columns count}}
%result = spv.Transpose %arg0 : !spv.matrix<3 x vector<4xf32>> -> !spv.matrix<2 x vector<4xf32>>
spv.Return
@ -83,7 +83,7 @@ func @transpose_op_shape_mismatch_2(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> (
// -----
func @transpose_op_type_mismatch(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
func.func @transpose_op_type_mismatch(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
// expected-error @+1 {{input and output matrices must have the same component type}}
%result = spv.Transpose %arg0 : !spv.matrix<3 x vector<4xf32>> -> !spv.matrix<4 x vector<3xf16>>
spv.Return
@ -91,28 +91,28 @@ func @transpose_op_type_mismatch(%arg0 : !spv.matrix<3 x vector<4xf32>>) -> () {
// -----
func @matrix_times_matrix_invalid_input_shape_1(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<3xf32>>){
func.func @matrix_times_matrix_invalid_input_shape_1(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<3xf32>>){
// expected-error @+1 {{right and result matrices must have equal columns' count}}
%result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<2xf32>>, !spv.matrix<2 x vector<3xf32>> -> !spv.matrix<3 x vector<2xf32>>
}
// -----
func @matrix_times_matrix_invalid_input_shape_2(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<3xf32>>){
func.func @matrix_times_matrix_invalid_input_shape_2(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<3xf32>>){
// expected-error @+1 {{left and result matrices must have equal rows' count}}
%result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<2xf32>>, !spv.matrix<2 x vector<3xf32>> -> !spv.matrix<2 x vector<3xf32>>
}
// -----
func @matrix_times_matrix_inputs_shape_mismatch(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<2xf32>>){
func.func @matrix_times_matrix_inputs_shape_mismatch(%arg0 : !spv.matrix<3 x vector<2xf32>>, %arg1 : !spv.matrix<2 x vector<2xf32>>){
// expected-error @+1 {{left matrix columns' count must be equal to the right matrix rows' count}}
%result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<2xf32>>, !spv.matrix<2 x vector<2xf32>> -> !spv.matrix<2 x vector<2xf32>>
}
// -----
func @matrix_times_matrix_component_type_mismatch_1(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : !spv.matrix<3x vector<3xf32>>){
func.func @matrix_times_matrix_component_type_mismatch_1(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : !spv.matrix<3x vector<3xf32>>){
// expected-error @+1 {{right and result matrices' component type must be the same}}
%result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, !spv.matrix<3 x vector<3xf32>> -> !spv.matrix<3 x vector<3xf64>>
}
@ -120,7 +120,7 @@ func @matrix_times_matrix_component_type_mismatch_1(%arg0 : !spv.matrix<3 x vect
// -----
func @matrix_times_matrix_component_type_mismatch_2(%arg0 : !spv.matrix<3 x vector<3xf64>>, %arg1 : !spv.matrix<3x vector<3xf32>>){
func.func @matrix_times_matrix_component_type_mismatch_2(%arg0 : !spv.matrix<3 x vector<3xf64>>, %arg1 : !spv.matrix<3x vector<3xf32>>){
// expected-error @+1 {{left and result matrices' component type must be the same}}
%result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<3xf64>>, !spv.matrix<3 x vector<3xf32>> -> !spv.matrix<3 x vector<3xf32>>
}

View File

@ -4,7 +4,7 @@
// spv.AccessChain
//===----------------------------------------------------------------------===//
func @access_chain_struct() -> () {
func.func @access_chain_struct() -> () {
%0 = spv.Constant 1: i32
%1 = spv.Variable : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Function>
// CHECK: spv.AccessChain {{.*}}[{{.*}}, {{.*}}] : !spv.ptr<!spv.struct<(f32, !spv.array<4 x f32>)>, Function>
@ -12,14 +12,14 @@ func @access_chain_struct() -> () {
return
}
func @access_chain_1D_array(%arg0 : i32) -> () {
func.func @access_chain_1D_array(%arg0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4xf32>, Function>
// CHECK: spv.AccessChain {{.*}}[{{.*}}] : !spv.ptr<!spv.array<4 x f32>, Function>
%1 = spv.AccessChain %0[%arg0] : !spv.ptr<!spv.array<4xf32>, Function>, i32
return
}
func @access_chain_2D_array_1(%arg0 : i32) -> () {
func.func @access_chain_2D_array_1(%arg0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// CHECK: spv.AccessChain {{.*}}[{{.*}}, {{.*}}] : !spv.ptr<!spv.array<4 x !spv.array<4 x f32>>, Function>
%1 = spv.AccessChain %0[%arg0, %arg0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32, i32
@ -27,7 +27,7 @@ func @access_chain_2D_array_1(%arg0 : i32) -> () {
return
}
func @access_chain_2D_array_2(%arg0 : i32) -> () {
func.func @access_chain_2D_array_2(%arg0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// CHECK: spv.AccessChain {{.*}}[{{.*}}] : !spv.ptr<!spv.array<4 x !spv.array<4 x f32>>, Function>
%1 = spv.AccessChain %0[%arg0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32
@ -35,7 +35,7 @@ func @access_chain_2D_array_2(%arg0 : i32) -> () {
return
}
func @access_chain_rtarray(%arg0 : i32) -> () {
func.func @access_chain_rtarray(%arg0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.rtarray<f32>, Function>
// CHECK: spv.AccessChain {{.*}}[{{.*}}] : !spv.ptr<!spv.rtarray<f32>, Function>
%1 = spv.AccessChain %0[%arg0] : !spv.ptr<!spv.rtarray<f32>, Function>, i32
@ -45,7 +45,7 @@ func @access_chain_rtarray(%arg0 : i32) -> () {
// -----
func @access_chain_non_composite() -> () {
func.func @access_chain_non_composite() -> () {
%0 = spv.Constant 1: i32
%1 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{cannot extract from non-composite type 'f32' with index 0}}
@ -55,7 +55,7 @@ func @access_chain_non_composite() -> () {
// -----
func @access_chain_no_indices(%index0 : i32) -> () {
func.func @access_chain_no_indices(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{expected at least one index}}
%1 = spv.AccessChain %0[] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32
@ -64,7 +64,7 @@ func @access_chain_no_indices(%index0 : i32) -> () {
// -----
func @access_chain_missing_comma(%index0 : i32) -> () {
func.func @access_chain_missing_comma(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{expected ','}}
%1 = spv.AccessChain %0[%index0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function> i32
@ -73,7 +73,7 @@ func @access_chain_missing_comma(%index0 : i32) -> () {
// -----
func @access_chain_invalid_indices_types_count(%index0 : i32) -> () {
func.func @access_chain_invalid_indices_types_count(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{'spv.AccessChain' op indices types' count must be equal to indices info count}}
%1 = spv.AccessChain %0[%index0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32, i32
@ -82,7 +82,7 @@ func @access_chain_invalid_indices_types_count(%index0 : i32) -> () {
// -----
func @access_chain_missing_indices_type(%index0 : i32) -> () {
func.func @access_chain_missing_indices_type(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{'spv.AccessChain' op indices types' count must be equal to indices info count}}
%1 = spv.AccessChain %0[%index0, %index0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32
@ -91,7 +91,7 @@ func @access_chain_missing_indices_type(%index0 : i32) -> () {
// -----
func @access_chain_invalid_type(%index0 : i32) -> () {
func.func @access_chain_invalid_type(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
%1 = spv.Load "Function" %0 ["Volatile"] : !spv.array<4x!spv.array<4xf32>>
// expected-error @+1 {{expected a pointer to composite type, but provided '!spv.array<4 x !spv.array<4 x f32>>'}}
@ -101,7 +101,7 @@ func @access_chain_invalid_type(%index0 : i32) -> () {
// -----
func @access_chain_invalid_index_1(%index0 : i32) -> () {
func.func @access_chain_invalid_index_1(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{expected SSA operand}}
%1 = spv.AccessChain %0[%index, 4] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32, i32
@ -110,7 +110,7 @@ func @access_chain_invalid_index_1(%index0 : i32) -> () {
// -----
func @access_chain_invalid_index_2(%index0 : i32) -> () {
func.func @access_chain_invalid_index_2(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Function>
// expected-error @+1 {{index must be an integer spv.Constant to access element of spv.struct}}
%1 = spv.AccessChain %0[%index0, %index0] : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Function>, i32, i32
@ -119,7 +119,7 @@ func @access_chain_invalid_index_2(%index0 : i32) -> () {
// -----
func @access_chain_invalid_constant_type_1() -> () {
func.func @access_chain_invalid_constant_type_1() -> () {
%0 = arith.constant 1: i32
%1 = spv.Variable : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Function>
// expected-error @+1 {{index must be an integer spv.Constant to access element of spv.struct, but provided arith.constant}}
@ -129,7 +129,7 @@ func @access_chain_invalid_constant_type_1() -> () {
// -----
func @access_chain_out_of_bounds() -> () {
func.func @access_chain_out_of_bounds() -> () {
%index0 = "spv.Constant"() { value = 12: i32} : () -> i32
%0 = spv.Variable : !spv.ptr<!spv.struct<(f32, !spv.array<4xf32>)>, Function>
// expected-error @+1 {{'spv.AccessChain' op index 12 out of bounds for '!spv.struct<(f32, !spv.array<4 x f32>)>'}}
@ -139,7 +139,7 @@ func @access_chain_out_of_bounds() -> () {
// -----
func @access_chain_invalid_accessing_type(%index0 : i32) -> () {
func.func @access_chain_invalid_accessing_type(%index0 : i32) -> () {
%0 = spv.Variable : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>
// expected-error @+1 {{cannot extract from non-composite type 'f32' with index 0}}
%1 = spv.AccessChain %0[%index, %index0, %index0] : !spv.ptr<!spv.array<4x!spv.array<4xf32>>, Function>, i32, i32, i32
@ -152,7 +152,7 @@ func @access_chain_invalid_accessing_type(%index0 : i32) -> () {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: @simple_load
func @simple_load() -> () {
func.func @simple_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load "Function" %{{.*}} : f32
%1 = spv.Load "Function" %0 : f32
@ -160,7 +160,7 @@ func @simple_load() -> () {
}
// CHECK-LABEL: @load_none_access
func @load_none_access() -> () {
func.func @load_none_access() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load "Function" %{{.*}} ["None"] : f32
%1 = spv.Load "Function" %0 ["None"] : f32
@ -168,7 +168,7 @@ func @load_none_access() -> () {
}
// CHECK-LABEL: @volatile_load
func @volatile_load() -> () {
func.func @volatile_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load "Function" %{{.*}} ["Volatile"] : f32
%1 = spv.Load "Function" %0 ["Volatile"] : f32
@ -176,7 +176,7 @@ func @volatile_load() -> () {
}
// CHECK-LABEL: @aligned_load
func @aligned_load() -> () {
func.func @aligned_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load "Function" %{{.*}} ["Aligned", 4] : f32
%1 = spv.Load "Function" %0 ["Aligned", 4] : f32
@ -184,7 +184,7 @@ func @aligned_load() -> () {
}
// CHECK-LABEL: @volatile_aligned_load
func @volatile_aligned_load() -> () {
func.func @volatile_aligned_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load "Function" %{{.*}} ["Volatile|Aligned", 4] : f32
%1 = spv.Load "Function" %0 ["Volatile|Aligned", 4] : f32
@ -194,7 +194,7 @@ func @volatile_aligned_load() -> () {
// -----
// CHECK-LABEL: load_none_access
func @load_none_access() -> () {
func.func @load_none_access() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load
// CHECK-SAME: ["None"]
@ -203,7 +203,7 @@ func @load_none_access() -> () {
}
// CHECK-LABEL: volatile_load
func @volatile_load() -> () {
func.func @volatile_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load
// CHECK-SAME: ["Volatile"]
@ -212,7 +212,7 @@ func @volatile_load() -> () {
}
// CHECK-LABEL: aligned_load
func @aligned_load() -> () {
func.func @aligned_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load
// CHECK-SAME: ["Aligned", 4]
@ -221,7 +221,7 @@ func @aligned_load() -> () {
}
// CHECK-LABEL: volatile_aligned_load
func @volatile_aligned_load() -> () {
func.func @volatile_aligned_load() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Load
// CHECK-SAME: ["Volatile|Aligned", 4]
@ -231,7 +231,7 @@ func @volatile_aligned_load() -> () {
// -----
func @simple_load_missing_storageclass() -> () {
func.func @simple_load_missing_storageclass() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected non-function type}}
%1 = spv.Load %0 : f32
@ -240,7 +240,7 @@ func @simple_load_missing_storageclass() -> () {
// -----
func @simple_load_missing_operand() -> () {
func.func @simple_load_missing_operand() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected SSA operand}}
%1 = spv.Load "Function" : f32
@ -249,7 +249,7 @@ func @simple_load_missing_operand() -> () {
// -----
func @simple_load_missing_rettype() -> () {
func.func @simple_load_missing_rettype() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+2 {{expected ':'}}
%1 = spv.Load "Function" %0
@ -258,7 +258,7 @@ func @simple_load_missing_rettype() -> () {
// -----
func @volatile_load_missing_lbrace() -> () {
func.func @volatile_load_missing_lbrace() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ':'}}
%1 = spv.Load "Function" %0 "Volatile"] : f32
@ -267,7 +267,7 @@ func @volatile_load_missing_lbrace() -> () {
// -----
func @volatile_load_missing_rbrace() -> () {
func.func @volatile_load_missing_rbrace() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
%1 = spv.Load "Function" %0 ["Volatile"} : f32
@ -276,7 +276,7 @@ func @volatile_load_missing_rbrace() -> () {
// -----
func @aligned_load_missing_alignment() -> () {
func.func @aligned_load_missing_alignment() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ','}}
%1 = spv.Load "Function" %0 ["Aligned"] : f32
@ -285,7 +285,7 @@ func @aligned_load_missing_alignment() -> () {
// -----
func @aligned_load_missing_comma() -> () {
func.func @aligned_load_missing_comma() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ','}}
%1 = spv.Load "Function" %0 ["Aligned" 4] : f32
@ -294,7 +294,7 @@ func @aligned_load_missing_comma() -> () {
// -----
func @load_incorrect_attributes() -> () {
func.func @load_incorrect_attributes() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
%1 = spv.Load "Function" %0 ["Volatile", 4] : f32
@ -303,7 +303,7 @@ func @load_incorrect_attributes() -> () {
// -----
func @load_unknown_memory_access() -> () {
func.func @load_unknown_memory_access() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{custom op 'spv.Load' invalid memory_access attribute specification: "Something"}}
%1 = spv.Load "Function" %0 ["Something"] : f32
@ -312,7 +312,7 @@ func @load_unknown_memory_access() -> () {
// -----
func @load_unknown_memory_access() -> () {
func.func @load_unknown_memory_access() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{custom op 'spv.Load' invalid memory_access attribute specification: "Volatile|Something"}}
%1 = spv.Load "Function" %0 ["Volatile|Something"] : f32
@ -321,7 +321,7 @@ func @load_unknown_memory_access() -> () {
// -----
func @load_unknown_memory_access() -> () {
func.func @load_unknown_memory_access() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{failed to satisfy constraint: valid SPIR-V MemoryAccess}}
%1 = "spv.Load"(%0) {memory_access = 0x80000000 : i32} : (!spv.ptr<f32, Function>) -> (f32)
@ -330,7 +330,7 @@ func @load_unknown_memory_access() -> () {
// -----
func @aligned_load_incorrect_attributes() -> () {
func.func @aligned_load_incorrect_attributes() -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
%1 = spv.Load "Function" %0 ["Aligned", 4, 23] : f32
@ -360,7 +360,7 @@ spv.module Logical GLSL450 {
// spv.StoreOp
//===----------------------------------------------------------------------===//
func @simple_store(%arg0 : f32) -> () {
func.func @simple_store(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Store "Function" %0, %arg0 : f32
spv.Store "Function" %0, %arg0 : f32
@ -368,7 +368,7 @@ func @simple_store(%arg0 : f32) -> () {
}
// CHECK_LABEL: @volatile_store
func @volatile_store(%arg0 : f32) -> () {
func.func @volatile_store(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Store "Function" %0, %arg0 ["Volatile"] : f32
spv.Store "Function" %0, %arg0 ["Volatile"] : f32
@ -376,7 +376,7 @@ func @volatile_store(%arg0 : f32) -> () {
}
// CHECK_LABEL: @aligned_store
func @aligned_store(%arg0 : f32) -> () {
func.func @aligned_store(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// CHECK: spv.Store "Function" %0, %arg0 ["Aligned", 4] : f32
spv.Store "Function" %0, %arg0 ["Aligned", 4] : f32
@ -385,7 +385,7 @@ func @aligned_store(%arg0 : f32) -> () {
// -----
func @simple_store_missing_ptr_type(%arg0 : f32) -> () {
func.func @simple_store_missing_ptr_type(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected non-function type}}
spv.Store %0, %arg0 : f32
@ -394,7 +394,7 @@ func @simple_store_missing_ptr_type(%arg0 : f32) -> () {
// -----
func @simple_store_missing_operand(%arg0 : f32) -> () {
func.func @simple_store_missing_operand(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{custom op 'spv.Store' invalid operand}} : f32
spv.Store "Function" , %arg0 : f32
@ -403,7 +403,7 @@ func @simple_store_missing_operand(%arg0 : f32) -> () {
// -----
func @simple_store_missing_operand(%arg0 : f32) -> () {
func.func @simple_store_missing_operand(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{custom op 'spv.Store' expected 2 operands}} : f32
spv.Store "Function" %0 : f32
@ -412,7 +412,7 @@ func @simple_store_missing_operand(%arg0 : f32) -> () {
// -----
func @volatile_store_missing_lbrace(%arg0 : f32) -> () {
func.func @volatile_store_missing_lbrace(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ':'}}
spv.Store "Function" %0, %arg0 "Volatile"] : f32
@ -421,7 +421,7 @@ func @volatile_store_missing_lbrace(%arg0 : f32) -> () {
// -----
func @volatile_store_missing_rbrace(%arg0 : f32) -> () {
func.func @volatile_store_missing_rbrace(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
spv.Store "Function" %0, %arg0 ["Volatile"} : f32
@ -430,7 +430,7 @@ func @volatile_store_missing_rbrace(%arg0 : f32) -> () {
// -----
func @aligned_store_missing_alignment(%arg0 : f32) -> () {
func.func @aligned_store_missing_alignment(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ','}}
spv.Store "Function" %0, %arg0 ["Aligned"] : f32
@ -439,7 +439,7 @@ func @aligned_store_missing_alignment(%arg0 : f32) -> () {
// -----
func @aligned_store_missing_comma(%arg0 : f32) -> () {
func.func @aligned_store_missing_comma(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ','}}
spv.Store "Function" %0, %arg0 ["Aligned" 4] : f32
@ -448,7 +448,7 @@ func @aligned_store_missing_comma(%arg0 : f32) -> () {
// -----
func @load_incorrect_attributes(%arg0 : f32) -> () {
func.func @load_incorrect_attributes(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
spv.Store "Function" %0, %arg0 ["Volatile", 4] : f32
@ -457,7 +457,7 @@ func @load_incorrect_attributes(%arg0 : f32) -> () {
// -----
func @aligned_store_incorrect_attributes(%arg0 : f32) -> () {
func.func @aligned_store_incorrect_attributes(%arg0 : f32) -> () {
%0 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{expected ']'}}
spv.Store "Function" %0, %arg0 ["Aligned", 4, 23] : f32
@ -482,7 +482,7 @@ spv.module Logical GLSL450 {
// spv.Variable
//===----------------------------------------------------------------------===//
func @variable(%arg0: f32) -> () {
func.func @variable(%arg0: f32) -> () {
// CHECK: spv.Variable : !spv.ptr<f32, Function>
%0 = spv.Variable : !spv.ptr<f32, Function>
return
@ -490,7 +490,7 @@ func @variable(%arg0: f32) -> () {
// -----
func @variable_init_normal_constant() -> () {
func.func @variable_init_normal_constant() -> () {
// CHECK: %[[cst:.*]] = spv.Constant
%0 = spv.Constant 4.0 : f32
// CHECK: spv.Variable init(%[[cst]]) : !spv.ptr<f32, Function>
@ -525,7 +525,7 @@ spv.module Logical GLSL450 {
// -----
func @variable_bind() -> () {
func.func @variable_bind() -> () {
// expected-error @+1 {{cannot have 'descriptor_set' attribute (only allowed in spv.GlobalVariable)}}
%0 = spv.Variable bind(1, 2) : !spv.ptr<f32, Function>
return
@ -533,7 +533,7 @@ func @variable_bind() -> () {
// -----
func @variable_init_bind() -> () {
func.func @variable_init_bind() -> () {
%0 = spv.Constant 4.0 : f32
// expected-error @+1 {{cannot have 'binding' attribute (only allowed in spv.GlobalVariable)}}
%1 = spv.Variable init(%0) {binding = 5 : i32} : !spv.ptr<f32, Function>
@ -542,7 +542,7 @@ func @variable_init_bind() -> () {
// -----
func @variable_builtin() -> () {
func.func @variable_builtin() -> () {
// expected-error @+1 {{cannot have 'built_in' attribute (only allowed in spv.GlobalVariable)}}
%1 = spv.Variable built_in("GlobalInvocationID") : !spv.ptr<vector<3xi32>, Function>
return
@ -550,7 +550,7 @@ func @variable_builtin() -> () {
// -----
func @expect_ptr_result_type(%arg0: f32) -> () {
func.func @expect_ptr_result_type(%arg0: f32) -> () {
// expected-error @+1 {{expected spv.ptr type}}
%0 = spv.Variable : f32
return
@ -558,7 +558,7 @@ func @expect_ptr_result_type(%arg0: f32) -> () {
// -----
func @variable_init(%arg0: f32) -> () {
func.func @variable_init(%arg0: f32) -> () {
// expected-error @+1 {{op initializer must be the result of a constant or spv.GlobalVariable op}}
%0 = spv.Variable init(%arg0) : !spv.ptr<f32, Function>
return
@ -566,7 +566,7 @@ func @variable_init(%arg0: f32) -> () {
// -----
func @cannot_be_generic_storage_class(%arg0: f32) -> () {
func.func @cannot_be_generic_storage_class(%arg0: f32) -> () {
// expected-error @+1 {{op can only be used to model function-level variables. Use spv.GlobalVariable for module-level variables}}
%0 = spv.Variable : !spv.ptr<f32, Generic>
return
@ -574,7 +574,7 @@ func @cannot_be_generic_storage_class(%arg0: f32) -> () {
// -----
func @copy_memory_incompatible_ptrs() {
func.func @copy_memory_incompatible_ptrs() {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<i32, Function>
// expected-error @+1 {{both operands must be pointers to the same type}}
@ -584,7 +584,7 @@ func @copy_memory_incompatible_ptrs() {
// -----
func @copy_memory_invalid_maa() {
func.func @copy_memory_invalid_maa() {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{missing alignment value}}
@ -594,7 +594,7 @@ func @copy_memory_invalid_maa() {
// -----
func @copy_memory_invalid_source_maa() {
func.func @copy_memory_invalid_source_maa() {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{invalid alignment specification with non-aligned memory access specification}}
@ -604,7 +604,7 @@ func @copy_memory_invalid_source_maa() {
// -----
func @copy_memory_invalid_source_maa2() {
func.func @copy_memory_invalid_source_maa2() {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<f32, Function>
// expected-error @+1 {{missing alignment value}}
@ -614,7 +614,7 @@ func @copy_memory_invalid_source_maa2() {
// -----
func @copy_memory_print_maa() {
func.func @copy_memory_print_maa() {
%0 = spv.Variable : !spv.ptr<f32, Function>
%1 = spv.Variable : !spv.ptr<f32, Function>
@ -643,7 +643,7 @@ func @copy_memory_print_maa() {
// CHECK-SAME: %[[ARG0:.*]]: !spv.ptr<f32, CrossWorkgroup>,
// CHECK-SAME: %[[ARG1:.*]]: i64)
// CHECK: spv.PtrAccessChain %[[ARG0]][%[[ARG1]]] : !spv.ptr<f32, CrossWorkgroup>, i64
func @ptr_access_chain1(%arg0: !spv.ptr<f32, CrossWorkgroup>, %arg1 : i64) -> () {
func.func @ptr_access_chain1(%arg0: !spv.ptr<f32, CrossWorkgroup>, %arg1 : i64) -> () {
%0 = spv.PtrAccessChain %arg0[%arg1] : !spv.ptr<f32, CrossWorkgroup>, i64
return
}
@ -658,7 +658,7 @@ func @ptr_access_chain1(%arg0: !spv.ptr<f32, CrossWorkgroup>, %arg1 : i64) -> ()
// CHECK-SAME: %[[ARG0:.*]]: !spv.ptr<f32, CrossWorkgroup>,
// CHECK-SAME: %[[ARG1:.*]]: i64)
// CHECK: spv.InBoundsPtrAccessChain %[[ARG0]][%[[ARG1]]] : !spv.ptr<f32, CrossWorkgroup>, i64
func @inbounds_ptr_access_chain1(%arg0: !spv.ptr<f32, CrossWorkgroup>, %arg1 : i64) -> () {
func.func @inbounds_ptr_access_chain1(%arg0: !spv.ptr<f32, CrossWorkgroup>, %arg1 : i64) -> () {
%0 = spv.InBoundsPtrAccessChain %arg0[%arg1] : !spv.ptr<f32, CrossWorkgroup>, i64
return
}

View File

@ -4,7 +4,7 @@
// spv.Undef
//===----------------------------------------------------------------------===//
func @undef() -> () {
func.func @undef() -> () {
// CHECK: %{{.*}} = spv.Undef : f32
%0 = spv.Undef : f32
// CHECK: %{{.*}} = spv.Undef : vector<4xf32>
@ -14,7 +14,7 @@ func @undef() -> () {
// -----
func @undef() -> () {
func.func @undef() -> () {
// expected-error @+2{{expected non-function type}}
%0 = spv.Undef :
spv.Return
@ -22,7 +22,7 @@ func @undef() -> () {
// -----
func @undef() -> () {
func.func @undef() -> () {
// expected-error @+2{{expected ':'}}
%0 = spv.Undef
spv.Return
@ -30,7 +30,7 @@ func @undef() -> () {
// -----
func @assume_true(%arg : i1) -> () {
func.func @assume_true(%arg : i1) -> () {
// CHECK: spv.AssumeTrueKHR %{{.*}}
spv.AssumeTrueKHR %arg
spv.Return
@ -38,7 +38,7 @@ func @assume_true(%arg : i1) -> () {
// -----
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

View File

@ -4,7 +4,7 @@
// 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>
@ -12,7 +12,7 @@ func @group_non_uniform_ballot(%predicate: i1) -> 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>
@ -20,7 +20,7 @@ func @group_non_uniform_ballot(%predicate: i1) -> 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>
@ -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
@ -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
@ -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
@ -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
@ -72,7 +72,7 @@ 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
@ -80,7 +80,7 @@ func @group_non_uniform_elect() -> 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
@ -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>
@ -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>
@ -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
@ -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
@ -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>
@ -175,7 +175,7 @@ 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
@ -183,7 +183,7 @@ func @group_non_uniform_iadd_reduce(%val: i32) -> 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>
@ -191,7 +191,7 @@ func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi
// -----
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>
@ -199,7 +199,7 @@ func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>, %size: 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> {
%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>
@ -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>
@ -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
@ -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
@ -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
@ -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

View File

@ -4,13 +4,13 @@
// 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
@ -18,7 +18,7 @@ func @expvec(%arg0 : vector<3xf16>) -> () {
// -----
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
@ -26,7 +26,7 @@ func @exp(%arg0 : i32) -> () {
// -----
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
@ -34,7 +34,7 @@ func @exp(%arg0 : vector<5xf32>) -> () {
// -----
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
@ -42,7 +42,7 @@ func @exp(%arg0 : f32, %arg1 : f32) -> () {
// -----
func @exp(%arg0 : i32) -> () {
func.func @exp(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.exp %arg0 :
return
@ -54,19 +54,19 @@ 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
@ -74,7 +74,7 @@ func @fabsf64(%arg0 : f64) -> () {
// -----
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
@ -82,7 +82,7 @@ func @fabs(%arg0 : i32) -> () {
// -----
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
@ -90,7 +90,7 @@ func @fabs(%arg0 : vector<5xf32>) -> () {
// -----
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
@ -98,7 +98,7 @@ func @fabs(%arg0 : f32, %arg1 : f32) -> () {
// -----
func @fabs(%arg0 : i32) -> () {
func.func @fabs(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.fabs %arg0 :
return
@ -110,25 +110,25 @@ 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
@ -136,7 +136,7 @@ func @sabsi8(%arg0 : i8) -> () {
// -----
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
@ -144,7 +144,7 @@ func @sabs(%arg0 : f32) -> () {
// -----
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
@ -152,7 +152,7 @@ func @sabs(%arg0 : vector<5xi32>) -> () {
// -----
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
@ -160,7 +160,7 @@ func @sabs(%arg0 : i32, %arg1 : i32) -> () {
// -----
func @sabs(%arg0 : i32) -> () {
func.func @sabs(%arg0 : i32) -> () {
// expected-error @+2 {{expected non-function type}}
%2 = spv.OCL.s_abs %arg0 :
return
@ -172,7 +172,7 @@ 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
@ -180,7 +180,7 @@ func @fma(%a : f32, %b : f32, %c : f32) -> () {
// -----
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

View File

@ -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
@ -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
@ -78,7 +78,7 @@ 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
@ -86,7 +86,7 @@ func @unaccepted_std_attr() -> () {
// -----
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
@ -94,7 +94,7 @@ func @array_constant() -> () {
// -----
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
@ -102,7 +102,7 @@ func @array_constant() -> () {
// -----
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
@ -110,21 +110,21 @@ func @non_nested_array_constant() -> () {
// -----
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
@ -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
@ -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>
@ -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

View File

@ -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
}
@ -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 }
@ -52,27 +52,27 @@ 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 }
@ -80,21 +80,21 @@ func @interface_var(
// -----
// 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 }
@ -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'}}
@ -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>}>
@ -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,
@ -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,
@ -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,
@ -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]>,
@ -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 = [
@ -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 }

View File

@ -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"
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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], []>, {}>
} {

View File

@ -7,83 +7,83 @@
//===----------------------------------------------------------------------===//
// CHECK: func private @scalar_array_type(!spv.array<16 x f32>, !spv.array<8 x i32>)
func private @scalar_array_type(!spv.array<16xf32>, !spv.array<8 x i32>) -> ()
func.func private @scalar_array_type(!spv.array<16xf32>, !spv.array<8 x i32>) -> ()
// CHECK: func private @vector_array_type(!spv.array<32 x vector<4xf32>>)
func private @vector_array_type(!spv.array< 32 x vector<4xf32> >) -> ()
func.func private @vector_array_type(!spv.array< 32 x vector<4xf32> >) -> ()
// CHECK: func private @array_type_stride(!spv.array<4 x !spv.array<4 x f32, stride=4>, stride=128>)
func private @array_type_stride(!spv.array< 4 x !spv.array<4 x f32, stride=4>, stride = 128>) -> ()
func.func private @array_type_stride(!spv.array< 4 x !spv.array<4 x f32, stride=4>, stride = 128>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
func private @missing_left_angle_bracket(!spv.array 4xf32>) -> ()
func.func private @missing_left_angle_bracket(!spv.array 4xf32>) -> ()
// -----
// expected-error @+1 {{expected single integer for array element count}}
func private @missing_count(!spv.array<f32>) -> ()
func.func private @missing_count(!spv.array<f32>) -> ()
// -----
// expected-error @+1 {{expected 'x' in dimension list}}
func private @missing_x(!spv.array<4 f32>) -> ()
func.func private @missing_x(!spv.array<4 f32>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
func private @missing_element_type(!spv.array<4x>) -> ()
func.func private @missing_element_type(!spv.array<4x>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
func private @cannot_parse_type(!spv.array<4xblabla>) -> ()
func.func private @cannot_parse_type(!spv.array<4xblabla>) -> ()
// -----
// expected-error @+1 {{expected single integer for array element count}}
func private @more_than_one_dim(!spv.array<4x3xf32>) -> ()
func.func private @more_than_one_dim(!spv.array<4x3xf32>) -> ()
// -----
// expected-error @+1 {{only 1-D vector allowed but found 'vector<4x3xf32>'}}
func private @non_1D_vector(!spv.array<4xvector<4x3xf32>>) -> ()
func.func private @non_1D_vector(!spv.array<4xvector<4x3xf32>>) -> ()
// -----
// expected-error @+1 {{cannot use 'tensor<4xf32>' to compose SPIR-V types}}
func private @tensor_type(!spv.array<4xtensor<4xf32>>) -> ()
func.func private @tensor_type(!spv.array<4xtensor<4xf32>>) -> ()
// -----
// expected-error @+1 {{cannot use 'bf16' to compose SPIR-V types}}
func private @bf16_type(!spv.array<4xbf16>) -> ()
func.func private @bf16_type(!spv.array<4xbf16>) -> ()
// -----
// expected-error @+1 {{only 1/8/16/32/64-bit integer type allowed but found 'i256'}}
func private @i256_type(!spv.array<4xi256>) -> ()
func.func private @i256_type(!spv.array<4xi256>) -> ()
// -----
// expected-error @+1 {{cannot use 'index' to compose SPIR-V types}}
func private @index_type(!spv.array<4xindex>) -> ()
func.func private @index_type(!spv.array<4xindex>) -> ()
// -----
// expected-error @+1 {{cannot use '!llvm.struct<()>' to compose SPIR-V types}}
func private @llvm_type(!spv.array<4x!llvm.struct<()>>) -> ()
func.func private @llvm_type(!spv.array<4x!llvm.struct<()>>) -> ()
// -----
// expected-error @+1 {{ArrayStride must be greater than zero}}
func private @array_type_zero_stride(!spv.array<4xi32, stride=0>) -> ()
func.func private @array_type_zero_stride(!spv.array<4xi32, stride=0>) -> ()
// -----
// expected-error @+1 {{expected array length greater than 0}}
func private @array_type_zero_length(!spv.array<0xf32>) -> ()
func.func private @array_type_zero_length(!spv.array<0xf32>) -> ()
// -----
@ -92,33 +92,33 @@ func private @array_type_zero_length(!spv.array<0xf32>) -> ()
//===----------------------------------------------------------------------===//
// CHECK: @bool_ptr_type(!spv.ptr<i1, Uniform>)
func private @bool_ptr_type(!spv.ptr<i1, Uniform>) -> ()
func.func private @bool_ptr_type(!spv.ptr<i1, Uniform>) -> ()
// CHECK: @scalar_ptr_type(!spv.ptr<f32, Uniform>)
func private @scalar_ptr_type(!spv.ptr<f32, Uniform>) -> ()
func.func private @scalar_ptr_type(!spv.ptr<f32, Uniform>) -> ()
// CHECK: @vector_ptr_type(!spv.ptr<vector<4xi32>, PushConstant>)
func private @vector_ptr_type(!spv.ptr<vector<4xi32>,PushConstant>) -> ()
func.func private @vector_ptr_type(!spv.ptr<vector<4xi32>,PushConstant>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
func private @missing_left_angle_bracket(!spv.ptr f32, Uniform>) -> ()
func.func private @missing_left_angle_bracket(!spv.ptr f32, Uniform>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @missing_comma(!spv.ptr<f32 Uniform>) -> ()
func.func private @missing_comma(!spv.ptr<f32 Uniform>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
func private @missing_pointee_type(!spv.ptr<, Uniform>) -> ()
func.func private @missing_pointee_type(!spv.ptr<, Uniform>) -> ()
// -----
// expected-error @+1 {{unknown storage class: SomeStorageClass}}
func private @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
func.func private @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
// -----
@ -127,33 +127,33 @@ func private @unknown_storage_class(!spv.ptr<f32, SomeStorageClass>) -> ()
//===----------------------------------------------------------------------===//
// CHECK: func private @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>)
func private @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>) -> ()
func.func private @scalar_runtime_array_type(!spv.rtarray<f32>, !spv.rtarray<i32>) -> ()
// CHECK: func private @vector_runtime_array_type(!spv.rtarray<vector<4xf32>>)
func private @vector_runtime_array_type(!spv.rtarray< vector<4xf32> >) -> ()
func.func private @vector_runtime_array_type(!spv.rtarray< vector<4xf32> >) -> ()
// CHECK: func private @runtime_array_type_stride(!spv.rtarray<f32, stride=4>)
func private @runtime_array_type_stride(!spv.rtarray<f32, stride=4>) -> ()
func.func private @runtime_array_type_stride(!spv.rtarray<f32, stride=4>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
func private @missing_left_angle_bracket(!spv.rtarray f32>) -> ()
func.func private @missing_left_angle_bracket(!spv.rtarray f32>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
func private @missing_element_type(!spv.rtarray<>) -> ()
func.func private @missing_element_type(!spv.rtarray<>) -> ()
// -----
// expected-error @+1 {{expected non-function type}}
func private @redundant_count(!spv.rtarray<4xf32>) -> ()
func.func private @redundant_count(!spv.rtarray<4xf32>) -> ()
// -----
// expected-error @+1 {{ArrayStride must be greater than zero}}
func private @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
func.func private @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
// -----
@ -162,67 +162,67 @@ func private @runtime_array_type_zero_stride(!spv.rtarray<i32, stride=0>) -> ()
//===----------------------------------------------------------------------===//
// CHECK: func private @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)
func private @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_1D(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_one_element(!spv.image<f32>) -> ()
func.func private @image_parameters_one_element(!spv.image<f32>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_two_elements(!spv.image<f32, Dim1D>) -> ()
func.func private @image_parameters_two_elements(!spv.image<f32, Dim1D>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_three_elements(!spv.image<f32, Dim1D, NoDepth>) -> ()
func.func private @image_parameters_three_elements(!spv.image<f32, Dim1D, NoDepth>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_four_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed>) -> ()
func.func private @image_parameters_four_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_five_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled>) -> ()
func.func private @image_parameters_five_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_six_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown>) -> ()
func.func private @image_parameters_six_elements(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
func private @image_parameters_delimiter(!spv.image f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_delimiter(!spv.image f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_nocomma_1(!spv.image<f32, Dim1D NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_nocomma_1(!spv.image<f32, Dim1D NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_nocomma_2(!spv.image<f32, Dim1D, NoDepth NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_nocomma_2(!spv.image<f32, Dim1D, NoDepth NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_nocomma_3(!spv.image<f32, Dim1D, NoDepth, NonArrayed SingleSampled, SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_nocomma_3(!spv.image<f32, Dim1D, NoDepth, NonArrayed SingleSampled, SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_nocomma_4(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled SamplerUnknown, Unknown>) -> ()
func.func private @image_parameters_nocomma_4(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled SamplerUnknown, Unknown>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown Unknown>) -> ()
func.func private @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown Unknown>) -> ()
// -----
@ -231,12 +231,12 @@ func private @image_parameters_nocomma_5(!spv.image<f32, Dim1D, NoDepth, NonArra
//===----------------------------------------------------------------------===//
// CHECK: func private @sampled_image_type(!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>)
func private @sampled_image_type(!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>) -> ()
func.func private @sampled_image_type(!spv.sampled_image<!spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>) -> ()
// -----
// expected-error @+1 {{sampled image must be composed using image type, got 'f32'}}
func private @samped_image_type_invaid_type(!spv.sampled_image<f32>) -> ()
func.func private @samped_image_type_invaid_type(!spv.sampled_image<f32>) -> ()
// -----
@ -245,118 +245,118 @@ func private @samped_image_type_invaid_type(!spv.sampled_image<f32>) -> ()
//===----------------------------------------------------------------------===//
// CHECK: func private @struct_type(!spv.struct<(f32)>)
func private @struct_type(!spv.struct<(f32)>) -> ()
func.func private @struct_type(!spv.struct<(f32)>) -> ()
// CHECK: func private @struct_type2(!spv.struct<(f32 [0])>)
func private @struct_type2(!spv.struct<(f32 [0])>) -> ()
func.func private @struct_type2(!spv.struct<(f32 [0])>) -> ()
// CHECK: func private @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>)
func private @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>) -> ()
func.func private @struct_type_simple(!spv.struct<(f32, !spv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>)>) -> ()
// CHECK: func private @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>)
func private @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>) -> ()
func.func private @struct_type_with_offset(!spv.struct<(f32 [0], i32 [4])>) -> ()
// CHECK: func private @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
func private @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
func.func private @nested_struct(!spv.struct<(f32, !spv.struct<(f32, i32)>)>)
// CHECK: func private @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
func private @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
func.func private @nested_struct_with_offset(!spv.struct<(f32 [0], !spv.struct<(f32 [0], i32 [4])> [4])>)
// CHECK: func private @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
func private @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
func.func private @struct_type_with_decoration(!spv.struct<(f32 [NonWritable])>)
// CHECK: func private @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
func private @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
func.func private @struct_type_with_decoration_and_offset(!spv.struct<(f32 [0, NonWritable])>)
// CHECK: func private @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
func private @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
func.func private @struct_type_with_decoration2(!spv.struct<(f32 [NonWritable], i32 [NonReadable])>)
// CHECK: func private @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
func private @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
func.func private @struct_type_with_decoration3(!spv.struct<(f32, i32 [NonReadable])>)
// CHECK: func private @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
func private @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
func.func private @struct_type_with_decoration4(!spv.struct<(f32 [0], i32 [4, NonReadable])>)
// CHECK: func private @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
func private @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
func.func private @struct_type_with_decoration5(!spv.struct<(f32 [NonWritable, NonReadable])>)
// CHECK: func private @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
func private @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
func.func private @struct_type_with_decoration6(!spv.struct<(f32, !spv.struct<(i32 [NonWritable, NonReadable])>)>)
// CHECK: func private @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
func private @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
func.func private @struct_type_with_decoration7(!spv.struct<(f32 [0], !spv.struct<(i32, f32 [NonReadable])> [4])>)
// CHECK: func private @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
func private @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
func.func private @struct_type_with_decoration8(!spv.struct<(f32, !spv.struct<(i32 [0], f32 [4, NonReadable])>)>)
// CHECK: func private @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
func private @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
func.func private @struct_type_with_matrix_1(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>)
// CHECK: func private @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
func private @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
func.func private @struct_type_with_matrix_2(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>)
// CHECK: func private @struct_empty(!spv.struct<()>)
func private @struct_empty(!spv.struct<()>)
func.func private @struct_empty(!spv.struct<()>)
// -----
// expected-error @+1 {{offset specification must be given for all members}}
func private @struct_type_missing_offset1((!spv.struct<(f32, i32 [4])>) -> ()
func.func private @struct_type_missing_offset1((!spv.struct<(f32, i32 [4])>) -> ()
// -----
// expected-error @+1 {{offset specification must be given for all members}}
func private @struct_type_missing_offset2(!spv.struct<(f32 [3], i32)>) -> ()
func.func private @struct_type_missing_offset2(!spv.struct<(f32 [3], i32)>) -> ()
// -----
// expected-error @+1 {{expected ')'}}
func private @struct_type_missing_comma1(!spv.struct<(f32 i32)>) -> ()
func.func private @struct_type_missing_comma1(!spv.struct<(f32 i32)>) -> ()
// -----
// expected-error @+1 {{expected ')'}}
func private @struct_type_missing_comma2(!spv.struct<(f32 [0] i32)>) -> ()
func.func private @struct_type_missing_comma2(!spv.struct<(f32 [0] i32)>) -> ()
// -----
// expected-error @+1 {{unbalanced ')' character in pretty dialect name}}
func private @struct_type_neg_offset(!spv.struct<(f32 [0)>) -> ()
func.func private @struct_type_neg_offset(!spv.struct<(f32 [0)>) -> ()
// -----
// expected-error @+1 {{unbalanced ']' character in pretty dialect name}}
func private @struct_type_neg_offset(!spv.struct<(f32 0])>) -> ()
func.func private @struct_type_neg_offset(!spv.struct<(f32 0])>) -> ()
// -----
// expected-error @+1 {{expected ']'}}
func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable 0])>) -> ()
func.func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable 0])>) -> ()
// -----
// expected-error @+1 {{expected valid keyword}}
func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable, 0])>) -> ()
func.func private @struct_type_neg_offset(!spv.struct<(f32 [NonWritable, 0])>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @struct_type_missing_comma(!spv.struct<(f32 [0 NonWritable], i32 [4])>)
func.func private @struct_type_missing_comma(!spv.struct<(f32 [0 NonWritable], i32 [4])>)
// -----
// expected-error @+1 {{expected ']'}}
func private @struct_type_missing_comma(!spv.struct<(f32 [0, NonWritable NonReadable], i32 [4])>)
func.func private @struct_type_missing_comma(!spv.struct<(f32 [0, NonWritable NonReadable], i32 [4])>)
// -----
// expected-error @+1 {{expected ']'}}
func private @struct_type_missing_comma(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor MatrixStride=16])>)
func.func private @struct_type_missing_comma(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor MatrixStride=16])>)
// -----
// expected-error @+1 {{expected integer value}}
func private @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=])>)
func.func private @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=])>)
// -----
@ -365,57 +365,57 @@ func private @struct_missing_member_decorator_value(!spv.struct<(!spv.matrix<3 x
//===----------------------------------------------------------------------===//
// CHECK: func private @id_struct_empty(!spv.struct<empty, ()>)
func private @id_struct_empty(!spv.struct<empty, ()>) -> ()
func.func private @id_struct_empty(!spv.struct<empty, ()>) -> ()
// -----
// CHECK: func private @id_struct_simple(!spv.struct<simple, (f32)>)
func private @id_struct_simple(!spv.struct<simple, (f32)>) -> ()
func.func private @id_struct_simple(!spv.struct<simple, (f32)>) -> ()
// -----
// CHECK: func private @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>)
func private @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>) -> ()
func.func private @id_struct_multiple_elements(!spv.struct<multi_elements, (f32, i32)>) -> ()
// -----
// CHECK: func private @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>)
func private @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>) -> ()
func.func private @id_struct_nested_literal(!spv.struct<a1, (!spv.struct<()>)>) -> ()
// -----
// CHECK: func private @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>)
func private @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>) -> ()
func.func private @id_struct_nested_id(!spv.struct<a2, (!spv.struct<b2, ()>)>) -> ()
// -----
// CHECK: func private @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>)
func private @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>) -> ()
func.func private @literal_struct_nested_id(!spv.struct<(!spv.struct<a3, ()>)>) -> ()
// -----
// CHECK: func private @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>)
func private @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>) -> ()
func.func private @id_struct_self_recursive(!spv.struct<a4, (!spv.ptr<!spv.struct<a4>, Uniform>)>) -> ()
// -----
// CHECK: func private @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>)
func private @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>) -> ()
func.func private @id_struct_self_recursive2(!spv.struct<a5, (i32, !spv.ptr<!spv.struct<a5>, Uniform>)>) -> ()
// -----
// expected-error @+1 {{recursive struct reference not nested in struct definition}}
func private @id_wrong_recursive_reference(!spv.struct<a6>) -> ()
func.func private @id_wrong_recursive_reference(!spv.struct<a6>) -> ()
// -----
// expected-error @+1 {{recursive struct reference not nested in struct definition}}
func private @id_struct_recursive_invalid(!spv.struct<a7, (!spv.ptr<!spv.struct<b7>, Uniform>)>) -> ()
func.func private @id_struct_recursive_invalid(!spv.struct<a7, (!spv.ptr<!spv.struct<b7>, Uniform>)>) -> ()
// -----
// expected-error @+1 {{identifier already used for an enclosing struct}}
func private @id_struct_redefinition(!spv.struct<a8, (!spv.ptr<!spv.struct<a8, (!spv.ptr<!spv.struct<a8>, Uniform>)>, Uniform>)>) -> ()
func.func private @id_struct_redefinition(!spv.struct<a8, (!spv.ptr<!spv.struct<a8, (!spv.ptr<!spv.struct<a8>, Uniform>)>, Uniform>)>) -> ()
// -----
@ -423,7 +423,7 @@ func private @id_struct_redefinition(!spv.struct<a8, (!spv.ptr<!spv.struct<a8, (
// struct a { struct b *bPtr; };
// struct b { struct a *aPtr; };
// CHECK: func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>)
func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>) -> ()
func.func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!spv.ptr<!spv.struct<a9>, Uniform>)>, Uniform>)>) -> ()
// -----
@ -431,7 +431,7 @@ func private @id_struct_recursive(!spv.struct<a9, (!spv.ptr<!spv.struct<b9, (!sp
// struct a { struct b *bPtr; };
// struct b { struct a *aPtr, struct b *bPtr; };
// CHECK: func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>)
func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>) -> ()
func.func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!spv.ptr<!spv.struct<a10>, Uniform>, !spv.ptr<!spv.struct<b10>, Uniform>)>, Uniform>)>) -> ()
// -----
@ -440,17 +440,17 @@ func private @id_struct_recursive(!spv.struct<a10, (!spv.ptr<!spv.struct<b10, (!
//===----------------------------------------------------------------------===//
// CHECK: func private @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>)
func private @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>) -> ()
func.func private @coop_matrix_type(!spv.coopmatrix<8x16xi32, Subgroup>, !spv.coopmatrix<8x8xf32, Workgroup>) -> ()
// -----
// expected-error @+1 {{expected ','}}
func private @missing_scope(!spv.coopmatrix<8x16xi32>) -> ()
func.func private @missing_scope(!spv.coopmatrix<8x16xi32>) -> ()
// -----
// expected-error @+1 {{expected rows and columns size}}
func private @missing_count(!spv.coopmatrix<8xi32, Subgroup>) -> ()
func.func private @missing_count(!spv.coopmatrix<8xi32, Subgroup>) -> ()
// -----
@ -458,81 +458,81 @@ func private @missing_count(!spv.coopmatrix<8xi32, Subgroup>) -> ()
// Matrix
//===----------------------------------------------------------------------===//
// CHECK: func private @matrix_type(!spv.matrix<2 x vector<2xf16>>)
func private @matrix_type(!spv.matrix<2 x vector<2xf16>>) -> ()
func.func private @matrix_type(!spv.matrix<2 x vector<2xf16>>) -> ()
// -----
// CHECK: func private @matrix_type(!spv.matrix<3 x vector<3xf32>>)
func private @matrix_type(!spv.matrix<3 x vector<3xf32>>) -> ()
func.func private @matrix_type(!spv.matrix<3 x vector<3xf32>>) -> ()
// -----
// CHECK: func private @matrix_type(!spv.matrix<4 x vector<4xf16>>)
func private @matrix_type(!spv.matrix<4 x vector<4xf16>>) -> ()
func.func private @matrix_type(!spv.matrix<4 x vector<4xf16>>) -> ()
// -----
// expected-error @+1 {{matrix is expected to have 2, 3, or 4 columns}}
func private @matrix_invalid_size(!spv.matrix<5 x vector<3xf32>>) -> ()
func.func private @matrix_invalid_size(!spv.matrix<5 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{matrix is expected to have 2, 3, or 4 columns}}
func private @matrix_invalid_size(!spv.matrix<1 x vector<3xf32>>) -> ()
func.func private @matrix_invalid_size(!spv.matrix<1 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{matrix columns size has to be less than or equal to 4 and greater than or equal 2, but found 5}}
func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<5xf32>>) -> ()
func.func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<5xf32>>) -> ()
// -----
// expected-error @+1 {{matrix columns size has to be less than or equal to 4 and greater than or equal 2, but found 1}}
func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<1xf32>>) -> ()
func.func private @matrix_invalid_columns_size(!spv.matrix<3 x vector<1xf32>>) -> ()
// -----
// expected-error @+1 {{expected '<'}}
func private @matrix_invalid_format(!spv.matrix 3 x vector<3xf32>>) -> ()
func.func private @matrix_invalid_format(!spv.matrix 3 x vector<3xf32>>) -> ()
// -----
// expected-error @+1 {{unbalanced ')' character in pretty dialect name}}
func private @matrix_invalid_format(!spv.matrix< 3 x vector<3xf32>) -> ()
func.func private @matrix_invalid_format(!spv.matrix< 3 x vector<3xf32>) -> ()
// -----
// expected-error @+1 {{expected 'x' in dimension list}}
func private @matrix_invalid_format(!spv.matrix<2 vector<3xi32>>) -> ()
func.func private @matrix_invalid_format(!spv.matrix<2 vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got 'i32'}}
func private @matrix_invalid_type(!spv.matrix< 3 x i32>) -> ()
func.func private @matrix_invalid_type(!spv.matrix< 3 x i32>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got '!spv.array<16 x f32>'}}
func private @matrix_invalid_type(!spv.matrix< 3 x !spv.array<16 x f32>>) -> ()
func.func private @matrix_invalid_type(!spv.matrix< 3 x !spv.array<16 x f32>>) -> ()
// -----
// expected-error @+1 {{matrix must be composed using vector type, got '!spv.rtarray<i32>'}}
func private @matrix_invalid_type(!spv.matrix< 3 x !spv.rtarray<i32>>) -> ()
func.func private @matrix_invalid_type(!spv.matrix< 3 x !spv.rtarray<i32>>) -> ()
// -----
// expected-error @+1 {{matrix columns' elements must be of Float type, got 'i32'}}
func private @matrix_invalid_type(!spv.matrix<2 x vector<3xi32>>) -> ()
func.func private @matrix_invalid_type(!spv.matrix<2 x vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{expected single unsigned integer for number of columns}}
func private @matrix_size_type(!spv.matrix< x vector<3xi32>>) -> ()
func.func private @matrix_size_type(!spv.matrix< x vector<3xi32>>) -> ()
// -----
// expected-error @+1 {{expected single unsigned integer for number of columns}}
func private @matrix_size_type(!spv.matrix<2.0 x vector<3xi32>>) -> ()
func.func private @matrix_size_type(!spv.matrix<2.0 x vector<3xi32>>) -> ()
// -----

View File

@ -4,7 +4,7 @@
// spv.AccessChain
//===----------------------------------------------------------------------===//
func @combine_full_access_chain() -> f32 {
func.func @combine_full_access_chain() -> f32 {
// CHECK: %[[INDEX:.*]] = spv.Constant 0
// CHECK-NEXT: %[[VAR:.*]] = spv.Variable
// CHECK-NEXT: %[[PTR:.*]] = spv.AccessChain %[[VAR]][%[[INDEX]], %[[INDEX]], %[[INDEX]]]
@ -19,7 +19,7 @@ func @combine_full_access_chain() -> f32 {
// -----
func @combine_access_chain_multi_use() -> !spv.array<4xf32> {
func.func @combine_access_chain_multi_use() -> !spv.array<4xf32> {
// CHECK: %[[INDEX:.*]] = spv.Constant 0
// CHECK-NEXT: %[[VAR:.*]] = spv.Variable
// CHECK-NEXT: %[[PTR_0:.*]] = spv.AccessChain %[[VAR]][%[[INDEX]], %[[INDEX]]]
@ -38,7 +38,7 @@ func @combine_access_chain_multi_use() -> !spv.array<4xf32> {
// -----
func @dont_combine_access_chain_without_common_base() -> !spv.array<4xi32> {
func.func @dont_combine_access_chain_without_common_base() -> !spv.array<4xi32> {
// CHECK: %[[INDEX:.*]] = spv.Constant 1
// CHECK-NEXT: %[[VAR_0:.*]] = spv.Variable
// CHECK-NEXT: %[[VAR_1:.*]] = spv.Variable
@ -62,7 +62,7 @@ func @dont_combine_access_chain_without_common_base() -> !spv.array<4xi32> {
// spv.Bitcast
//===----------------------------------------------------------------------===//
func @convert_bitcast_full(%arg0 : vector<2xf32>) -> f64 {
func.func @convert_bitcast_full(%arg0 : vector<2xf32>) -> f64 {
// CHECK: %[[RESULT:.*]] = spv.Bitcast {{%.*}} : vector<2xf32> to f64
// CHECK-NEXT: spv.ReturnValue %[[RESULT]]
%0 = spv.Bitcast %arg0 : vector<2xf32> to vector<2xi32>
@ -73,7 +73,7 @@ func @convert_bitcast_full(%arg0 : vector<2xf32>) -> f64 {
// -----
func @convert_bitcast_multi_use(%arg0 : vector<2xf32>, %arg1 : !spv.ptr<i64, Uniform>) -> f64 {
func.func @convert_bitcast_multi_use(%arg0 : vector<2xf32>, %arg1 : !spv.ptr<i64, Uniform>) -> f64 {
// CHECK: %[[RESULT_0:.*]] = spv.Bitcast {{%.*}} : vector<2xf32> to i64
// CHECK-NEXT: %[[RESULT_1:.*]] = spv.Bitcast {{%.*}} : vector<2xf32> to f64
// CHECK-NEXT: spv.Store {{".*"}} {{%.*}}, %[[RESULT_0]]
@ -91,7 +91,7 @@ func @convert_bitcast_multi_use(%arg0 : vector<2xf32>, %arg1 : !spv.ptr<i64, Uni
//===----------------------------------------------------------------------===//
// CHECK-LABEL: extract_vector
func @extract_vector() -> (i32, i32, i32) {
func.func @extract_vector() -> (i32, i32, i32) {
// CHECK-DAG: spv.Constant 6 : i32
// CHECK-DAG: spv.Constant -33 : i32
// CHECK-DAG: spv.Constant 42 : i32
@ -105,7 +105,7 @@ func @extract_vector() -> (i32, i32, i32) {
// -----
// CHECK-LABEL: extract_array_final
func @extract_array_final() -> (i32, i32) {
func.func @extract_array_final() -> (i32, i32) {
// CHECK-DAG: spv.Constant -5 : i32
// CHECK-DAG: spv.Constant 4 : i32
%0 = spv.Constant [dense<[4, -5]> : vector<2xi32>] : !spv.array<1 x vector<2xi32>>
@ -117,7 +117,7 @@ func @extract_array_final() -> (i32, i32) {
// -----
// CHECK-LABEL: extract_array_interm
func @extract_array_interm() -> (vector<2xi32>) {
func.func @extract_array_interm() -> (vector<2xi32>) {
// CHECK: spv.Constant dense<[4, -5]> : vector<2xi32>
%0 = spv.Constant [dense<[4, -5]> : vector<2xi32>] : !spv.array<1 x vector<2xi32>>
%1 = spv.CompositeExtract %0[0 : i32] : !spv.array<1 x vector<2 x i32>>
@ -127,7 +127,7 @@ func @extract_array_interm() -> (vector<2xi32>) {
// -----
// CHECK-LABEL: extract_from_not_constant
func @extract_from_not_constant() -> i32 {
func.func @extract_from_not_constant() -> i32 {
%0 = spv.Variable : !spv.ptr<vector<3xi32>, Function>
%1 = spv.Load "Function" %0 : vector<3xi32>
// CHECK: spv.CompositeExtract
@ -143,7 +143,7 @@ func @extract_from_not_constant() -> i32 {
// TODO: test constants in different blocks
func @deduplicate_scalar_constant() -> (i32, i32) {
func.func @deduplicate_scalar_constant() -> (i32, i32) {
// CHECK: %[[CST:.*]] = spv.Constant 42 : i32
%0 = spv.Constant 42 : i32
%1 = spv.Constant 42 : i32
@ -153,7 +153,7 @@ func @deduplicate_scalar_constant() -> (i32, i32) {
// -----
func @deduplicate_vector_constant() -> (vector<3xi32>, vector<3xi32>) {
func.func @deduplicate_vector_constant() -> (vector<3xi32>, vector<3xi32>) {
// CHECK: %[[CST:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%0 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -163,7 +163,7 @@ func @deduplicate_vector_constant() -> (vector<3xi32>, vector<3xi32>) {
// -----
func @deduplicate_composite_constant() -> (!spv.array<1 x vector<2xi32>>, !spv.array<1 x vector<2xi32>>) {
func.func @deduplicate_composite_constant() -> (!spv.array<1 x vector<2xi32>>, !spv.array<1 x vector<2xi32>>) {
// CHECK: %[[CST:.*]] = spv.Constant [dense<5> : vector<2xi32>] : !spv.array<1 x vector<2xi32>>
%0 = spv.Constant [dense<5> : vector<2xi32>] : !spv.array<1 x vector<2xi32>>
%1 = spv.Constant [dense<5> : vector<2xi32>] : !spv.array<1 x vector<2xi32>>
@ -179,7 +179,7 @@ func @deduplicate_composite_constant() -> (!spv.array<1 x vector<2xi32>>, !spv.a
// CHECK-LABEL: @iadd_zero
// CHECK-SAME: (%[[ARG:.*]]: i32)
func @iadd_zero(%arg0: i32) -> (i32, i32) {
func.func @iadd_zero(%arg0: i32) -> (i32, i32) {
%zero = spv.Constant 0 : i32
%0 = spv.IAdd %arg0, %zero : i32
%1 = spv.IAdd %zero, %arg0 : i32
@ -188,7 +188,7 @@ func @iadd_zero(%arg0: i32) -> (i32, i32) {
}
// CHECK-LABEL: @const_fold_scalar_iadd_normal
func @const_fold_scalar_iadd_normal() -> (i32, i32, i32) {
func.func @const_fold_scalar_iadd_normal() -> (i32, i32, i32) {
%c5 = spv.Constant 5 : i32
%cn8 = spv.Constant -8 : i32
@ -202,7 +202,7 @@ func @const_fold_scalar_iadd_normal() -> (i32, i32, i32) {
}
// CHECK-LABEL: @const_fold_scalar_iadd_flow
func @const_fold_scalar_iadd_flow() -> (i32, i32, i32, i32) {
func.func @const_fold_scalar_iadd_flow() -> (i32, i32, i32, i32) {
%c1 = spv.Constant 1 : i32
%c2 = spv.Constant 2 : i32
%c3 = spv.Constant 4294967295 : i32 // 2^32 - 1: 0xffff ffff
@ -226,7 +226,7 @@ func @const_fold_scalar_iadd_flow() -> (i32, i32, i32, i32) {
}
// CHECK-LABEL: @const_fold_vector_iadd
func @const_fold_vector_iadd() -> vector<3xi32> {
func.func @const_fold_vector_iadd() -> vector<3xi32> {
%vc1 = spv.Constant dense<[42, -55, 127]> : vector<3xi32>
%vc2 = spv.Constant dense<[-3, -15, 28]> : vector<3xi32>
@ -243,7 +243,7 @@ func @const_fold_vector_iadd() -> vector<3xi32> {
// CHECK-LABEL: @imul_zero_one
// CHECK-SAME: (%[[ARG:.*]]: i32)
func @imul_zero_one(%arg0: i32) -> (i32, i32) {
func.func @imul_zero_one(%arg0: i32) -> (i32, i32) {
// CHECK: %[[ZERO:.*]] = spv.Constant 0
%zero = spv.Constant 0 : i32
%one = spv.Constant 1: i32
@ -254,7 +254,7 @@ func @imul_zero_one(%arg0: i32) -> (i32, i32) {
}
// CHECK-LABEL: @const_fold_scalar_imul_normal
func @const_fold_scalar_imul_normal() -> (i32, i32, i32) {
func.func @const_fold_scalar_imul_normal() -> (i32, i32, i32) {
%c5 = spv.Constant 5 : i32
%cn8 = spv.Constant -8 : i32
%c7 = spv.Constant 7 : i32
@ -269,7 +269,7 @@ func @const_fold_scalar_imul_normal() -> (i32, i32, i32) {
}
// CHECK-LABEL: @const_fold_scalar_imul_flow
func @const_fold_scalar_imul_flow() -> (i32, i32, i32) {
func.func @const_fold_scalar_imul_flow() -> (i32, i32, i32) {
%c1 = spv.Constant 2 : i32
%c2 = spv.Constant 4 : i32
%c3 = spv.Constant 4294967295 : i32 // 2^32 - 1 : 0xffff ffff
@ -290,7 +290,7 @@ func @const_fold_scalar_imul_flow() -> (i32, i32, i32) {
// CHECK-LABEL: @const_fold_vector_imul
func @const_fold_vector_imul() -> vector<3xi32> {
func.func @const_fold_vector_imul() -> vector<3xi32> {
%vc1 = spv.Constant dense<[42, -55, 127]> : vector<3xi32>
%vc2 = spv.Constant dense<[-3, -15, 28]> : vector<3xi32>
@ -306,14 +306,14 @@ func @const_fold_vector_imul() -> vector<3xi32> {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: @isub_x_x
func @isub_x_x(%arg0: i32) -> i32 {
func.func @isub_x_x(%arg0: i32) -> i32 {
// CHECK: spv.Constant 0
%0 = spv.ISub %arg0, %arg0: i32
return %0: i32
}
// CHECK-LABEL: @const_fold_scalar_isub_normal
func @const_fold_scalar_isub_normal() -> (i32, i32, i32) {
func.func @const_fold_scalar_isub_normal() -> (i32, i32, i32) {
%c5 = spv.Constant 5 : i32
%cn8 = spv.Constant -8 : i32
%c7 = spv.Constant 7 : i32
@ -328,7 +328,7 @@ func @const_fold_scalar_isub_normal() -> (i32, i32, i32) {
}
// CHECK-LABEL: @const_fold_scalar_isub_flow
func @const_fold_scalar_isub_flow() -> (i32, i32, i32, i32) {
func.func @const_fold_scalar_isub_flow() -> (i32, i32, i32, i32) {
%c1 = spv.Constant 0 : i32
%c2 = spv.Constant 1 : i32
%c3 = spv.Constant 4294967295 : i32 // 2^32 - 1 : 0xffff ffff
@ -352,7 +352,7 @@ func @const_fold_scalar_isub_flow() -> (i32, i32, i32, i32) {
}
// CHECK-LABEL: @const_fold_vector_isub
func @const_fold_vector_isub() -> vector<3xi32> {
func.func @const_fold_vector_isub() -> vector<3xi32> {
%vc1 = spv.Constant dense<[42, -55, 127]> : vector<3xi32>
%vc2 = spv.Constant dense<[-3, -15, 28]> : vector<3xi32>
@ -369,7 +369,7 @@ func @const_fold_vector_isub() -> vector<3xi32> {
// CHECK-LABEL: @convert_logical_and_true_false_scalar
// CHECK-SAME: %[[ARG:.+]]: i1
func @convert_logical_and_true_false_scalar(%arg: i1) -> (i1, i1) {
func.func @convert_logical_and_true_false_scalar(%arg: i1) -> (i1, i1) {
%true = spv.Constant true
// CHECK: %[[FALSE:.+]] = spv.Constant false
%false = spv.Constant false
@ -381,7 +381,7 @@ func @convert_logical_and_true_false_scalar(%arg: i1) -> (i1, i1) {
// CHECK-LABEL: @convert_logical_and_true_false_vector
// CHECK-SAME: %[[ARG:.+]]: vector<3xi1>
func @convert_logical_and_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) {
func.func @convert_logical_and_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) {
%true = spv.Constant dense<true> : vector<3xi1>
// CHECK: %[[FALSE:.+]] = spv.Constant dense<false>
%false = spv.Constant dense<false> : vector<3xi1>
@ -397,7 +397,7 @@ func @convert_logical_and_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>
// spv.LogicalNot
//===----------------------------------------------------------------------===//
func @convert_logical_not_to_not_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> {
func.func @convert_logical_not_to_not_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> {
// CHECK: %[[RESULT:.*]] = spv.INotEqual {{%.*}}, {{%.*}} : vector<3xi64>
// CHECK-NEXT: spv.ReturnValue %[[RESULT]] : vector<3xi1>
%2 = spv.IEqual %arg0, %arg1 : vector<3xi64>
@ -407,7 +407,7 @@ func @convert_logical_not_to_not_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64
// -----
func @convert_logical_not_to_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> {
func.func @convert_logical_not_to_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> {
// CHECK: %[[RESULT:.*]] = spv.IEqual {{%.*}}, {{%.*}} : vector<3xi64>
// CHECK-NEXT: spv.ReturnValue %[[RESULT]] : vector<3xi1>
%2 = spv.INotEqual %arg0, %arg1 : vector<3xi64>
@ -417,7 +417,7 @@ func @convert_logical_not_to_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -
// -----
func @convert_logical_not_parent_multi_use(%arg0: vector<3xi64>, %arg1: vector<3xi64>, %arg2: !spv.ptr<vector<3xi1>, Uniform>) -> vector<3xi1> {
func.func @convert_logical_not_parent_multi_use(%arg0: vector<3xi64>, %arg1: vector<3xi64>, %arg2: !spv.ptr<vector<3xi1>, Uniform>) -> vector<3xi1> {
// CHECK: %[[RESULT_0:.*]] = spv.INotEqual {{%.*}}, {{%.*}} : vector<3xi64>
// CHECK-NEXT: %[[RESULT_1:.*]] = spv.IEqual {{%.*}}, {{%.*}} : vector<3xi64>
// CHECK-NEXT: spv.Store "Uniform" {{%.*}}, %[[RESULT_0]]
@ -430,7 +430,7 @@ func @convert_logical_not_parent_multi_use(%arg0: vector<3xi64>, %arg1: vector<3
// -----
func @convert_logical_not_to_logical_not_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> {
func.func @convert_logical_not_to_logical_not_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> {
// CHECK: %[[RESULT:.*]] = spv.LogicalNotEqual {{%.*}}, {{%.*}} : vector<3xi1>
// CHECK-NEXT: spv.ReturnValue %[[RESULT]] : vector<3xi1>
%2 = spv.LogicalEqual %arg0, %arg1 : vector<3xi1>
@ -440,7 +440,7 @@ func @convert_logical_not_to_logical_not_equal(%arg0: vector<3xi1>, %arg1: vecto
// -----
func @convert_logical_not_to_logical_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> {
func.func @convert_logical_not_to_logical_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> {
// CHECK: %[[RESULT:.*]] = spv.LogicalEqual {{%.*}}, {{%.*}} : vector<3xi1>
// CHECK-NEXT: spv.ReturnValue %[[RESULT]] : vector<3xi1>
%2 = spv.LogicalNotEqual %arg0, %arg1 : vector<3xi1>
@ -456,7 +456,7 @@ func @convert_logical_not_to_logical_equal(%arg0: vector<3xi1>, %arg1: vector<3x
// CHECK-LABEL: @convert_logical_or_true_false_scalar
// CHECK-SAME: %[[ARG:.+]]: i1
func @convert_logical_or_true_false_scalar(%arg: i1) -> (i1, i1) {
func.func @convert_logical_or_true_false_scalar(%arg: i1) -> (i1, i1) {
// CHECK: %[[TRUE:.+]] = spv.Constant true
%true = spv.Constant true
%false = spv.Constant false
@ -468,7 +468,7 @@ func @convert_logical_or_true_false_scalar(%arg: i1) -> (i1, i1) {
// CHECK-LABEL: @convert_logical_or_true_false_vector
// CHECK-SAME: %[[ARG:.+]]: vector<3xi1>
func @convert_logical_or_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) {
func.func @convert_logical_or_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) {
// CHECK: %[[TRUE:.+]] = spv.Constant dense<true>
%true = spv.Constant dense<true> : vector<3xi1>
%false = spv.Constant dense<false> : vector<3xi1>
@ -484,7 +484,7 @@ func @convert_logical_or_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>,
// spv.mlir.selection
//===----------------------------------------------------------------------===//
func @canonicalize_selection_op_scalar_type(%cond: i1) -> () {
func.func @canonicalize_selection_op_scalar_type(%cond: i1) -> () {
%0 = spv.Constant 0: i32
// CHECK-DAG: %[[TRUE_VALUE:.*]] = spv.Constant 1 : i32
%1 = spv.Constant 1: i32
@ -515,7 +515,7 @@ func @canonicalize_selection_op_scalar_type(%cond: i1) -> () {
// -----
func @canonicalize_selection_op_vector_type(%cond: i1) -> () {
func.func @canonicalize_selection_op_vector_type(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
// CHECK-DAG: %[[TRUE_VALUE:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -549,7 +549,7 @@ func @canonicalize_selection_op_vector_type(%cond: i1) -> () {
// CHECK-LABEL: cannot_canonicalize_selection_op_0
// Store to a different variables.
func @cannot_canonicalize_selection_op_0(%cond: i1) -> () {
func.func @cannot_canonicalize_selection_op_0(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_1:.*]] = spv.Constant dense<[2, 3, 4]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_0:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -588,7 +588,7 @@ func @cannot_canonicalize_selection_op_0(%cond: i1) -> () {
// CHECK-LABEL: cannot_canonicalize_selection_op_1
// A conditional block consists of more than 2 operations.
func @cannot_canonicalize_selection_op_1(%cond: i1) -> () {
func.func @cannot_canonicalize_selection_op_1(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_0:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -626,7 +626,7 @@ func @cannot_canonicalize_selection_op_1(%cond: i1) -> () {
// CHECK-LABEL: cannot_canonicalize_selection_op_2
// A control-flow goes into `^then` block from `^else` block.
func @cannot_canonicalize_selection_op_2(%cond: i1) -> () {
func.func @cannot_canonicalize_selection_op_2(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_0:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -660,7 +660,7 @@ func @cannot_canonicalize_selection_op_2(%cond: i1) -> () {
// CHECK-LABEL: cannot_canonicalize_selection_op_3
// `spv.Return` as a block terminator.
func @cannot_canonicalize_selection_op_3(%cond: i1) -> () {
func.func @cannot_canonicalize_selection_op_3(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_0:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
@ -694,7 +694,7 @@ func @cannot_canonicalize_selection_op_3(%cond: i1) -> () {
// CHECK-LABEL: cannot_canonicalize_selection_op_4
// Different memory access attributes.
func @cannot_canonicalize_selection_op_4(%cond: i1) -> () {
func.func @cannot_canonicalize_selection_op_4(%cond: i1) -> () {
%0 = spv.Constant dense<[0, 1, 2]> : vector<3xi32>
// CHECK-DAG: %[[SRC_VALUE_0:.*]] = spv.Constant dense<[1, 2, 3]> : vector<3xi32>
%1 = spv.Constant dense<[1, 2, 3]> : vector<3xi32>

View File

@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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