1 // SPDX-License-Identifier: GPL-2.0
3 * Optimized xor_block operation for RAID4/5
5 * Copyright IBM Corp. 2016
9 #include <linux/types.h>
10 #include <linux/export.h>
11 #include <linux/raid/xor.h>
14 static void xor_xc_2(unsigned long bytes, unsigned long * __restrict p1,
15 const unsigned long * __restrict p2)
23 "0: xc 0(256,%1),0(%2)\n"
29 "2: xc 0(1,%1),0(%2)\n"
31 : : "d" (bytes), "a" (p1), "a" (p2)
32 : "0", "cc", "memory");
35 static void xor_xc_3(unsigned long bytes, unsigned long * __restrict p1,
36 const unsigned long * __restrict p2,
37 const unsigned long * __restrict p3)
45 "0: xc 0(256,%1),0(%2)\n"
46 " xc 0(256,%1),0(%3)\n"
54 "2: xc 0(1,%1),0(%2)\n"
55 "3: xc 0(1,%1),0(%3)\n"
57 : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3)
58 : : "0", "cc", "memory");
61 static void xor_xc_4(unsigned long bytes, unsigned long * __restrict p1,
62 const unsigned long * __restrict p2,
63 const unsigned long * __restrict p3,
64 const unsigned long * __restrict p4)
72 "0: xc 0(256,%1),0(%2)\n"
73 " xc 0(256,%1),0(%3)\n"
74 " xc 0(256,%1),0(%4)\n"
84 "2: xc 0(1,%1),0(%2)\n"
85 "3: xc 0(1,%1),0(%3)\n"
86 "4: xc 0(1,%1),0(%4)\n"
88 : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4)
89 : : "0", "cc", "memory");
92 static void xor_xc_5(unsigned long bytes, unsigned long * __restrict p1,
93 const unsigned long * __restrict p2,
94 const unsigned long * __restrict p3,
95 const unsigned long * __restrict p4,
96 const unsigned long * __restrict p5)
105 "0: xc 0(256,%1),0(%2)\n"
106 " xc 0(256,%1),0(%3)\n"
107 " xc 0(256,%1),0(%4)\n"
108 " xc 0(256,%1),0(%5)\n"
120 "2: xc 0(1,%1),0(%2)\n"
121 "3: xc 0(1,%1),0(%3)\n"
122 "4: xc 0(1,%1),0(%4)\n"
123 "5: xc 0(1,%1),0(%5)\n"
125 : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4),
127 : : "0", "cc", "memory");
130 struct xor_block_template xor_block_xc = {
137 EXPORT_SYMBOL(xor_block_xc);