@@ -1160,8 +1160,9 @@ void imag_on_scalar_glvalue() {
11601160
11611161// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
11621162// 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>
11651166
11661167// LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
11671168// LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
@@ -1205,9 +1206,10 @@ void imag_on_scalar_with_type_promotion() {
12051206
12061207// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.f16, !cir.ptr<!cir.f16>, ["a"]
12071208// 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>
12111213
12121214// LLVM: %[[A_ADDR:.*]] = alloca half, i64 1, align 2
12131215// LLVM: %[[B_ADDR:.*]] = alloca half, i64 1, align 2
@@ -1225,8 +1227,8 @@ void imag_on_const_scalar() {
12251227// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
12261228// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
12271229// 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>
12301232
12311233// LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
12321234// LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
0 commit comments