Change blend function param order from h,w to w,h
[aom.git] / aom_dsp / x86 / synonyms_avx2.h
blob39f371fc93231e5e0c417c3544de38f89b527482
1 /*
2 * Copyright (c) 2018, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #ifndef AOM_DSP_X86_SYNONYMS_AVX2_H_
13 #define AOM_DSP_X86_SYNONYMS_AVX2_H_
15 #include <immintrin.h>
17 #include "config/aom_config.h"
19 #include "aom/aom_integer.h"
21 /**
22 * Various reusable shorthands for x86 SIMD intrinsics.
24 * Intrinsics prefixed with xx_ operate on or return 128bit XMM registers.
25 * Intrinsics prefixed with yy_ operate on or return 256bit YMM registers.
28 // Loads and stores to do away with the tedium of casting the address
29 // to the right type.
30 static INLINE __m256i yy_load_256(const void *a) {
31 return _mm256_load_si256((const __m256i *)a);
34 static INLINE __m256i yy_loadu_256(const void *a) {
35 return _mm256_loadu_si256((const __m256i *)a);
38 static INLINE void yy_store_256(void *const a, const __m256i v) {
39 _mm256_store_si256((__m256i *)a, v);
42 static INLINE void yy_storeu_256(void *const a, const __m256i v) {
43 _mm256_storeu_si256((__m256i *)a, v);
46 // The _mm256_set1_epi64x() intrinsic is undefined for some Visual Studio
47 // compilers. The following function is equivalent to _mm256_set1_epi64x()
48 // acting on a 32-bit integer.
49 static INLINE __m256i yy_set1_64_from_32i(int32_t a) {
50 #if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900
51 return _mm256_set_epi32(0, a, 0, a, 0, a, 0, a);
52 #else
53 return _mm256_set1_epi64x((uint32_t)a);
54 #endif
57 // Some compilers don't have _mm256_set_m128i defined in immintrin.h. We
58 // therefore define an equivalent function using a different intrinsic.
59 // ([ hi ], [ lo ]) -> [ hi ][ lo ]
60 static INLINE __m256i yy_set_m128i(__m128i hi, __m128i lo) {
61 return _mm256_insertf128_si256(_mm256_castsi128_si256(lo), hi, 1);
64 #endif // AOM_DSP_X86_SYNONYMS_AVX2_H_