xref: /openbmc/linux/arch/x86/crypto/glue_helper-asm-avx2.S (revision d0034a7a4ac7fae708146ac0059b9c47a1543f0d)
1*2874c5fdSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */
2cf1521a1SJussi Kivilinna/*
3cf1521a1SJussi Kivilinna * Shared glue code for 128bit block ciphers, AVX2 assembler macros
4cf1521a1SJussi Kivilinna *
5cf1521a1SJussi Kivilinna * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
6cf1521a1SJussi Kivilinna */
7cf1521a1SJussi Kivilinna
8cf1521a1SJussi Kivilinna#define load_16way(src, x0, x1, x2, x3, x4, x5, x6, x7) \
9cf1521a1SJussi Kivilinna	vmovdqu (0*32)(src), x0; \
10cf1521a1SJussi Kivilinna	vmovdqu (1*32)(src), x1; \
11cf1521a1SJussi Kivilinna	vmovdqu (2*32)(src), x2; \
12cf1521a1SJussi Kivilinna	vmovdqu (3*32)(src), x3; \
13cf1521a1SJussi Kivilinna	vmovdqu (4*32)(src), x4; \
14cf1521a1SJussi Kivilinna	vmovdqu (5*32)(src), x5; \
15cf1521a1SJussi Kivilinna	vmovdqu (6*32)(src), x6; \
16cf1521a1SJussi Kivilinna	vmovdqu (7*32)(src), x7;
17cf1521a1SJussi Kivilinna
18cf1521a1SJussi Kivilinna#define store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7) \
19cf1521a1SJussi Kivilinna	vmovdqu x0, (0*32)(dst); \
20cf1521a1SJussi Kivilinna	vmovdqu x1, (1*32)(dst); \
21cf1521a1SJussi Kivilinna	vmovdqu x2, (2*32)(dst); \
22cf1521a1SJussi Kivilinna	vmovdqu x3, (3*32)(dst); \
23cf1521a1SJussi Kivilinna	vmovdqu x4, (4*32)(dst); \
24cf1521a1SJussi Kivilinna	vmovdqu x5, (5*32)(dst); \
25cf1521a1SJussi Kivilinna	vmovdqu x6, (6*32)(dst); \
26cf1521a1SJussi Kivilinna	vmovdqu x7, (7*32)(dst);
27cf1521a1SJussi Kivilinna
28cf1521a1SJussi Kivilinna#define store_cbc_16way(src, dst, x0, x1, x2, x3, x4, x5, x6, x7, t0) \
29cf1521a1SJussi Kivilinna	vpxor t0, t0, t0; \
30cf1521a1SJussi Kivilinna	vinserti128 $1, (src), t0, t0; \
31cf1521a1SJussi Kivilinna	vpxor t0, x0, x0; \
32cf1521a1SJussi Kivilinna	vpxor (0*32+16)(src), x1, x1; \
33cf1521a1SJussi Kivilinna	vpxor (1*32+16)(src), x2, x2; \
34cf1521a1SJussi Kivilinna	vpxor (2*32+16)(src), x3, x3; \
35cf1521a1SJussi Kivilinna	vpxor (3*32+16)(src), x4, x4; \
36cf1521a1SJussi Kivilinna	vpxor (4*32+16)(src), x5, x5; \
37cf1521a1SJussi Kivilinna	vpxor (5*32+16)(src), x6, x6; \
38cf1521a1SJussi Kivilinna	vpxor (6*32+16)(src), x7, x7; \
39cf1521a1SJussi Kivilinna	store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
40