[libc-commits] [PATCH] D155597: [libc][memfunctions] Explicit error when platform in not supported

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jul 18 09:32:27 PDT 2023


gchatelet updated this revision to Diff 541601.
gchatelet added a comment.

- Add explicit support for AMDGPU


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155597

Files:
  libc/src/string/memory_utils/bcmp_implementations.h
  libc/src/string/memory_utils/memcmp_implementations.h
  libc/src/string/memory_utils/memcpy_implementations.h
  libc/src/string/memory_utils/memmove_implementations.h
  libc/src/string/memory_utils/memset_implementations.h


Index: libc/src/string/memory_utils/memset_implementations.h
===================================================================
--- libc/src/string/memory_utils/memset_implementations.h
+++ libc/src/string/memory_utils/memset_implementations.h
@@ -24,10 +24,11 @@
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memset_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
Index: libc/src/string/memory_utils/memmove_implementations.h
===================================================================
--- libc/src/string/memory_utils/memmove_implementations.h
+++ libc/src/string/memory_utils/memmove_implementations.h
@@ -20,10 +20,11 @@
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memmove_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE inline_memmove_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE inline_memmove_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
Index: libc/src/string/memory_utils/memcpy_implementations.h
===================================================================
--- libc/src/string/memory_utils/memcpy_implementations.h
+++ libc/src/string/memory_utils/memcpy_implementations.h
@@ -28,10 +28,11 @@
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memcpy_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY inline_memcpy_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY inline_memcpy_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
Index: libc/src/string/memory_utils/memcmp_implementations.h
===================================================================
--- libc/src/string/memory_utils/memcmp_implementations.h
+++ libc/src/string/memory_utils/memcmp_implementations.h
@@ -24,10 +24,11 @@
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memcmp_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP inline_memcmp_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP inline_memcmp_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
Index: libc/src/string/memory_utils/bcmp_implementations.h
===================================================================
--- libc/src/string/memory_utils/bcmp_implementations.h
+++ libc/src/string/memory_utils/bcmp_implementations.h
@@ -23,10 +23,11 @@
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/bcmp_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155597.541601.patch
Type: text/x-patch
Size: 4057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230718/ac830718/attachment.bin>


More information about the libc-commits mailing list