[libc-commits] [libc] [libc][NFC] Allow compilation of `memcpy` with `-m32` (PR #93790)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Thu May 30 02:01:30 PDT 2024
https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/93790
None
>From 8bc536686eae167639a6c4b8519562b976a83151 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Thu, 30 May 2024 09:01:04 +0000
Subject: [PATCH] [libc][NFC] Allow compilation of `memcpy` with `-m32`
---
libc/src/string/memory_utils/op_x86.h | 4 ++--
libc/src/string/memory_utils/utils.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index 1afa91f20e659..2d9cebbb0496a 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/properties/architectures.h"
-#if defined(LIBC_TARGET_ARCH_IS_X86_64)
+#if defined(LIBC_TARGET_ARCH_IS_X86)
#include "src/__support/common.h"
#include "src/string/memory_utils/op_builtin.h"
@@ -316,6 +316,6 @@ LIBC_INLINE MemcmpReturnType cmp_neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {
} // namespace LIBC_NAMESPACE::generic
-#endif // LIBC_TARGET_ARCH_IS_X86_64
+#endif // LIBC_TARGET_ARCH_IS_X86
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H
diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h
index b3e1a26ad9961..cb1fd899b6c63 100644
--- a/libc/src/string/memory_utils/utils.h
+++ b/libc/src/string/memory_utils/utils.h
@@ -170,7 +170,7 @@ LIBC_INLINE MemcmpReturnType cmp_uint32_t(uint32_t a, uint32_t b) {
// otherwise. This implements the semantic of 'memcmp' when we know that 'a' and
// 'b' differ.
LIBC_INLINE MemcmpReturnType cmp_neq_uint64_t(uint64_t a, uint64_t b) {
-#if defined(LIBC_TARGET_ARCH_IS_X86_64)
+#if defined(LIBC_TARGET_ARCH_IS_X86)
// On x86, the best strategy would be to use 'INT32_MAX' and 'INT32_MIN' for
// positive and negative value respectively as they are one value apart:
// xor eax, eax <- free
More information about the libc-commits
mailing list