2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) IBM Corporation, 2012
18 * Author: Anton Blanchard <anton@au.ibm.com>
22 * Sparse (as at v0.5.0) gets very, very confused by this file.
23 * Make it a bit simpler for it.
25 #if !defined(__CHECKER__)
28 #define vec_xor(a, b) a ^ b
29 #define vector __attribute__((vector_size(16)))
32 #include <linux/preempt.h>
33 #include <linux/export.h>
34 #include <linux/sched.h>
35 #include <asm/switch_to.h>
37 typedef vector
signed char unative_t
;
40 unative_t *V = (unative_t *)V##_in; \
41 unative_t V##_0, V##_1, V##_2, V##_3
61 V1##_0 = vec_xor(V1##_0, V2##_0); \
62 V1##_1 = vec_xor(V1##_1, V2##_1); \
63 V1##_2 = vec_xor(V1##_2, V2##_2); \
64 V1##_3 = vec_xor(V1##_3, V2##_3); \
67 void xor_altivec_2(unsigned long bytes
, unsigned long *v1_in
,
72 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
75 enable_kernel_altivec();
85 } while (--lines
> 0);
87 disable_kernel_altivec();
90 EXPORT_SYMBOL(xor_altivec_2
);
92 void xor_altivec_3(unsigned long bytes
, unsigned long *v1_in
,
93 unsigned long *v2_in
, unsigned long *v3_in
)
98 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
101 enable_kernel_altivec();
114 } while (--lines
> 0);
116 disable_kernel_altivec();
119 EXPORT_SYMBOL(xor_altivec_3
);
121 void xor_altivec_4(unsigned long bytes
, unsigned long *v1_in
,
122 unsigned long *v2_in
, unsigned long *v3_in
,
123 unsigned long *v4_in
)
129 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
132 enable_kernel_altivec();
148 } while (--lines
> 0);
150 disable_kernel_altivec();
153 EXPORT_SYMBOL(xor_altivec_4
);
155 void xor_altivec_5(unsigned long bytes
, unsigned long *v1_in
,
156 unsigned long *v2_in
, unsigned long *v3_in
,
157 unsigned long *v4_in
, unsigned long *v5_in
)
164 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
167 enable_kernel_altivec();
186 } while (--lines
> 0);
188 disable_kernel_altivec();
191 EXPORT_SYMBOL(xor_altivec_5
);