@@ -88,3 +88,46 @@ void cleanup() {
8888// OGCG: %[[WD:.+]] = alloca %struct.with_dtor
8989// OGCG: call void @_ZN9with_dtorD1Ev(ptr {{.*}} %[[WD]])
9090// OGCG: ret void
91+
92+ void gnu_statement_extension () {
93+ float b = __real__ ({float _Complex a; a;});
94+ }
95+
96+ // CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
97+ // CIR: %[[TMP_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["tmp"]
98+ // CIR: cir.scope {
99+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
100+ // CIR: %[[TMP_A:.*]] = cir.load {{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
101+ // CIR: cir.store {{.*}} %[[TMP_A]], %[[TMP_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
102+ // CIR: }
103+ // CIR: %[[TMP:.*]] = cir.load {{.*}} %[[TMP_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
104+ // CIR: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float
105+ // CIR: cir.store {{.*}} %[[REAL]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
106+
107+ // LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
108+ // LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
109+ // LLVM: %[[TMP_ADDR:.*]] = alloca { float, float }, i64 1, align 4
110+ // LLVM: br label %[[LABEL_1:.*]]
111+ // LLVM: [[LABEL_1]]:
112+ // LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4
113+ // LLVM: store { float, float } %[[TMP_A]], ptr %[[TMP_ADDR]], align 4
114+ // LLVM: br label %[[LABEL_2:.*]]
115+ // LLVM: [[LABEL_2]]:
116+ // LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[TMP_ADDR]], align 4
117+ // LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0
118+ // LLVM: store float %[[REAL]], ptr %[[B_ADDR]], align 4
119+
120+ // OGCG: %[[B_ADDR:.*]] = alloca float, align 4
121+ // OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
122+ // OGCG: %[[TMP_ADDR:.*]] = alloca { float, float }, align 4
123+ // OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
124+ // OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
125+ // OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
126+ // OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
127+ // OGCG: %[[TMP_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[TMP_ADDR]], i32 0, i32 0
128+ // OGCG: %[[TMP_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[TMP_ADDR]], i32 0, i32 1
129+ // OGCG: store float %[[A_REAL]], ptr %[[TMP_REAL_PTR]], align 4
130+ // OGCG: store float %[[A_IMAG]], ptr %[[TMP_IMAG_PTR]], align 4
131+ // OGCG: %[[TMP_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[TMP_ADDR]], i32 0, i32 0
132+ // OGCG: %[[TMP_REAL:.*]] = load float, ptr %[[TMP_REAL_PTR]], align 4
133+ // OGCG: store float %[[TMP_REAL]], ptr %[[B_ADDR]], align 4
0 commit comments