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 {
146146 return getZeroAttr (complexType);
147147 if (auto arrTy = mlir::dyn_cast<cir::ArrayType>(ty))
148148 return getZeroAttr (arrTy);
149+ if (auto vecTy = mlir::dyn_cast<cir::VectorType>(ty))
150+ return getZeroAttr (vecTy);
149151 if (auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty))
150152 return getConstNullPtrAttr (ptrTy);
151153 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)));
1010typedef long vl2 __attribute__ ((ext_vector_type(2 )));
1111typedef unsigned short vus2 __attribute__ ((ext_vector_type(2 )));
1212
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+
1334// CIR: cir.func {{@.*vector_int_test.*}}
1435// LLVM: define dso_local void {{@.*vector_int_test.*}}
1536void 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)));
55typedef long long vll2 __attribute__ ((vector_size(16 )));
66typedef unsigned short vus2 __attribute__ ((vector_size(4 )));
77
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+
817void vector_int_test (int x, unsigned short usx) {
918
1019 // Vector constant.
You can’t perform that action at this time.
0 commit comments