[PATCH 05/21] xfree86: Unspecialize gcc variants of unaligned memory access
Adam Jackson
ajax at redhat.com
Tue Jul 22 07:58:57 PDT 2014
Yes yes, very clever, memmove works fine on gcc too, let's just do the
portable thing since none of this is performance code.
Reviewed-by: Julien Cristau <jcristau at debian.org>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
hw/xfree86/common/compiler.h | 69 --------------------------------------------
1 file changed, 69 deletions(-)
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 556fa7f..54ebb73 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -238,73 +238,6 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
#define write_mem_barrier() /* NOP */
#endif
-#ifdef __GNUC__
-
-/* Define some packed structures to use with unaligned accesses */
-
-struct __una_u64 {
- uint64_t x __attribute__ ((packed));
-};
-struct __una_u32 {
- uint32_t x __attribute__ ((packed));
-};
-struct __una_u16 {
- uint16_t x __attribute__ ((packed));
-};
-
-/* Elemental unaligned loads */
-
-static __inline__ uint64_t
-ldq_u(uint64_t * p)
-{
- const struct __una_u64 *ptr = (const struct __una_u64 *) p;
-
- return ptr->x;
-}
-
-static __inline__ uint32_t
-ldl_u(uint32_t * p)
-{
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
-
- return ptr->x;
-}
-
-static __inline__ uint16_t
-ldw_u(uint16_t * p)
-{
- const struct __una_u16 *ptr = (const struct __una_u16 *) p;
-
- return ptr->x;
-}
-
-/* Elemental unaligned stores */
-
-static __inline__ void
-stq_u(uint64_t val, uint64_t * p)
-{
- struct __una_u64 *ptr = (struct __una_u64 *) p;
-
- ptr->x = val;
-}
-
-static __inline__ void
-stl_u(uint32_t val, uint32_t * p)
-{
- struct __una_u32 *ptr = (struct __una_u32 *) p;
-
- ptr->x = val;
-}
-
-static __inline__ void
-stw_u(uint16_t val, uint16_t * p)
-{
- struct __una_u16 *ptr = (struct __una_u16 *) p;
-
- ptr->x = val;
-}
-#else /* !__GNUC__ */
-
#include <string.h> /* needed for memmove */
static __inline__ uint64_t
@@ -358,8 +291,6 @@ stw_u(uint16_t val, uint16_t * p)
memmove(p, &tmp, sizeof(*p));
}
-#endif /* __GNUC__ */
-
#ifdef __GNUC__
#if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
--
1.9.3
More information about the xorg-devel
mailing list