From 2f3c3d2ba64b60f852b7e54767160cfb87ed3160 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 13 Jan 2014 18:06:53 +0000 Subject: [PATCH] (svn r26256) -Codechange: do not load some data when it is not (often) used later on (MJP) --- src/blitter/32bpp_anim_sse4.cpp | 5 ----- src/blitter/32bpp_sse4.cpp | 5 ----- src/blitter/32bpp_ssse3.cpp | 5 ----- src/blitter/32bpp_ssse3.hpp | 22 +++++++++++----------- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp index 597c632417..e8873d5d37 100644 --- a/src/blitter/32bpp_anim_sse4.cpp +++ b/src/blitter/32bpp_anim_sse4.cpp @@ -50,11 +50,6 @@ inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomL /* Load these variables into register before loop. */ const __m128i a_cm = ALPHA_CONTROL_MASK; const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK; - const __m128i briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK; - const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER; - const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK; - const __m128i ob_mask = OVERBRIGHT_VALUE_MASK; - const __m128i ob_cm = OVERBRIGHT_CONTROL_MASK; const __m128i tr_nom_base = TRANSPARENT_NOM_BASE; for (int y = bp->height; y != 0; y--) { diff --git a/src/blitter/32bpp_sse4.cpp b/src/blitter/32bpp_sse4.cpp index 4feebc2215..619110cb64 100644 --- a/src/blitter/32bpp_sse4.cpp +++ b/src/blitter/32bpp_sse4.cpp @@ -49,11 +49,6 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel /* Load these variables into register before loop. */ const __m128i a_cm = ALPHA_CONTROL_MASK; const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK; - const __m128i briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK; - const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER; - const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK; - const __m128i ob_mask = OVERBRIGHT_VALUE_MASK; - const __m128i ob_cm = OVERBRIGHT_CONTROL_MASK; const __m128i tr_nom_base = TRANSPARENT_NOM_BASE; for (int y = bp->height; y != 0; y--) { diff --git a/src/blitter/32bpp_ssse3.cpp b/src/blitter/32bpp_ssse3.cpp index 1d7e0f0569..9cee7dbf9e 100644 --- a/src/blitter/32bpp_ssse3.cpp +++ b/src/blitter/32bpp_ssse3.cpp @@ -49,11 +49,6 @@ inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel /* Load these variables into register before loop. */ const __m128i a_cm = ALPHA_CONTROL_MASK; const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK; - const __m128i briAB_cm = BRIGHTNESS_LOW_CONTROL_MASK; - const __m128i div_cleaner = BRIGHTNESS_DIV_CLEANER; - const __m128i ob_check = OVERBRIGHT_PRESENCE_MASK; - const __m128i ob_mask = OVERBRIGHT_VALUE_MASK; - const __m128i ob_cm = OVERBRIGHT_CONTROL_MASK; const __m128i tr_nom_base = TRANSPARENT_NOM_BASE; for (int y = bp->height; y != 0; y--) { diff --git a/src/blitter/32bpp_ssse3.hpp b/src/blitter/32bpp_ssse3.hpp index d8d7dd2044..23e6e4878d 100644 --- a/src/blitter/32bpp_ssse3.hpp +++ b/src/blitter/32bpp_ssse3.hpp @@ -37,7 +37,7 @@ __m128i colAB = _mm_unpacklo_epi8(m_colourX2, zero); \ \ __m128i briAB = _mm_cvtsi32_si128(m_brightnessX2); \ - briAB = _mm_shuffle_epi8(briAB, briAB_cm); /* DEFAULT_BRIGHTNESS in 0, 0x00 in 2. */ \ + briAB = _mm_shuffle_epi8(briAB, BRIGHTNESS_LOW_CONTROL_MASK); /* DEFAULT_BRIGHTNESS in 0, 0x00 in 2. */ \ colAB = _mm_mullo_epi16(colAB, briAB); \ __m128i colAB_ob = _mm_srli_epi16(colAB, 8+7); \ colAB = _mm_srli_epi16(colAB, 7); \ @@ -46,19 +46,19 @@ * Maximum for each rgb is 508 => 9 bits. The highest bit tells if there is overbright. * -255 is changed in -256 so we just have to take the 8 lower bits into account. */ \ - colAB = _mm_and_si128(colAB, div_cleaner); \ - colAB_ob = _mm_and_si128(colAB_ob, ob_check); \ - colAB_ob = _mm_mullo_epi16(colAB_ob, ob_mask); \ + colAB = _mm_and_si128(colAB, BRIGHTNESS_DIV_CLEANER); \ + colAB_ob = _mm_and_si128(colAB_ob, OVERBRIGHT_PRESENCE_MASK); \ + colAB_ob = _mm_mullo_epi16(colAB_ob, OVERBRIGHT_VALUE_MASK); \ colAB_ob = _mm_and_si128(colAB_ob, colAB); \ __m128i obAB = _mm_hadd_epi16(_mm_hadd_epi16(colAB_ob, zero), zero); \ \ - obAB = _mm_srli_epi16(obAB, 1); /* Reduce overbright strength. */ \ - obAB = _mm_shuffle_epi8(obAB, ob_cm); \ - __m128i retAB = ob_mask; /* ob_mask is equal to white. */ \ - retAB = _mm_subs_epu16(retAB, colAB); /* (255 - rgb) */ \ - retAB = _mm_mullo_epi16(retAB, obAB); /* ob*(255 - rgb) */ \ - retAB = _mm_srli_epi16(retAB, 8); /* ob*(255 - rgb)/256 */ \ - retAB = _mm_add_epi16(retAB, colAB); /* ob*(255 - rgb)/256 + rgb */ \ + obAB = _mm_srli_epi16(obAB, 1); /* Reduce overbright strength. */ \ + obAB = _mm_shuffle_epi8(obAB, OVERBRIGHT_CONTROL_MASK); \ + __m128i retAB = OVERBRIGHT_VALUE_MASK; /* ob_mask is equal to white. */ \ + retAB = _mm_subs_epu16(retAB, colAB); /* (255 - rgb) */ \ + retAB = _mm_mullo_epi16(retAB, obAB); /* ob*(255 - rgb) */ \ + retAB = _mm_srli_epi16(retAB, 8); /* ob*(255 - rgb)/256 */ \ + retAB = _mm_add_epi16(retAB, colAB); /* ob*(255 - rgb)/256 + rgb */ \ \ m_colourX2 = _mm_packus_epi16(retAB, retAB);