target/loongarch: Add LASX data support
[qemu/kevin.git] / target / loongarch / vec.h
blob2f23cae7d7ff5cb8cdddeb591c15e9607f723d18
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * QEMU LoongArch vector utilitites
5 * Copyright (c) 2023 Loongson Technology Corporation Limited
6 */
8 #ifndef LOONGARCH_VEC_H
9 #define LOONGARCH_VEC_H
11 #if HOST_BIG_ENDIAN
12 #define B(x) B[(x) ^ 15]
13 #define H(x) H[(x) ^ 7]
14 #define W(x) W[(x) ^ 3]
15 #define D(x) D[(x) ^ 1]
16 #define UB(x) UB[(x) ^ 15]
17 #define UH(x) UH[(x) ^ 7]
18 #define UW(x) UW[(x) ^ 3]
19 #define UD(x) UD[(x) ^ 1]
20 #define Q(x) Q[x]
21 #else
22 #define B(x) B[x]
23 #define H(x) H[x]
24 #define W(x) W[x]
25 #define D(x) D[x]
26 #define UB(x) UB[x]
27 #define UH(x) UH[x]
28 #define UW(x) UW[x]
29 #define UD(x) UD[x]
30 #define Q(x) Q[x]
31 #endif /* HOST_BIG_ENDIAN */
33 #endif /* LOONGARCH_VEC_H */