@@ -1094,7 +1094,7 @@ void imag_on_non_glvalue() {
10941094// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
10951095// OGCG: store float %[[A_IMAG]], ptr %[[B_ADDR]], align 4
10961096
1097- void real_glvalue () {
1097+ void real_on_scalar_glvalue () {
10981098 float a;
10991099 float b = __real__ a;
11001100}
@@ -1114,7 +1114,7 @@ void real_glvalue() {
11141114// OGCG: %[[TMP_A:.*]] = load float, ptr %[[A_ADDR]], align 4
11151115// OGCG: store float %[[TMP_A]], ptr %[[B_ADDR]], align 4
11161116
1117- void imag_glvalue () {
1117+ void imag_on_scalar_glvalue () {
11181118 float a;
11191119 float b = __imag__ a;
11201120}
@@ -1132,7 +1132,7 @@ void imag_glvalue() {
11321132// OGCG: %[[B_ADDR:.*]] = alloca float, align 4
11331133// OGCG: store float 0.000000e+00, ptr %[[B_ADDR]], align 4
11341134
1135- void real_glvalue_with_type_promotion () {
1135+ void real_on_scalar_with_type_promotion () {
11361136 _Float16 a;
11371137 _Float16 b = __real__ a;
11381138}
@@ -1158,7 +1158,7 @@ void real_glvalue_with_type_promotion() {
11581158// OGCG: %[[TMP_A_F16:.*]] = fptrunc float %[[TMP_A_F32]] to half
11591159// OGCG: store half %[[TMP_A_F16]], ptr %[[B_ADDR]], align 2
11601160
1161- void imagl_glvalue_with_type_promotion () {
1161+ void imag_on_scalar_with_type_promotion () {
11621162 _Float16 a;
11631163 _Float16 b = __imag__ a;
11641164}
@@ -1176,3 +1176,22 @@ void imagl_glvalue_with_type_promotion() {
11761176// OGCG: %[[A_ADDR:.*]] = alloca half, align 2
11771177// OGCG: %[[B_ADDR:.*]] = alloca half, align 2
11781178// OGCG: store half 0xH0000, ptr %[[B_ADDR]], align 2
1179+
1180+ void imag_on_const_scalar () {
1181+ float a;
1182+ float b = __imag__ 1 .0f ;
1183+ }
1184+
1185+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
1186+ // CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
1187+ // CIR: %[[CONST_ONE:.*]] = cir.const #cir.fp<1.000000e+00> : !cir.float
1188+ // CIR: %[[CONST_ZERO:.*]] = cir.const #cir.fp<0.000000e+00> : !cir.float
1189+ // CIR: cir.store{{.*}} %[[CONST_ZERO]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
1190+
1191+ // LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
1192+ // LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
1193+ // LLVM: store float 0.000000e+00, ptr %[[B_ADDR]], align 4
1194+
1195+ // OGCG: %[[A_ADDR:.*]] = alloca float, align 4
1196+ // OGCG: %[[B_ADDR:.*]] = alloca float, align 4
1197+ // OGCG: store float 0.000000e+00, ptr %[[B_ADDR]], align 4
0 commit comments