@@ -1311,3 +1311,46 @@ void real_on_scalar_from_imag_with_type_promotion() {
13111311// OGCG: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float
13121312// OGCG: %[[A_IMAG_F16:.*]] = fptrunc float %[[A_IMAG_F32]] to half
13131313// OGCG: store half %[[A_IMAG_F16]], ptr %[[B_ADDR]], align 2
1314+
1315+ void complex_type_parameter (float _Complex a) {}
1316+
1317+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a", init]
1318+ // CIR: cir.store %{{.*}}, %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
1319+
1320+ // LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1321+ // LLVM: store { float, float } %{{.*}}, ptr %[[A_ADDR]], align 4
1322+
1323+ // OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
1324+ // OGCG: store <2 x float> %a.coerce, ptr %[[A_ADDR]], align 4
1325+
1326+ void complex_type_argument () {
1327+ float _Complex a;
1328+ complex_type_parameter (a);
1329+ }
1330+
1331+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
1332+ // CIR: %[[ARG_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["coerce"]
1333+ // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
1334+ // CIR: cir.store{{.*}} %[[TMP_A]], %[[ARG_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
1335+ // CIR: %[[TMP_ARG:.*]] = cir.load{{.*}} %[[ARG_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
1336+ // CIR: cir.call @_Z5foo34Cf(%[[TMP_ARG]]) : (!cir.complex<!cir.float>) -> ()
1337+
1338+ // LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1339+ // LLVM: %[[ARG_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1340+ // LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4
1341+ // LLVM: store { float, float } %[[TMP_A]], ptr %[[ARG_ADDR]], align 4
1342+ // LLVM: %[[TMP_ARG:.*]] = load { float, float }, ptr %[[ARG_ADDR]], align 4
1343+ // LLVM: call void @_Z5foo34Cf({ float, float } %[[TMP_ARG]])
1344+
1345+ // OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
1346+ // OGCG: %[[ARG_ADDR:.*]] = alloca { float, float }, align 4
1347+ // OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
1348+ // OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
1349+ // OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
1350+ // OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
1351+ // OGCG: %[[ARG_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[ARG_ADDR]], i32 0, i32 0
1352+ // OGCG: %[[ARG_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[ARG_ADDR]], i32 0, i32 1
1353+ // OGCG: store float %[[A_REAL]], ptr %[[ARG_REAL_PTR]], align 4
1354+ // OGCG: store float %[[A_IMAG]], ptr %[[ARG_IMAG_PTR]], align 4
1355+ // OGCG: %[[TMP_ARG:.*]] = load <2 x float>, ptr %[[ARG_ADDR]], align 4
1356+ // OGCG: call void @_Z5foo34Cf(<2 x float> noundef %[[TMP_ARG]])
0 commit comments