diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2024-05-07 14:26:49 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2024-05-07 14:26:49 +0000 |
commit | a5b7b6ef4f9a056a0edc918f792bb1decb601592 (patch) | |
tree | 7e62d7cf2849865491a35656a2ef0b9af541f3a0 /sys/arch/powerpc | |
parent | 749f1ec339c6cb683670d6a8ac6ff7582c939110 (diff) |
drop the MD byte-swap micro-optimizations on clang architectures
The compiler already translates the generic code into arithmetic
byte-swap instructions or byte-swapping memory load and store
instructions if available on an architecture.
ok deraadt@ guenther@
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/include/endian.h | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/sys/arch/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h index 11ce8200c8c..993a872e839 100644 --- a/sys/arch/powerpc/include/endian.h +++ b/sys/arch/powerpc/include/endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: endian.h,v 1.21 2014/10/22 23:56:47 dlg Exp $ */ +/* $OpenBSD: endian.h,v 1.22 2024/05/07 14:26:48 naddy Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -27,72 +27,6 @@ #ifndef _POWERPC_ENDIAN_H_ #define _POWERPC_ENDIAN_H_ -#ifdef _KERNEL - -static inline __uint16_t -__mswap16(volatile const __uint16_t *m) -{ - __uint16_t v; - - __asm("lhbrx %0, 0, %1" - : "=r" (v) - : "r" (m), "m" (*m)); - - return (v); -} - -static inline __uint32_t -__mswap32(volatile const __uint32_t *m) -{ - __uint32_t v; - - __asm("lwbrx %0, 0, %1" - : "=r" (v) - : "r" (m), "m" (*m)); - - return (v); -} - -static inline __uint64_t -__mswap64(volatile const __uint64_t *m) -{ - __uint32_t *a = (__uint32_t *)m; - __uint64_t v; - - v = (__uint64_t)__mswap32(a + 1) << 32 | - (__uint64_t)__mswap32(a); - - return (v); -} - -static inline void -__swapm16(volatile __uint16_t *m, __uint16_t v) -{ - __asm("sthbrx %1, 0, %2" - : "=m" (*m) - : "r" (v), "r" (m)); -} - -static inline void -__swapm32(volatile __uint32_t *m, __uint32_t v) -{ - __asm("stwbrx %1, 0, %2" - : "=m" (*m) - : "r" (v), "r" (m)); -} - -static inline void -__swapm64(volatile __uint64_t *m, __uint64_t v) -{ - __uint32_t *a = (__uint32_t *)m; - - __swapm32(a + 1, v >> 32); - __swapm32(a, v); -} - -#define __HAVE_MD_SWAPIO -#endif /* _KERNEL */ - #undef _BIG_ENDIAN /* XXX - gcc may define _BIG_ENDIAN too */ #define _BYTE_ORDER _BIG_ENDIAN |