@@ -1160,8 +1160,9 @@ void imag_on_scalar_glvalue() {
1160
1160
1161
1161
// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
1162
1162
// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
1163
- // CIR: %[[CONST_ZERO:.*]] = cir.const #cir.fp<0.000000e+00> : !cir.float
1164
- // CIR: cir.store{{.*}} %[[CONST_ZERO]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
1163
+ // CIR: %[[TMP_A:.*]] = cir.load %[[A_ADDR]] : !cir.ptr<!cir.float>, !cir.float
1164
+ // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.float -> !cir.float
1165
+ // CIR: cir.store{{.*}} %[[A_IMAG]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
1165
1166
1166
1167
// LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
1167
1168
// LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
@@ -1205,9 +1206,10 @@ void imag_on_scalar_with_type_promotion() {
1205
1206
1206
1207
// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.f16, !cir.ptr<!cir.f16>, ["a"]
1207
1208
// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.f16, !cir.ptr<!cir.f16>, ["b", init]
1208
- // CIR: %[[CONST_ZERO:.*]] = cir.const #cir.fp<0.000000e+00> : !cir.float
1209
- // CIR: %[[CONST_ZERO_F16:.*]] = cir.cast floating %[[CONST_ZERO]] : !cir.float -> !cir.f16
1210
- // CIR: cir.store{{.*}} %[[CONST_ZERO_F16]], %[[B_ADDR]] : !cir.f16, !cir.ptr<!cir.f16>
1209
+ // CIR: %[[TMP_A:.*]] = cir.load %[[A_ADDR]] : !cir.ptr<!cir.f16>, !cir.f16
1210
+ // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.f16 -> !cir.f16
1211
+ // CIR: %[[A_IMAG_F16:.*]] = cir.cast floating %[[A_IMAG]] : !cir.f16 -> !cir.f16
1212
+ // CIR: cir.store{{.*}} %[[A_IMAG_F16]], %[[B_ADDR]] : !cir.f16, !cir.ptr<!cir.f16>
1211
1213
1212
1214
// LLVM: %[[A_ADDR:.*]] = alloca half, i64 1, align 2
1213
1215
// LLVM: %[[B_ADDR:.*]] = alloca half, i64 1, align 2
@@ -1225,8 +1227,8 @@ void imag_on_const_scalar() {
1225
1227
// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
1226
1228
// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
1227
1229
// CIR: %[[CONST_ONE:.*]] = cir.const #cir.fp<1.000000e+00> : !cir.float
1228
- // CIR: %[[CONST_ZERO :.*]] = cir.const # cir.fp<0.000000e+00> : !cir.float
1229
- // CIR: cir.store{{.*}} %[[CONST_ZERO ]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
1230
+ // CIR: %[[CONST_IMAG :.*]] = cir.complex.imag %[[CONST_ONE]] : ! cir.float -> !cir.float
1231
+ // CIR: cir.store{{.*}} %[[CONST_IMAG ]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
1230
1232
1231
1233
// LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
1232
1234
// LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
0 commit comments