1 /*
2 * Copyright (c) 2024, Alliance for Open Media. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef AOM_AOM_DSP_ARM_AOM_NEON_SVE2_BRIDGE_H_
12 #define AOM_AOM_DSP_ARM_AOM_NEON_SVE2_BRIDGE_H_
13
14 #include <arm_neon_sve_bridge.h>
15
16 #include "config/aom_dsp_rtcd.h"
17 #include "config/aom_config.h"
18
19 // We can access instructions exclusive to the SVE2 instruction set from a
20 // predominantly Neon context by making use of the Neon-SVE bridge intrinsics
21 // to reinterpret Neon vectors as SVE vectors - with the high part of the SVE
22 // vector (if it's longer than 128 bits) being "don't care".
23
24 // While sub-optimal on machines that have SVE vector length > 128-bit - as the
25 // remainder of the vector is unused - this approach is still beneficial when
26 // compared to a Neon-only solution.
27
aom_tbl2_s16(int16x8_t s0,int16x8_t s1,uint16x8_t tbl)28 static INLINE int16x8_t aom_tbl2_s16(int16x8_t s0, int16x8_t s1,
29 uint16x8_t tbl) {
30 svint16x2_t samples = svcreate2_s16(svset_neonq_s16(svundef_s16(), s0),
31 svset_neonq_s16(svundef_s16(), s1));
32 return svget_neonq_s16(
33 svtbl2_s16(samples, svset_neonq_u16(svundef_u16(), tbl)));
34 }
35
36 #endif // AOM_AOM_DSP_ARM_AOM_NEON_SVE2_BRIDGE_H_
37