Debian Codegraph @

arch/arm/rsp/rsp.h

raw
1 //
2 // arch/arm/rsp/rsp.h
3 //
4 // Extern declarations for host RSP functions.
5 //
6 // This file is subject to the terms and conditions defined in
7 // 'LICENSE', which is part of this source code package.
8 //
9
10 #ifndef __arch_rsp_h__
11 #define __arch_rsp_h__
12 #include "common.h"
13 #include <arm_neon.h>
14
15 typedef uint16x8_t rsp_vect_t;
16
17 // Loads and shuffles a 16x8 vector according to element.
18 extern const uint8_t shuffle_keys[16][16];
19
20 static inline uint16x8_t rsp_vect_load_and_shuffle_operand(
21 const uint8_t *src, unsigned element) {
22 const uint8x16_t keys = vld1q_u8(shuffle_keys[element]);
23 const uint8x8x2_t packed_operand = vld2_u8(src);
24
25 uint8x8_t operand_lo_8x8 = vtbl2_u8(packed_operand, vget_low_u8(keys));
26 uint8x8_t operand_hi_8x8 = vtbl2_u8(packed_operand, vget_high_u8(keys));
27 uint8x16_t operand = vcombine_u8(operand_lo_8x8, operand_hi_8x8);
28
29 return vreinterpretq_u16_u8(operand);
30 }
31
32 // Loads a vector without shuffling its elements.
33 static inline uint16x8_t rsp_vect_load_unshuffled_operand(const uint8_t *src) {
34 return vreinterpretq_u16_u8(vld1q_u8(src));
35 }
36
37 // Writes an operand back to memory.
38 static inline void rsp_vect_write_operand(uint8_t *dest, uint16x8_t src) {
39 vst1q_u8(dest, vreinterpretq_u8_u16(src));
40 }
41
42 #include "arch/arm/rsp/vand.h"
43 #include "arch/arm/rsp/vnand.h"
44 #include "arch/arm/rsp/vnor.h"
45 #include "arch/arm/rsp/vor.h"
46 #include "arch/arm/rsp/vnxor.h"
47 #include "arch/arm/rsp/vxor.h"
48
49 #endif
50