blob: 4e6eecd3224631ba23f6e1a7c662a6504d0e0b6a [file] [log] [blame]
Yi Luo0c552df2016-10-24 16:30:55 -07001/*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 *
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.
10 */
11
12#ifndef _AOM_DSP_X86_TXFM_COMMON_INTRIN_H_
13#define _AOM_DSP_X86_TXFM_COMMON_INTRIN_H_
14
15// Note:
16// This header file should be put below any x86 intrinsics head file
17
18static INLINE void storeu_output(const __m128i *poutput, tran_low_t *dst_ptr) {
Sebastien Alaiwan698af562017-10-04 12:23:02 +020019 if (sizeof(tran_low_t) == 4) {
20 const __m128i zero = _mm_setzero_si128();
21 const __m128i sign_bits = _mm_cmplt_epi16(*poutput, zero);
22 __m128i out0 = _mm_unpacklo_epi16(*poutput, sign_bits);
23 __m128i out1 = _mm_unpackhi_epi16(*poutput, sign_bits);
24 _mm_storeu_si128((__m128i *)(dst_ptr), out0);
25 _mm_storeu_si128((__m128i *)(dst_ptr + 4), out1);
26 } else {
27 _mm_storeu_si128((__m128i *)(dst_ptr), *poutput);
28 }
Yi Luo0c552df2016-10-24 16:30:55 -070029}
30
31#endif // _AOM_DSP_X86_TXFM_COMMON_INTRIN_H_