[libc-commits] [libc] [libc] Implement CMPLX related macros (PR #156344)

Connector Switch via libc-commits libc-commits at lists.llvm.org
Tue Sep 2 07:13:10 PDT 2025


================
@@ -19,6 +21,18 @@
 
 // TODO: Add imaginary macros once GCC or Clang support _Imaginary builtin-type.
 
+#define CMPLX(x, y) __builtin_complex((double)(x), (double)(y))
+#define CMPLXF(x, y) __builtin_complex((float)(x), (float)(y))
+#define CMPLXL(x, y) __builtin_complex((long double)(x), (long double)(y))
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+#define CMPLXF16(x, y) __builtin_complex((float16)(x), (float16)(y))
----------------
c8ef wrote:

Using _Complex _Float16 appears to result in an error:

https://github.com/llvm/llvm-project/blob/45dec71725bd57831051c27e43da698c23de1a52/clang/lib/Sema/SemaChecking.cpp#L5554

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


More information about the libc-commits mailing list