@@ -203,3 +203,26 @@ void foo11() {
203203
204204// OGCG: %[[COMPLEX:.*]] = alloca { double, double }, align 8
205205// OGCG: %[[IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 1
206+
207+ void foo12 () {
208+ double _Complex c;
209+ double real = __real__ c;
210+ }
211+
212+ // CIR: %[[COMPLEX:.*]] = cir.alloca !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>, ["c"]
213+ // CIR: %[[INIT:.*]] = cir.alloca !cir.double, !cir.ptr<!cir.double>, ["real", init]
214+ // CIR: %[[REAL_PTR:.*]] = cir.complex.real_ptr %[[COMPLEX]] : !cir.ptr<!cir.complex<!cir.double>> -> !cir.ptr<!cir.double>
215+ // CIR: %[[REAL:.*]] = cir.load{{.*}} %[[REAL_PTR]] : !cir.ptr<!cir.double>, !cir.double
216+ // CIR: cir.store{{.*}} %[[REAL]], %[[INIT]] : !cir.double, !cir.ptr<!cir.double>
217+
218+ // LLVM: %[[COMPLEX:.*]] = alloca { double, double }, i64 1, align 8
219+ // LLVM: %[[INIT:.*]] = alloca double, i64 1, align 8
220+ // LLVM: %[[REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 0
221+ // LLVM: %[[REAL:.*]] = load double, ptr %[[REAL_PTR]], align 8
222+ // LLVM: store double %[[REAL]], ptr %[[INIT]], align 8
223+
224+ // OGCG: %[[COMPLEX:.*]] = alloca { double, double }, align 8
225+ // OGCG: %[[INIT:.*]] = alloca double, align 8
226+ // OGCG: %[[REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 0
227+ // OGCG: %[[REAL:.*]] = load double, ptr %[[REAL_PTR]], align 8
228+ // OGCG: store double %[[REAL]], ptr %[[INIT]], align 8
0 commit comments