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 6bdbe150c3b3ba9b7ebf3e3d4262cb2092d03138..5a161b11ddf22ad0346ddcc254fbd90bb6405dc6 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 {                                                              \