gfx/2d/SSEHelpers.h
author Cosmin Malutan <cosmin.malutan@softvision.ro>
Mon, 28 Jul 2014 06:28:00 +0200
changeset 208285 1b581df81c9bd32339f3e5c3bb0e8bf11e160132
parent 120461 e89f1fce980d6371c06166cc5558fc63a735554b
child 439782 5f74d262924171a8fa0b4483a64f4cac34c4c9b8
permissions -rw-r--r--
Bug 1032255 - TPS has to exit with code != 0 in case of failures. r=aeftimie, dhunt a=testonly DONTBUILD

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <xmmintrin.h>
#include <emmintrin.h>

/* Before Nehalem _mm_loadu_si128 could be very slow, this trick is a little
 * faster. Once enough people are on architectures where _mm_loadu_si128 is
 * fast we can migrate to it.
 */
MOZ_ALWAYS_INLINE __m128i loadUnaligned128(const __m128i *aSource)
{
  // Yes! We use uninitialized memory here, we'll overwrite it though!
  __m128 res = _mm_loadl_pi(_mm_set1_ps(0), (const __m64*)aSource);
  return _mm_castps_si128(_mm_loadh_pi(res, ((const __m64*)(aSource)) + 1));
}