xref: /linux/arch/riscv/lib/xor.S (revision 06d07429858317ded2db7986113a9e0129cd599b)
1*c5674d00SGreentime Hu/* SPDX-License-Identifier: GPL-2.0-or-later */
2*c5674d00SGreentime Hu/*
3*c5674d00SGreentime Hu * Copyright (C) 2021 SiFive
4*c5674d00SGreentime Hu */
5*c5674d00SGreentime Hu#include <linux/linkage.h>
6*c5674d00SGreentime Hu#include <linux/export.h>
7*c5674d00SGreentime Hu#include <asm/asm.h>
8*c5674d00SGreentime Hu
9*c5674d00SGreentime HuSYM_FUNC_START(xor_regs_2_)
10*c5674d00SGreentime Hu	vsetvli a3, a0, e8, m8, ta, ma
11*c5674d00SGreentime Hu	vle8.v v0, (a1)
12*c5674d00SGreentime Hu	vle8.v v8, (a2)
13*c5674d00SGreentime Hu	sub a0, a0, a3
14*c5674d00SGreentime Hu	vxor.vv v16, v0, v8
15*c5674d00SGreentime Hu	add a2, a2, a3
16*c5674d00SGreentime Hu	vse8.v v16, (a1)
17*c5674d00SGreentime Hu	add a1, a1, a3
18*c5674d00SGreentime Hu	bnez a0, xor_regs_2_
19*c5674d00SGreentime Hu	ret
20*c5674d00SGreentime HuSYM_FUNC_END(xor_regs_2_)
21*c5674d00SGreentime HuEXPORT_SYMBOL(xor_regs_2_)
22*c5674d00SGreentime Hu
23*c5674d00SGreentime HuSYM_FUNC_START(xor_regs_3_)
24*c5674d00SGreentime Hu	vsetvli a4, a0, e8, m8, ta, ma
25*c5674d00SGreentime Hu	vle8.v v0, (a1)
26*c5674d00SGreentime Hu	vle8.v v8, (a2)
27*c5674d00SGreentime Hu	sub a0, a0, a4
28*c5674d00SGreentime Hu	vxor.vv v0, v0, v8
29*c5674d00SGreentime Hu	vle8.v v16, (a3)
30*c5674d00SGreentime Hu	add a2, a2, a4
31*c5674d00SGreentime Hu	vxor.vv v16, v0, v16
32*c5674d00SGreentime Hu	add a3, a3, a4
33*c5674d00SGreentime Hu	vse8.v v16, (a1)
34*c5674d00SGreentime Hu	add a1, a1, a4
35*c5674d00SGreentime Hu	bnez a0, xor_regs_3_
36*c5674d00SGreentime Hu	ret
37*c5674d00SGreentime HuSYM_FUNC_END(xor_regs_3_)
38*c5674d00SGreentime HuEXPORT_SYMBOL(xor_regs_3_)
39*c5674d00SGreentime Hu
40*c5674d00SGreentime HuSYM_FUNC_START(xor_regs_4_)
41*c5674d00SGreentime Hu	vsetvli a5, a0, e8, m8, ta, ma
42*c5674d00SGreentime Hu	vle8.v v0, (a1)
43*c5674d00SGreentime Hu	vle8.v v8, (a2)
44*c5674d00SGreentime Hu	sub a0, a0, a5
45*c5674d00SGreentime Hu	vxor.vv v0, v0, v8
46*c5674d00SGreentime Hu	vle8.v v16, (a3)
47*c5674d00SGreentime Hu	add a2, a2, a5
48*c5674d00SGreentime Hu	vxor.vv v0, v0, v16
49*c5674d00SGreentime Hu	vle8.v v24, (a4)
50*c5674d00SGreentime Hu	add a3, a3, a5
51*c5674d00SGreentime Hu	vxor.vv v16, v0, v24
52*c5674d00SGreentime Hu	add a4, a4, a5
53*c5674d00SGreentime Hu	vse8.v v16, (a1)
54*c5674d00SGreentime Hu	add a1, a1, a5
55*c5674d00SGreentime Hu	bnez a0, xor_regs_4_
56*c5674d00SGreentime Hu	ret
57*c5674d00SGreentime HuSYM_FUNC_END(xor_regs_4_)
58*c5674d00SGreentime HuEXPORT_SYMBOL(xor_regs_4_)
59*c5674d00SGreentime Hu
60*c5674d00SGreentime HuSYM_FUNC_START(xor_regs_5_)
61*c5674d00SGreentime Hu	vsetvli a6, a0, e8, m8, ta, ma
62*c5674d00SGreentime Hu	vle8.v v0, (a1)
63*c5674d00SGreentime Hu	vle8.v v8, (a2)
64*c5674d00SGreentime Hu	sub a0, a0, a6
65*c5674d00SGreentime Hu	vxor.vv v0, v0, v8
66*c5674d00SGreentime Hu	vle8.v v16, (a3)
67*c5674d00SGreentime Hu	add a2, a2, a6
68*c5674d00SGreentime Hu	vxor.vv v0, v0, v16
69*c5674d00SGreentime Hu	vle8.v v24, (a4)
70*c5674d00SGreentime Hu	add a3, a3, a6
71*c5674d00SGreentime Hu	vxor.vv v0, v0, v24
72*c5674d00SGreentime Hu	vle8.v v8, (a5)
73*c5674d00SGreentime Hu	add a4, a4, a6
74*c5674d00SGreentime Hu	vxor.vv v16, v0, v8
75*c5674d00SGreentime Hu	add a5, a5, a6
76*c5674d00SGreentime Hu	vse8.v v16, (a1)
77*c5674d00SGreentime Hu	add a1, a1, a6
78*c5674d00SGreentime Hu	bnez a0, xor_regs_5_
79*c5674d00SGreentime Hu	ret
80*c5674d00SGreentime HuSYM_FUNC_END(xor_regs_5_)
81*c5674d00SGreentime HuEXPORT_SYMBOL(xor_regs_5_)
82