24 #if defined(__i386__) && !defined(__arch_um__)
30 extern const struct raid6_mmx_constants {
32 } raid6_mmx_constants;
34 static int raid6_have_sse1_or_mmxext(
void)
45 static void raid6_sse11_gen_syndrome(
int disks,
size_t bytes,
void **
ptrs)
47 u8 **dptr = (
u8 **)ptrs;
57 asm volatile(
"movq %0,%%mm0" : :
"m" (raid6_mmx_constants.x1d));
58 asm volatile(
"pxor %mm5,%mm5");
60 for ( d = 0 ; d <
bytes ; d += 8 ) {
61 asm volatile(
"prefetchnta %0" : :
"m" (dptr[z0][
d]));
62 asm volatile(
"movq %0,%%mm2" : :
"m" (dptr[z0][
d]));
63 asm volatile(
"prefetchnta %0" : :
"m" (dptr[z0-1][
d]));
64 asm volatile(
"movq %mm2,%mm4");
65 asm volatile(
"movq %0,%%mm6" : :
"m" (dptr[z0-1][
d]));
66 for ( z = z0-2 ; z >= 0 ; z-- ) {
67 asm volatile(
"prefetchnta %0" : :
"m" (dptr[z][
d]));
68 asm volatile(
"pcmpgtb %mm4,%mm5");
69 asm volatile(
"paddb %mm4,%mm4");
70 asm volatile(
"pand %mm0,%mm5");
71 asm volatile(
"pxor %mm5,%mm4");
72 asm volatile(
"pxor %mm5,%mm5");
73 asm volatile(
"pxor %mm6,%mm2");
74 asm volatile(
"pxor %mm6,%mm4");
75 asm volatile(
"movq %0,%%mm6" : :
"m" (dptr[z][
d]));
77 asm volatile(
"pcmpgtb %mm4,%mm5");
78 asm volatile(
"paddb %mm4,%mm4");
79 asm volatile(
"pand %mm0,%mm5");
80 asm volatile(
"pxor %mm5,%mm4");
81 asm volatile(
"pxor %mm5,%mm5");
82 asm volatile(
"pxor %mm6,%mm2");
83 asm volatile(
"pxor %mm6,%mm4");
85 asm volatile(
"movntq %%mm2,%0" :
"=m" (p[
d]));
86 asm volatile(
"movntq %%mm4,%0" :
"=m" (q[
d]));
89 asm volatile(
"sfence" : : :
"memory");
94 raid6_sse11_gen_syndrome,
95 raid6_have_sse1_or_mmxext,
103 static void raid6_sse12_gen_syndrome(
int disks,
size_t bytes,
void **ptrs)
105 u8 **dptr = (
u8 **)ptrs;
115 asm volatile(
"movq %0,%%mm0" : :
"m" (raid6_mmx_constants.x1d));
116 asm volatile(
"pxor %mm5,%mm5");
117 asm volatile(
"pxor %mm7,%mm7");
120 for ( d = 0 ; d <
bytes ; d += 16 ) {
121 asm volatile(
"prefetchnta %0" : :
"m" (dptr[z0][
d]));
122 asm volatile(
"movq %0,%%mm2" : :
"m" (dptr[z0][
d]));
123 asm volatile(
"movq %0,%%mm3" : :
"m" (dptr[z0][d+8]));
124 asm volatile(
"movq %mm2,%mm4");
125 asm volatile(
"movq %mm3,%mm6");
126 for ( z = z0-1 ; z >= 0 ; z-- ) {
127 asm volatile(
"prefetchnta %0" : :
"m" (dptr[z][
d]));
128 asm volatile(
"pcmpgtb %mm4,%mm5");
129 asm volatile(
"pcmpgtb %mm6,%mm7");
130 asm volatile(
"paddb %mm4,%mm4");
131 asm volatile(
"paddb %mm6,%mm6");
132 asm volatile(
"pand %mm0,%mm5");
133 asm volatile(
"pand %mm0,%mm7");
134 asm volatile(
"pxor %mm5,%mm4");
135 asm volatile(
"pxor %mm7,%mm6");
136 asm volatile(
"movq %0,%%mm5" : :
"m" (dptr[z][
d]));
137 asm volatile(
"movq %0,%%mm7" : :
"m" (dptr[z][d+8]));
138 asm volatile(
"pxor %mm5,%mm2");
139 asm volatile(
"pxor %mm7,%mm3");
140 asm volatile(
"pxor %mm5,%mm4");
141 asm volatile(
"pxor %mm7,%mm6");
142 asm volatile(
"pxor %mm5,%mm5");
143 asm volatile(
"pxor %mm7,%mm7");
145 asm volatile(
"movntq %%mm2,%0" :
"=m" (p[
d]));
146 asm volatile(
"movntq %%mm3,%0" :
"=m" (p[d+8]));
147 asm volatile(
"movntq %%mm4,%0" :
"=m" (q[
d]));
148 asm volatile(
"movntq %%mm6,%0" :
"=m" (q[d+8]));
151 asm volatile(
"sfence" : ::
"memory");
156 raid6_sse12_gen_syndrome,
157 raid6_have_sse1_or_mmxext,