Use 'packssdw' for loading tran_low_t values
authorJohann <johannkoenig@google.com>
Tue, 14 Feb 2017 22:26:09 +0000 (14:26 -0800)
committerJohann Koenig <johannkoenig@google.com>
Tue, 14 Feb 2017 22:39:49 +0000 (22:39 +0000)
This matches bitdepth_conversion_sse2.asm and produces substantially
better assembly. The old way had lots of 'movzwl' and 'shl' and storing
back to memory before loading into an xmm register.

Change-Id: Ib33e35354dfd691a4f8b1e39f4dbcbb14cd5302b

vpx_dsp/x86/bitdepth_conversion_sse2.h

index bff62a4..c5a29ef 100644 (file)
 #include "vpx/vpx_integer.h"
 #include "vpx_dsp/vpx_dsp_common.h"
 
-// Load 8 16 bit values. If the source is 32 bits then cast down.
-// This does not saturate values. It only truncates.
+// Load 8 16 bit values. If the source is 32 bits then pack down with
+// saturation.
 static INLINE __m128i load_tran_low(const tran_low_t *a) {
 #if CONFIG_VP9_HIGHBITDEPTH
-  return _mm_setr_epi16((int16_t)a[0], (int16_t)a[1], (int16_t)a[2],
-                        (int16_t)a[3], (int16_t)a[4], (int16_t)a[5],
-                        (int16_t)a[6], (int16_t)a[7]);
+  const __m128i a_low = _mm_load_si128((const __m128i *)a);
+  return _mm_packs_epi32(a_low, *(const __m128i *)(a + 4));
 #else
   return _mm_load_si128((const __m128i *)a);
 #endif