4
4
// spirv.CompositeConstruct
5
5
//===----------------------------------------------------------------------===//
6
6
7
+ // CHECK-LABEL: func @composite_construct_vector
7
8
func.func @composite_construct_vector (%arg0: f32 , %arg1: f32 , %arg2 : f32 ) -> vector <3 xf32 > {
8
9
// CHECK: spirv.CompositeConstruct {{%.*}}, {{%.*}}, {{%.*}} : (f32, f32, f32) -> vector<3xf32>
9
10
%0 = spirv.CompositeConstruct %arg0 , %arg1 , %arg2 : (f32 , f32 , f32 ) -> vector <3 xf32 >
10
11
return %0: vector <3 xf32 >
11
12
}
12
13
13
- // -----
14
-
14
+ // CHECK-LABEL: func @composite_construct_struct
15
15
func.func @composite_construct_struct (%arg0: vector <3 xf32 >, %arg1: !spirv.array <4 xf32 >, %arg2 : !spirv.struct <(f32 )>) -> !spirv.struct <(vector <3 xf32 >, !spirv.array <4 xf32 >, !spirv.struct <(f32 )>)> {
16
16
// CHECK: spirv.CompositeConstruct
17
17
%0 = spirv.CompositeConstruct %arg0 , %arg1 , %arg2 : (vector <3 xf32 >, !spirv.array <4 xf32 >, !spirv.struct <(f32 )>) -> !spirv.struct <(vector <3 xf32 >, !spirv.array <4 xf32 >, !spirv.struct <(f32 )>)>
18
18
return %0: !spirv.struct <(vector <3 xf32 >, !spirv.array <4 xf32 >, !spirv.struct <(f32 )>)>
19
19
}
20
20
21
- // -----
22
-
23
21
// CHECK-LABEL: func @composite_construct_mixed_scalar_vector
24
22
func.func @composite_construct_mixed_scalar_vector (%arg0: f32 , %arg1: f32 , %arg2 : vector <2 xf32 >) -> vector <4 xf32 > {
25
23
// CHECK: spirv.CompositeConstruct %{{.+}}, %{{.+}}, %{{.+}} : (f32, vector<2xf32>, f32) -> vector<4xf32>
26
24
%0 = spirv.CompositeConstruct %arg0 , %arg2 , %arg1 : (f32 , vector <2 xf32 >, f32 ) -> vector <4 xf32 >
27
25
return %0: vector <4 xf32 >
28
26
}
29
27
30
- // -----
28
+ // CHECK-LABEL: func @composite_construct_coopmatrix_khr
29
+ func.func @composite_construct_coopmatrix_khr (%arg0 : f32 ) -> !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA > {
30
+ // CHECK: spirv.CompositeConstruct {{%.*}} : (f32) -> !spirv.coopmatrix<8x16xf32, Subgroup, MatrixA>
31
+ %0 = spirv.CompositeConstruct %arg0 : (f32 ) -> !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA >
32
+ return %0: !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA >
33
+ }
31
34
32
- func.func @composite_construct_NV.coopmatrix (%arg0 : f32 ) -> !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup > {
35
+ // CHECK-LABEL: func @composite_construct_coopmatrix_nv
36
+ func.func @composite_construct_coopmatrix_nv (%arg0 : f32 ) -> !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup > {
33
37
// CHECK: spirv.CompositeConstruct {{%.*}} : (f32) -> !spirv.NV.coopmatrix<8x16xf32, Subgroup>
34
38
%0 = spirv.CompositeConstruct %arg0 : (f32 ) -> !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup >
35
39
return %0: !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup >
@@ -53,6 +57,24 @@ func.func @composite_construct_invalid_operand_type(%arg0: f32, %arg1: f32, %arg
53
57
54
58
// -----
55
59
60
+ func.func @composite_construct_khr_coopmatrix_incorrect_operand_count (%arg0 : f32 , %arg1 : f32 ) ->
61
+ !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA > {
62
+ // expected-error @+1 {{has incorrect number of operands: expected 1, but provided 2}}
63
+ %0 = spirv.CompositeConstruct %arg0 , %arg1 : (f32 , f32 ) -> !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA >
64
+ return %0: !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixA >
65
+ }
66
+
67
+ // -----
68
+
69
+ func.func @composite_construct_khr_coopmatrix_incorrect_element_type (%arg0 : i32 ) ->
70
+ !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixB > {
71
+ // expected-error @+1 {{operand type mismatch: expected operand type 'f32', but provided 'i32'}}
72
+ %0 = spirv.CompositeConstruct %arg0 : (i32 ) -> !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixB >
73
+ return %0: !spirv.coopmatrix <8 x16 xf32 , Subgroup , MatrixB >
74
+ }
75
+
76
+ // -----
77
+
56
78
func.func @composite_construct_NV.coopmatrix_incorrect_operand_count (%arg0 : f32 , %arg1 : f32 ) -> !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup > {
57
79
// expected-error @+1 {{has incorrect number of operands: expected 1, but provided 2}}
58
80
%0 = spirv.CompositeConstruct %arg0 , %arg1 : (f32 , f32 ) -> !spirv.NV.coopmatrix <8 x16 xf32 , Subgroup >
0 commit comments