@@ -83,3 +83,39 @@ void foo3() {
83
83
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[COMPLEX]], i32 0, i32 1
84
84
// OGCG: %[[A_IMAG:.*]] = load double, ptr %[[A_IMAG_PTR]], align 8
85
85
// OGCG: store double %[[A_IMAG]], ptr %[[INIT]], align 8
86
+
87
+ void foo4 () {
88
+ float _Complex a;
89
+ float _Complex b = __builtin_conjf (a);
90
+ }
91
+
92
+ // CIR: %[[COMPLEX:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
93
+ // CIR: %[[RESULT:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init]
94
+ // CIR: %[[TMP:.*]] = cir.load{{.*}} %[[COMPLEX]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
95
+ // CIR: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float
96
+ // CIR: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float
97
+ // CIR: %[[IMAG_MINUS:.*]] = cir.unary(minus, %[[IMAG]]) : !cir.float, !cir.float
98
+ // CIR: %[[RESULT_VAL:.*]] = cir.complex.create %[[REAL]], %[[IMAG_MINUS]] : !cir.float -> !cir.complex<!cir.float>
99
+ // CIR: cir.store{{.*}} %[[RESULT_VAL]], %[[RESULT]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
100
+
101
+ // LLVM: %[[COMPLEX:.*]] = alloca { float, float }, i64 1, align 4
102
+ // LLVM: %[[RESULT:.*]] = alloca { float, float }, i64 1, align 4
103
+ // LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[COMPLEX]], align 4
104
+ // LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0
105
+ // LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1
106
+ // LLVM: %[[IMAG_MINUS:.*]] = fneg float %[[IMAG]]
107
+ // LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL]], 0
108
+ // LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG_MINUS]], 1
109
+ // LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[RESULT]], align 4
110
+
111
+ // OGCG: %[[COMPLEX:.*]] = alloca { float, float }, align 4
112
+ // OGCG: %[[RESULT:.*]] = alloca { float, float }, align 4
113
+ // OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[COMPLEX]], i32 0, i32 0
114
+ // OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4
115
+ // OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[COMPLEX]], i32 0, i32 1
116
+ // OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4
117
+ // OGCG: %[[A_IMAG_MINUS:.*]] = fneg float %[[A_IMAG]]
118
+ // OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[RESULT]], i32 0, i32 0
119
+ // OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[RESULT]], i32 0, i32 1
120
+ // OGCG: store float %[[A_REAL]], ptr %[[RESULT_REAL_PTR]], align 4
121
+ // OGCG: store float %[[A_IMAG_MINUS]], ptr %[[RESULT_IMAG_PTR]], align 4
0 commit comments