xref: /qemu/target/loongarch/vec.h (revision 008a3b16)
1008a3b16SSong Gao /* SPDX-License-Identifier: GPL-2.0-or-later */
2008a3b16SSong Gao /*
3008a3b16SSong Gao  * QEMU LoongArch vector utilitites
4008a3b16SSong Gao  *
5008a3b16SSong Gao  * Copyright (c) 2023 Loongson Technology Corporation Limited
6008a3b16SSong Gao  */
7008a3b16SSong Gao 
8008a3b16SSong Gao #ifndef LOONGARCH_VEC_H
9008a3b16SSong Gao #define LOONGARCH_VEC_H
10008a3b16SSong Gao 
11008a3b16SSong Gao #if HOST_BIG_ENDIAN
12008a3b16SSong Gao #define B(x)  B[(x) ^ 15]
13008a3b16SSong Gao #define H(x)  H[(x) ^ 7]
14008a3b16SSong Gao #define W(x)  W[(x) ^ 3]
15008a3b16SSong Gao #define D(x)  D[(x) ^ 1]
16008a3b16SSong Gao #define UB(x) UB[(x) ^ 15]
17008a3b16SSong Gao #define UH(x) UH[(x) ^ 7]
18008a3b16SSong Gao #define UW(x) UW[(x) ^ 3]
19008a3b16SSong Gao #define UD(x) UD[(x) ^ 1]
20008a3b16SSong Gao #define Q(x)  Q[x]
21008a3b16SSong Gao #else
22008a3b16SSong Gao #define B(x)  B[x]
23008a3b16SSong Gao #define H(x)  H[x]
24008a3b16SSong Gao #define W(x)  W[x]
25008a3b16SSong Gao #define D(x)  D[x]
26008a3b16SSong Gao #define UB(x) UB[x]
27008a3b16SSong Gao #define UH(x) UH[x]
28008a3b16SSong Gao #define UW(x) UW[x]
29008a3b16SSong Gao #define UD(x) UD[x]
30008a3b16SSong Gao #define Q(x)  Q[x]
31008a3b16SSong Gao #endif /* HOST_BIG_ENDIAN */
32008a3b16SSong Gao 
33008a3b16SSong Gao #endif /* LOONGARCH_VEC_H */
34