blob: daf548a667f820fa24ad5b1cfcee7791b97e8a51 [file] [log] [blame]
James Zern9dab3ce2012-12-20 14:46:55 -08001/*
Krishna Rapaka7319db52021-09-28 20:35:29 -07002 * Copyright (c) 2021, Alliance for Open Media. All rights reserved
James Zern9dab3ce2012-12-20 14:46:55 -08003 *
Vibhoothi41c6dd72021-10-12 18:48:26 +00004 * This source code is subject to the terms of the BSD 3-Clause Clear License
5 * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
6 * License was not distributed with this source code in the LICENSE file, you
7 * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the
8 * Alliance for Open Media Patent License 1.0 was not distributed with this
9 * source code in the PATENTS file, you can obtain it at
10 * aomedia.org/license/patent-license/.
James Zern9dab3ce2012-12-20 14:46:55 -080011 */
12
James Zerne1cbb132018-08-22 14:10:36 -070013#ifndef AOM_AOM_PORTS_EMMINTRIN_COMPAT_H_
14#define AOM_AOM_PORTS_EMMINTRIN_COMPAT_H_
James Zern9dab3ce2012-12-20 14:46:55 -080015
16#if defined(__GNUC__) && __GNUC__ < 4
17/* From emmintrin.h (gcc 4.5.3) */
18/* Casts between various SP, DP, INT vector types. Note that these do no
19 conversion of values, they just change the type. */
clang-format05ce8502016-08-10 18:23:43 -070020extern __inline __m128
21 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
22 _mm_castpd_ps(__m128d __A) {
23 return (__m128)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080024}
25
clang-format05ce8502016-08-10 18:23:43 -070026extern __inline __m128i
27 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
28 _mm_castpd_si128(__m128d __A) {
29 return (__m128i)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080030}
31
clang-format05ce8502016-08-10 18:23:43 -070032extern __inline __m128d
33 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
34 _mm_castps_pd(__m128 __A) {
35 return (__m128d)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080036}
37
clang-format05ce8502016-08-10 18:23:43 -070038extern __inline __m128i
39 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
40 _mm_castps_si128(__m128 __A) {
41 return (__m128i)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080042}
43
clang-format05ce8502016-08-10 18:23:43 -070044extern __inline __m128
45 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
46 _mm_castsi128_ps(__m128i __A) {
47 return (__m128)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080048}
49
clang-format05ce8502016-08-10 18:23:43 -070050extern __inline __m128d
51 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
52 _mm_castsi128_pd(__m128i __A) {
53 return (__m128d)__A;
James Zern9dab3ce2012-12-20 14:46:55 -080054}
55#endif
56
James Zerne1cbb132018-08-22 14:10:36 -070057#endif // AOM_AOM_PORTS_EMMINTRIN_COMPAT_H_