Skip to content

Commit 94d7f7f

Browse files
committed
Update the test case
1 parent 670aae7 commit 94d7f7f

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

clang/test/CIR/CodeGen/complex-cast.cpp

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -326,28 +326,33 @@ void complex_to_complex_cast() {
326326
// OGCG: store i32 %[[REAL_INT_CAST]], ptr {{.*}}, align 4
327327
// OGCG: store i32 %[[IMAG_INT_CAST]], ptr getelementptr inbounds nuw ({ i32, i32 }, ptr {{.*}}, i32 0, i32 1), align 4
328328

329+
struct CX {
330+
double real;
331+
double imag;
332+
};
329333

330334
void lvalue_to_rvalue_bitcast() {
331-
void *a;
332-
int _Complex b = __builtin_bit_cast(int _Complex, a);
335+
CX a;
336+
double _Complex b = __builtin_bit_cast(double _Complex, a);
333337
}
334338

335-
// CIR-BEFORE: %{{.*}} = cir.cast(bitcast, %{{.*}} : !cir.ptr<!cir.ptr<!void>>), !cir.ptr<!cir.complex<!s32i>>
336-
337-
// CIR-AFTER: %{{.*}} = cir.cast(bitcast, %{{.*}} : !cir.ptr<!cir.ptr<!void>>), !cir.ptr<!cir.complex<!s32i>>
338-
339-
// LLVM: %[[PTR_ADDR:.*]] = alloca ptr, i64 1, align 8
340-
// LLVM: %[[COMPLEX_ADDR:.*]] = alloca { i32, i32 }, i64 1, align 4
341-
// LLVM: %[[PTR_TO_COMPLEX:.*]] = load { i32, i32 }, ptr %[[PTR_ADDR]], align 8
342-
// LLVM: store { i32, i32 } %[[PTR_TO_COMPLEX]], ptr %[[COMPLEX_ADDR]], align 4
343-
344-
// OGCG: %[[A_ADDR:.*]] = alloca ptr, align 8
345-
// OGCG: %[[B_ADDR:.*]] = alloca { i32, i32 }, align 4
346-
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[A_ADDR]], i32 0, i32 0
347-
// OGCG: %[[A_REAL:.*]] = load i32, ptr %[[A_REAL_PTR]], align 8
348-
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[A_ADDR]], i32 0, i32 1
349-
// OGCG: %[[A_IMAG:.*]] = load i32, ptr %[[A_IMAG_PTR]], align 4
350-
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[B_ADDR]], i32 0, i32 0
351-
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[B_ADDR]], i32 0, i32 1
352-
// OGCG: store i32 %[[A_REAL]], ptr %[[B_REAL_PTR]], align 4
353-
// OGCG: store i32 %[[A_IMAG]], ptr %[[B_IMAG_PTR]], align 4
339+
340+
// CIR-BEFORE: %{{.*}} = cir.cast(bitcast, %{{.*}} : !cir.ptr<!rec_CX>), !cir.ptr<!cir.complex<!cir.double>>
341+
342+
// CIR-AFTER: %{{.*}} = cir.cast(bitcast, %{{.*}} : !cir.ptr<!rec_CX>), !cir.ptr<!cir.complex<!cir.double>>
343+
344+
// LLVM: %[[PTR_ADDR:.*]] = alloca %struct.CX, i64 1, align 8
345+
// LLVM: %[[COMPLEX_ADDR:.*]] = alloca { double, double }, i64 1, align 8
346+
// LLVM: %[[PTR_TO_COMPLEX:.*]] = load { double, double }, ptr %[[PTR_ADDR]], align 8
347+
// LLVM: store { double, double } %[[PTR_TO_COMPLEX]], ptr %[[COMPLEX_ADDR]], align 8
348+
349+
// OGCG: %[[A_ADDR:.*]] = alloca %struct.CX, align 8
350+
// OGCG: %[[B_ADDR:.*]] = alloca { double, double }, align 8
351+
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[A_ADDR]], i32 0, i32 0
352+
// OGCG: %[[A_REAL:.*]] = load double, ptr %[[A_REAL_PTR]], align 8
353+
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[A_ADDR]], i32 0, i32 1
354+
// OGCG: %[[A_IMAG:.*]] = load double, ptr %[[A_IMAG_PTR]], align 8
355+
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[B_ADDR]], i32 0, i32 0
356+
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[B_ADDR]], i32 0, i32 1
357+
// OGCG: store double %[[A_REAL]], ptr %[[B_REAL_PTR]], align 8
358+
// OGCG: store double %[[A_IMAG]], ptr %[[B_IMAG_PTR]], align 8

0 commit comments

Comments
 (0)