@@ -390,3 +390,23 @@ void real_on_scalar_glvalue() {
390390// OGCG: %[[B_ADDR:.*]] = alloca float, align 4
391391// OGCG: %[[TMP_A:.*]] = load float, ptr %[[A_ADDR]], align 4
392392// OGCG: store float %[[TMP_A]], ptr %[[B_ADDR]], align 4
393+
394+ void imag_on_scalar_glvalue () {
395+ float a;
396+ float b = __imag__ a;
397+ }
398+
399+ // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a"]
400+ // CIR: %[[B_ADDR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init]
401+ // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.float>, !cir.float
402+ // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.float -> !cir.float
403+ // CIR: cir.store{{.*}} %[[A_IMAG]], %[[B_ADDR]] : !cir.float, !cir.ptr<!cir.float>
404+
405+ // LLVM: %[[A_ADDR:.*]] = alloca float, i64 1, align 4
406+ // LLVM: %[[B_ADDR:.*]] = alloca float, i64 1, align 4
407+ // LLVM: %[[TMP_A:.*]] = load float, ptr %[[A_ADDR]], align 4
408+ // LLVM: store float 0.000000e+00, ptr %[[B_ADDR]], align 4
409+
410+ // OGCG: %[[A_ADDR:.*]] = alloca float, align 4
411+ // OGCG: %[[B_ADDR:.*]] = alloca float, align 4
412+ // OGCG: store float 0.000000e+00, ptr %[[B_ADDR]], align 4
0 commit comments