xref: /aosp_15_r20/external/libvpx/vpx_dsp/arm/vpx_neon_sve2_bridge.h (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1 /*
2  *  Copyright (c) 2024 The WebM project authors. 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 VPX_VPX_DSP_ARM_VPX_NEON_SVE2_BRIDGE_H_
12 #define VPX_VPX_DSP_ARM_VPX_NEON_SVE2_BRIDGE_H_
13 
14 #include <arm_neon.h>
15 #include <arm_sve.h>
16 #include <arm_neon_sve_bridge.h>
17 
18 // Some very useful instructions are exclusive to the SVE2 instruction set.
19 // However, we can access these instructions from a predominantly Neon context
20 // by making use of the Neon-SVE bridge intrinsics to reinterpret Neon vectors
21 // as SVE vectors - with the high part of the SVE vector (if it's longer than
22 // 128 bits) being "don't care".
23 
vpx_tbl2_s16(int16x8_t s0,int16x8_t s1,uint16x8_t tbl)24 static INLINE int16x8_t vpx_tbl2_s16(int16x8_t s0, int16x8_t s1,
25                                      uint16x8_t tbl) {
26   svint16x2_t samples = svcreate2_s16(svset_neonq_s16(svundef_s16(), s0),
27                                       svset_neonq_s16(svundef_s16(), s1));
28   return svget_neonq_s16(
29       svtbl2_s16(samples, svset_neonq_u16(svundef_u16(), tbl)));
30 }
31 
32 #endif  // VPX_VPX_DSP_ARM_VPX_NEON_SVE2_BRIDGE_H_
33