File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
include/clang/CIR/Dialect/Builder Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
146
146
return getZeroAttr (complexType);
147
147
if (auto arrTy = mlir::dyn_cast<cir::ArrayType>(ty))
148
148
return getZeroAttr (arrTy);
149
+ if (auto vecTy = mlir::dyn_cast<cir::VectorType>(ty))
150
+ return getZeroAttr (vecTy);
149
151
if (auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty))
150
152
return getConstNullPtrAttr (ptrTy);
151
153
if (auto RecordTy = mlir::dyn_cast<cir::RecordType>(ty))
Original file line number Diff line number Diff line change @@ -10,6 +10,27 @@ typedef double vd2 __attribute__((ext_vector_type(2)));
10
10
typedef long vl2 __attribute__ ((ext_vector_type(2 )));
11
11
typedef unsigned short vus2 __attribute__ ((ext_vector_type(2 )));
12
12
13
+ vi4 vec_a;
14
+ // CIR: cir.global external @[[VEC_A:.*]] = #cir.zero : !cir.vector<!s32i x 4>
15
+
16
+ // LLVM: @[[VEC_A:.*]] = global <4 x i32> zeroinitializer
17
+
18
+ vi3 vec_b;
19
+ // CIR: cir.global external @[[VEC_B:.*]] = #cir.zero : !cir.vector<!s32i x 3>
20
+
21
+ // LLVM: @[[VEC_B:.*]] = global <3 x i32> zeroinitializer
22
+
23
+ vi2 vec_c;
24
+ // CIR: cir.global external @[[VEC_C:.*]] = #cir.zero : !cir.vector<!s32i x 2>
25
+
26
+ // LLVM: @[[VEC_C:.*]] = global <2 x i32> zeroinitializer
27
+
28
+ vd2 d;
29
+
30
+ // CIR: cir.global external @[[VEC_D:.*]] = #cir.zero : !cir.vector<!cir.double x 2>
31
+
32
+ // LLVM: @[[VEC_D:.*]] = global <2 x double> zeroinitializer
33
+
13
34
// CIR: cir.func {{@.*vector_int_test.*}}
14
35
// LLVM: define dso_local void {{@.*vector_int_test.*}}
15
36
void vector_int_test (int x) {
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ typedef double vd2 __attribute__((vector_size(16)));
5
5
typedef long long vll2 __attribute__ ((vector_size(16 )));
6
6
typedef unsigned short vus2 __attribute__ ((vector_size(4 )));
7
7
8
+ vi4 vec_a;
9
+ // CHECK: cir.global external @[[VEC_A:.*]] = #cir.zero : !cir.vector<!s32i x 4>
10
+
11
+ vd2 b;
12
+ // CHECK: cir.global external @[[VEC_B:.*]] = #cir.zero : !cir.vector<!cir.double x 2>
13
+
14
+ vll2 c;
15
+ // CHECK: cir.global external @[[VEC_C:.*]] = #cir.zero : !cir.vector<!s64i x 2>
16
+
8
17
void vector_int_test (int x, unsigned short usx) {
9
18
10
19
// Vector constant.
You can’t perform that action at this time.
0 commit comments