Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Dialect/SPIRV/IR/glsl-ops.mlir
Show First 20 Lines • Show All 359 Lines • ▼ Show 20 Lines | |||||
// ----- | // ----- | ||||
func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () { | func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () { | ||||
// CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32> | // CHECK: spv.GLSL.Fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : vector<3xf32> | ||||
%2 = spv.GLSL.Fma %a, %b, %c : vector<3xf32> | %2 = spv.GLSL.Fma %a, %b, %c : vector<3xf32> | ||||
return | return | ||||
} | } | ||||
// ----- | |||||
//===----------------------------------------------------------------------===// | |||||
// spv.GLSL.FrexpStruct | |||||
//===----------------------------------------------------------------------===// | |||||
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) -> () { | |||||
// 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>) -> () { | |||||
// 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 | |||||
} | |||||
// ----- | |||||
func @frexp_struct_mismatch_type(%arg0 : f32) -> () { | |||||
ergawy: I think this test exercises 2 different error paths at once: (1) the argument is not a floating… | |||||
Actually it is just a lazy copy and past. :) Weiwei-2021: Actually it is just a lazy copy and past. :) | |||||
// 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 | |||||
} | |||||
// ----- | |||||
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 | |||||
} | |||||
// ----- | |||||
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 | |||||
} | |||||
// ----- | |||||
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 | |||||
} |
I think this test exercises 2 different error paths at once: (1) the argument is not a floating point type, and (2) the arity of the argument and the second struct member must match (i.e. either both scalars or both vectors). Can you split this to 2 different cases as such?