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

via libc-commits libc-commits at lists.llvm.org
Mon Sep 1 18:57:49 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))
----------------
lntue wrote:

Can we have tests for float16 and float128 also?

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


More information about the libc-commits mailing list