@@ -1311,3 +1311,49 @@ void real_on_scalar_from_imag_with_type_promotion() {
1311
1311
// OGCG: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float
1312
1312
// OGCG: %[[A_IMAG_F16:.*]] = fptrunc float %[[A_IMAG_F32]] to half
1313
1313
// 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
+ // TODO(CIR): the difference between the CIR LLVM and OGCG is because the lack of calling convention lowering,
1321
+ // Test will be updated when that is implemented
1322
+
1323
+ // LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1324
+ // LLVM: store { float, float } %{{.*}}, ptr %[[A_ADDR]], align 4
1325
+
1326
+ // OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
1327
+ // OGCG: store <2 x float> %a.coerce, ptr %[[A_ADDR]], align 4
1328
+
1329
+ void complex_type_argument () {
1330
+ float _Complex a;
1331
+ complex_type_parameter (a);
1332
+ }
1333
+
1334
+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
1335
+ // CIR: %[[ARG_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["coerce"]
1336
+ // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
1337
+ // CIR: cir.store{{.*}} %[[TMP_A]], %[[ARG_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
1338
+ // CIR: %[[TMP_ARG:.*]] = cir.load{{.*}} %[[ARG_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
1339
+ // CIR: cir.call @_Z22complex_type_parameterCf(%[[TMP_ARG]]) : (!cir.complex<!cir.float>) -> ()
1340
+
1341
+ // LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1342
+ // LLVM: %[[ARG_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1343
+ // LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4
1344
+ // LLVM: store { float, float } %[[TMP_A]], ptr %[[ARG_ADDR]], align 4
1345
+ // LLVM: %[[TMP_ARG:.*]] = load { float, float }, ptr %[[ARG_ADDR]], align 4
1346
+ // LLVM: call void @_Z22complex_type_parameterCf({ float, float } %[[TMP_ARG]])
1347
+
1348
+ // OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
1349
+ // OGCG: %[[ARG_ADDR:.*]] = alloca { float, float }, align 4
1350
+ // OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
1351
+ // OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
1352
+ // OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
1353
+ // OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
1354
+ // OGCG: %[[ARG_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[ARG_ADDR]], i32 0, i32 0
1355
+ // OGCG: %[[ARG_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[ARG_ADDR]], i32 0, i32 1
1356
+ // OGCG: store float %[[A_REAL]], ptr %[[ARG_REAL_PTR]], align 4
1357
+ // OGCG: store float %[[A_IMAG]], ptr %[[ARG_IMAG_PTR]], align 4
1358
+ // OGCG: %[[TMP_ARG:.*]] = load <2 x float>, ptr %[[ARG_ADDR]], align 4
1359
+ // OGCG: call void @_Z22complex_type_parameterCf(<2 x float> noundef %[[TMP_ARG]])
0 commit comments