[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 16 09:38:22 PDT 2025


================
@@ -176,3 +176,27 @@ void foo7() {
 // OGCG: store float %[[TMP_A]], ptr %[[C_REAL_PTR]], align 4
 // OGCG: store float 2.000000e+00, ptr %[[C_IMAG_PTR]], align 4
 
+void foo9(double r, double i) {
+  double _Complex c = __builtin_complex(r, i);
----------------
andykaylor wrote:

Does `__builtin_complex` also accept integers? If so, add a test case for that.

I believe both arguments (or either) can also be an expression. So a test cases like this would be useful:

```
double _Complex c2 = __builtin_complex(a + b, a * 2.0);
double _Complex c3 = __builtin_complex(a + 1.0, 3.0);
```

https://github.com/llvm/llvm-project/pull/144225


More information about the cfe-commits mailing list