[libc-commits] [PATCH] D149306: [libc] Support the string conversion methods on the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 27 18:32:19 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG72bfe2c05a09: [libc] Support the string conversion methods on the GPU (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149306/new/

https://reviews.llvm.org/D149306

Files:
  libc/config/gpu/api.td
  libc/config/gpu/entrypoints.txt
  libc/config/gpu/headers.txt
  libc/docs/gpu/support.rst
  libc/include/llvm-libc-types/fenv_t.h
  libc/src/__support/FPUtil/PlatformDefs.h


Index: libc/src/__support/FPUtil/PlatformDefs.h
===================================================================
--- libc/src/__support/FPUtil/PlatformDefs.h
+++ libc/src/__support/FPUtil/PlatformDefs.h
@@ -17,8 +17,9 @@
 
 // https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
 // https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
-#if defined(_WIN32) || defined(__arm__) ||                                     \
-    (defined(__APPLE__) && defined(__aarch64__))
+// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html
+#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) ||               \
+    defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__))
 #define LONG_DOUBLE_IS_DOUBLE
 #endif
 
Index: libc/include/llvm-libc-types/fenv_t.h
===================================================================
--- libc/include/llvm-libc-types/fenv_t.h
+++ libc/include/llvm-libc-types/fenv_t.h
@@ -25,6 +25,10 @@
 } fenv_t;
 #elif defined(__riscv)
 typedef unsigned int fenv_t;
+#elif defined(__AMDGPU__) || defined(__NVPTX__)
+typedef struct {
+  unsigned int __fpc;
+} fenv_t;
 #else
 #error "fenv_t not defined for your platform"
 #endif
Index: libc/docs/gpu/support.rst
===================================================================
--- libc/docs/gpu/support.rst
+++ libc/docs/gpu/support.rst
@@ -85,4 +85,15 @@
 Function Name  Available  RPC Required
 =============  =========  ============
 atoi           |check|
+atof           |check|
+atol           |check|
+atoll          |check|
+atexit         |check|
+strtod         |check|
+strtof         |check|
+strtol         |check|
+strtold        |check|
+strtoll        |check|
+strtoul        |check|
+strtoull       |check|
 =============  =========  ============
Index: libc/config/gpu/headers.txt
===================================================================
--- libc/config/gpu/headers.txt
+++ libc/config/gpu/headers.txt
@@ -1,6 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.ctype
     libc.include.string
+    libc.include.fenv
     libc.include.errno
     libc.include.stdlib
 )
Index: libc/config/gpu/entrypoints.txt
===================================================================
--- libc/config/gpu/entrypoints.txt
+++ libc/config/gpu/entrypoints.txt
@@ -56,7 +56,17 @@
 
     # stdlib.h entrypoints
     libc.src.stdlib.atoi
+    libc.src.stdlib.atof
+    libc.src.stdlib.atol
+    libc.src.stdlib.atoll
     libc.src.stdlib.atexit
+    libc.src.stdlib.strtod
+    libc.src.stdlib.strtof
+    libc.src.stdlib.strtol
+    libc.src.stdlib.strtold
+    libc.src.stdlib.strtoll
+    libc.src.stdlib.strtoul
+    libc.src.stdlib.strtoull
 
     # Only implemented in the test suite
     libc.src.stdlib.malloc
Index: libc/config/gpu/api.td
===================================================================
--- libc/config/gpu/api.td
+++ libc/config/gpu/api.td
@@ -12,3 +12,7 @@
     "__atexithandler_t",
   ];
 }
+
+def FenvAPI: PublicAPI<"fenv.h"> {
+  let Types = ["fenv_t"];
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149306.517766.patch
Type: text/x-patch
Size: 3112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230428/edbffc04/attachment.bin>


More information about the libc-commits mailing list