Small optimization for big-endian (e.g., PowerPC) systems.
authorIan Romanick <idr@us.ibm.com>
Mon, 18 Oct 2004 23:24:51 +0000 (23:24 +0000)
committerIan Romanick <idr@us.ibm.com>
Mon, 18 Oct 2004 23:24:51 +0000 (23:24 +0000)
src/mesa/drivers/dri/common/spantmp2.h

index 6bdbe15..5a161b1 100644 (file)
                                : "=r" (p) : "r" (p) );                 \
        ((GLuint *)rgba)[0] = p;                                         \
     } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+     * rotlwi instruction.  It also produces good code on SPARC.
+     */
+#  define READ_RGBA( rgba, _x, _y )                                    \
+     do {                                                              \
+        GLuint p = *(volatile GLuint *) GET_SRC_PTR(_x, _y);            \
+        GLuint t = p;                                                   \
+        *((uint32_t *) rgba) = (t >> 24) | (p << 8);                    \
+     } while (0)
 # else
 #  define READ_RGBA( rgba, _x, _y )                                    \
      do {                                                              \