From f404ff7b76d70a495d4246851127125a194a1adf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 18 Oct 2004 23:24:51 +0000 Subject: [PATCH] Small optimization for big-endian (e.g., PowerPC) systems. --- src/mesa/drivers/dri/common/spantmp2.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index 6bdbe150c3b..5a161b11ddf 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -115,6 +115,16 @@ : "=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 { \ -- 2.30.2