@@ -226,3 +226,26 @@ void foo12() {
226
226
// OGCG: %[[REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 0
227
227
// OGCG: %[[REAL:.*]] = load double, ptr %[[REAL_PTR]], align 8
228
228
// OGCG: store double %[[REAL]], ptr %[[INIT]], align 8
229
+
230
+ void foo13 () {
231
+ double _Complex c;
232
+ double imag = __imag__ c;
233
+ }
234
+
235
+ // CIR: %[[COMPLEX:.*]] = cir.alloca !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>, ["c"]
236
+ // CIR: %[[INIT:.*]] = cir.alloca !cir.double, !cir.ptr<!cir.double>, ["imag", init]
237
+ // CIR: %[[IMAG_PTR:.*]] = cir.complex.imag_ptr %[[COMPLEX]] : !cir.ptr<!cir.complex<!cir.double>> -> !cir.ptr<!cir.double>
238
+ // CIR: %[[IMAG:.*]] = cir.load{{.*}} %[[REAL_PTR]] : !cir.ptr<!cir.double>, !cir.double
239
+ // CIR: cir.store{{.*}} %[[IMAG]], %[[INIT]] : !cir.double, !cir.ptr<!cir.double>
240
+
241
+ // LLVM: %[[COMPLEX:.*]] = alloca { double, double }, i64 1, align 8
242
+ // LLVM: %[[INIT:.*]] = alloca double, i64 1, align 8
243
+ // LLVM: %[[IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 1
244
+ // LLVM: %[[IMAG:.*]] = load double, ptr %[[IMAG_PTR]], align 8
245
+ // LLVM: store double %[[IMAG]], ptr %[[INIT]], align 8
246
+
247
+ // OGCG: %[[COMPLEX:.*]] = alloca { double, double }, align 8
248
+ // OGCG: %[[INIT:.*]] = alloca double, align 8
249
+ // OGCG: %[[IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 1
250
+ // OGCG: %[[IMAG:.*]] = load double, ptr %[[IMAG_PTR]], align 8
251
+ // OGCG: store double %[[IMAG]], ptr %[[INIT]], align 8
0 commit comments