From: Ian Romanick Date: Mon, 18 Oct 2004 23:24:51 +0000 (+0000) Subject: Small optimization for big-endian (e.g., PowerPC) systems. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f404ff7b76d70a495d4246851127125a194a1adf;p=mesa.git Small optimization for big-endian (e.g., PowerPC) systems. --- 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 { \