Skip to content

Commit 3af1d0f

Browse files
committed
Add test case for complex int
1 parent 167ea0d commit 3af1d0f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

clang/test/CIR/CodeGen/complex.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,18 @@ void foo8() {
190190
// OGCG: %[[C_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 1
191191
// OGCG: store double 0.000000e+00, ptr %[[C_REAL_PTR]], align 8
192192
// OGCG: store double 2.000000e+00, ptr %[[C_IMAG_PTR]], align 8
193+
194+
void foo14() {
195+
int _Complex c = 2i;
196+
}
197+
198+
// CIR: %[[COMPLEX:.*]] = cir.const #cir.const_complex<#cir.int<0> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
199+
200+
// LLVM: %[[COMPLEX:.*]] = alloca { i32, i32 }, i64 1, align 4
201+
// LLVM: store { i32, i32 } { i32 0, i32 2 }, ptr %[[COMPLEX]], align 4
202+
203+
// OGCG: %[[COMPLEX:.*]] = alloca { i32, i32 }, align 4
204+
// OGCG: %[[C_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[COMPLEX]], i32 0, i32 0
205+
// OGCG: %[[C_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[COMPLEX]], i32 0, i32 1
206+
// OGCG: store i32 0, ptr %[[C_REAL_PTR]], align 4
207+
// OGCG: store i32 2, ptr %[[C_IMAG_PTR]], align 4

0 commit comments

Comments
 (0)