[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:19:57 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:
I'm not sure why here `_Complex _Float16` is invalid, gcc supports it: https://godbolt.org/z/5EYnY6f9z.
cc @zygoloid
https://github.com/llvm/llvm-project/pull/156344
More information about the libc-commits
mailing list