Debian Codegraph @

cipher/simd-common-ppc.h

raw
1 /* simd-common-ppc.h - Common macros for PowerPC SIMD code
2 *
3 * Copyright (C) 2024 Jussi Kivilinna <[email protected]>
4 *
5 * This file is part of Libgcrypt.
6 *
7 * Libgcrypt is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * Libgcrypt is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef GCRY_SIMD_COMMON_PPC_H
22 #define GCRY_SIMD_COMMON_PPC_H
23
24 #include <config.h>
25
26 #define memory_barrier_with_vec(a) __asm__("" : "+wa"(a) :: "memory")
27
28 #define clear_vec_regs() __asm__ volatile("xxlxor 0, 0, 0\n" \
29 "xxlxor 1, 1, 1\n" \
30 "xxlxor 2, 2, 2\n" \
31 "xxlxor 3, 3, 3\n" \
32 "xxlxor 4, 4, 4\n" \
33 "xxlxor 5, 5, 5\n" \
34 "xxlxor 6, 6, 6\n" \
35 "xxlxor 7, 7, 7\n" \
36 "xxlxor 8, 8, 8\n" \
37 "xxlxor 9, 9, 9\n" \
38 "xxlxor 10, 10, 10\n" \
39 "xxlxor 11, 11, 11\n" \
40 "xxlxor 12, 12, 12\n" \
41 "xxlxor 13, 13, 13\n" \
42 "xxlxor 32, 32, 32\n" \
43 "xxlxor 33, 33, 33\n" \
44 "xxlxor 34, 34, 34\n" \
45 "xxlxor 35, 35, 35\n" \
46 "xxlxor 36, 36, 36\n" \
47 "xxlxor 37, 37, 37\n" \
48 "xxlxor 38, 38, 38\n" \
49 "xxlxor 39, 39, 39\n" \
50 "xxlxor 40, 40, 40\n" \
51 "xxlxor 41, 41, 41\n" \
52 "xxlxor 42, 42, 42\n" \
53 "xxlxor 43, 43, 43\n" \
54 "xxlxor 44, 44, 44\n" \
55 "xxlxor 45, 45, 45\n" \
56 "xxlxor 46, 46, 46\n" \
57 "xxlxor 47, 47, 47\n" \
58 "xxlxor 48, 48, 48\n" \
59 "xxlxor 49, 49, 49\n" \
60 "xxlxor 50, 50, 50\n" \
61 "xxlxor 51, 51, 51\n" \
62 ::: "vs0", "vs1", "vs2", "vs3", \
63 "vs4", "vs5", "vs6", "vs7", \
64 "vs8", "vs9", "vs10", "vs11", \
65 "vs12", "vs13", \
66 /* vs14-vs31 (f14-f31) are */ \
67 /* ABI callee saved. */ \
68 "vs32", "vs33", "vs34", "vs35", \
69 "vs36", "vs37", "vs38", "vs39", \
70 "vs40", "vs41", "vs42", "vs43", \
71 "vs44", "vs45", "vs46", "vs47", \
72 "vs48", "vs49", "vs50", "vs51", \
73 /* vs52-vs63 (v20-v31) are */ \
74 /* ABI callee saved. */ \
75 "memory")
76
77 #endif /* GCRY_SIMD_COMMON_PPC_H */