@@ -534,45 +534,6 @@ void foo8() {
534534// OGCG: store float %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4
535535// OGCG: store float %[[RESULT_IMAG]], ptr %[[A_IMAG_PTR]], align 4
536536
537- #ifndef __cplusplus
538- void foo9 () {
539- float _Complex a;
540- float b;
541- b += a;
542- }
543- #endif
544-
545- // C_CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
546- // C_CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b"]
547- // C_CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
548- // C_CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr<!cir.float>, !cir.float
549- // C_CIR: %[[A_REAL:.*]] = cir.complex.real %[[A_ADDR]] : !cir.complex<!cir.float> -> !cir.float
550- // C_CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[A_ADDR]] : !cir.complex<!cir.float> -> !cir.float
551- // C_CIR: %[[NEW_REAL:.*]] = cir.binop(add, %[[TMP_B]], %[[A_REAL]]) : !cir.float
552- // C_CIR: %[[RESULT:.*]] = cir.complex.create %[[NEW_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex<!cir.float>
553- // C_CIR: %[[RESULT_REAL:.*]] = cir.complex.real %[[RESULT]] : !cir.complex<!cir.float> -> !cir.float
554- // C_CIR: cir.store{{.*}} %[[RESULT_REAL]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
555-
556- // C_LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
557- // C_LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
558- // C_LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4
559- // C_LLVM: %[[TMP_B:.*]] = load float, ptr %[[B_ADDR]], align 4
560- // C_LLVM: %[[A_REAL:.*]] = extractvalue { float, float } %[[TMP_A]], 0
561- // C_LLVM: %[[A_IMAG:.*]] = extractvalue { float, float } %[[TMP_A]], 1
562- // C_LLVM: %[[NEW_REAL:.*]] = fadd float %[[TMP_B]], %[[A_REAL]]
563- // C_LLVM: %[[TMP_RESULT:.*]] = insertvalue { float, float } {{.*}}, float %[[NEW_REAL]], 0
564- // C_LLVM: store float %[[NEW_REAL]], ptr %[[B_ADDR]], align 4
565-
566- // C_OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
567- // C_OGCG: %[[B_ADDR:.*]] = alloca float, align 4
568- // C_OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
569- // C_OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
570- // C_OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
571- // C_OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
572- // C_OGCG: %[[TMP_B:.*]] = load float, ptr %[[B_ADDR]], align 4
573- // C_OGCG: %[[ADD_REAL:.*]] = fadd float %[[TMP_B]], %[[A_REAL]]
574- // C_OGCG: store float %[[ADD_REAL]], ptr %[[B_ADDR]], align 4
575-
576537void foo10 () {
577538 float _Complex a;
578539 float _Complex b;
@@ -612,7 +573,7 @@ void foo10() {
612573// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
613574// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
614575// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
615- // OGCG: %[[RESULT:.*]] = call noundef <2 x float> @__divsc3(float noundef %[[A_REAL]], float noundef %[[A_IMAG]], float noundef %[[B_REAL]], float noundef %[[B_IMAG]])
576+ // OGCG: %[[RESULT:.*]] = call{{.*}} <2 x float> @__divsc3(float noundef %[[A_REAL]], float noundef %[[A_IMAG]], float noundef %[[B_REAL]], float noundef %[[B_IMAG]])
616577// OGCG: store <2 x float> %[[RESULT]], ptr %[[RESULT_ADDR]], align 4
617578// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[RESULT_ADDR]], i32 0, i32 0
618579// OGCG: %[[RESULT_REAL:.*]] = load float, ptr %[[RESULT_REAL_PTR]], align 4
@@ -739,3 +700,42 @@ void foo12() {
739700// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[A_ADDR]], i32 0, i32 1
740701// OGCG: store i32 %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4
741702// OGCG: store i32 %[[RESULT_IMAG]], ptr %[[A_IMAG_PTR]], align 4
703+
704+ #ifndef __cplusplus
705+ void foo9 () {
706+ float _Complex a;
707+ float b;
708+ b += a;
709+ }
710+ #endif
711+
712+ // C_CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
713+ // C_CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b"]
714+ // C_CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
715+ // C_CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr<!cir.float>, !cir.float
716+ // C_CIR: %[[A_REAL:.*]] = cir.complex.real %[[A_ADDR]] : !cir.complex<!cir.float> -> !cir.float
717+ // C_CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[A_ADDR]] : !cir.complex<!cir.float> -> !cir.float
718+ // C_CIR: %[[NEW_REAL:.*]] = cir.binop(add, %[[TMP_B]], %[[A_REAL]]) : !cir.float
719+ // C_CIR: %[[RESULT:.*]] = cir.complex.create %[[NEW_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex<!cir.float>
720+ // C_CIR: %[[RESULT_REAL:.*]] = cir.complex.real %[[RESULT]] : !cir.complex<!cir.float> -> !cir.float
721+ // C_CIR: cir.store{{.*}} %[[RESULT_REAL]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
722+
723+ // C_LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
724+ // C_LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
725+ // C_LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4
726+ // C_LLVM: %[[TMP_B:.*]] = load float, ptr %[[B_ADDR]], align 4
727+ // C_LLVM: %[[A_REAL:.*]] = extractvalue { float, float } %[[TMP_A]], 0
728+ // C_LLVM: %[[A_IMAG:.*]] = extractvalue { float, float } %[[TMP_A]], 1
729+ // C_LLVM: %[[NEW_REAL:.*]] = fadd float %[[TMP_B]], %[[A_REAL]]
730+ // C_LLVM: %[[TMP_RESULT:.*]] = insertvalue { float, float } {{.*}}, float %[[NEW_REAL]], 0
731+ // C_LLVM: store float %[[NEW_REAL]], ptr %[[B_ADDR]], align 4
732+
733+ // C_OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
734+ // C_OGCG: %[[B_ADDR:.*]] = alloca float, align 4
735+ // C_OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
736+ // C_OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
737+ // C_OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
738+ // C_OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
739+ // C_OGCG: %[[TMP_B:.*]] = load float, ptr %[[B_ADDR]], align 4
740+ // C_OGCG: %[[ADD_REAL:.*]] = fadd float %[[TMP_B]], %[[A_REAL]]
741+ // C_OGCG: store float %[[ADD_REAL]], ptr %[[B_ADDR]], align 4
0 commit comments