[libc-commits] [libc] [libc] Support basic 'complex.h' functionality on GPUs (PR #189999)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Apr 1 10:01:28 PDT 2026


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/189999

Summary:
This PR adds the basic complex functions needed by some targets. This is
an attempt to provide the standard interface needed by
'https://github.com/llvm/llvm-project/pull/187831'


>From b42b0b4eac4762de1ec8c63892757d81607ab6ac Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 1 Apr 2026 11:58:00 -0500
Subject: [PATCH] [libc] Support basic 'complex.h' functionality on GPUs

Summary:
This PR adds the basic complex functions needed by some targets. This is
an attempt to provide the standard interface needed by
'https://github.com/llvm/llvm-project/pull/187831'
---
 libc/config/gpu/amdgpu/entrypoints.txt | 14 ++++++++++++++
 libc/config/gpu/amdgpu/headers.txt     |  1 +
 libc/config/gpu/nvptx/entrypoints.txt  | 14 ++++++++++++++
 libc/config/gpu/nvptx/headers.txt      |  1 +
 4 files changed, 30 insertions(+)

diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index a80bdeddf8319..40566029c8a42 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -279,6 +279,20 @@ set(TARGET_LIBC_ENTRYPOINTS
 )
 
 set(TARGET_LIBM_ENTRYPOINTS
+    # complex.h entrypoints
+    libc.src.complex.creal
+    libc.src.complex.crealf
+    libc.src.complex.creall
+    libc.src.complex.cimag
+    libc.src.complex.cimagf
+    libc.src.complex.cimagl
+    libc.src.complex.conj
+    libc.src.complex.conjf
+    libc.src.complex.conjl
+    libc.src.complex.cproj
+    libc.src.complex.cprojf
+    libc.src.complex.cprojl
+
     # math.h entrypoints
     libc.src.math.acos
     libc.src.math.acosf
diff --git a/libc/config/gpu/amdgpu/headers.txt b/libc/config/gpu/amdgpu/headers.txt
index fa8ad7c11ba8b..107a019d8cf41 100644
--- a/libc/config/gpu/amdgpu/headers.txt
+++ b/libc/config/gpu/amdgpu/headers.txt
@@ -1,6 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.assert
     libc.include.ctype
+    libc.include.complex
     libc.include.string
     libc.include.strings
     libc.include.signal
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 5fba41d40c7e6..22f2bc849523e 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -279,6 +279,20 @@ set(TARGET_LIBC_ENTRYPOINTS
 )
 
 set(TARGET_LIBM_ENTRYPOINTS
+    # complex.h entrypoints
+    libc.src.complex.creal
+    libc.src.complex.crealf
+    libc.src.complex.creall
+    libc.src.complex.cimag
+    libc.src.complex.cimagf
+    libc.src.complex.cimagl
+    libc.src.complex.conj
+    libc.src.complex.conjf
+    libc.src.complex.conjl
+    libc.src.complex.cproj
+    libc.src.complex.cprojf
+    libc.src.complex.cprojl
+
     # math.h entrypoints
     libc.src.math.acos
     libc.src.math.acosf
diff --git a/libc/config/gpu/nvptx/headers.txt b/libc/config/gpu/nvptx/headers.txt
index fa8ad7c11ba8b..107a019d8cf41 100644
--- a/libc/config/gpu/nvptx/headers.txt
+++ b/libc/config/gpu/nvptx/headers.txt
@@ -1,6 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.assert
     libc.include.ctype
+    libc.include.complex
     libc.include.string
     libc.include.strings
     libc.include.signal



More information about the libc-commits mailing list