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 #include <linux/preempt.h>
23 #include <linux/export.h>
24 #include <linux/sched.h>
25 #include <asm/switch_to.h>
27 typedef vector
signed char unative_t
;
30 unative_t *V = (unative_t *)V##_in; \
31 unative_t V##_0, V##_1, V##_2, V##_3
51 V1##_0 = vec_xor(V1##_0, V2##_0); \
52 V1##_1 = vec_xor(V1##_1, V2##_1); \
53 V1##_2 = vec_xor(V1##_2, V2##_2); \
54 V1##_3 = vec_xor(V1##_3, V2##_3); \
57 void xor_altivec_2(unsigned long bytes
, unsigned long *v1_in
,
62 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
65 enable_kernel_altivec();
75 } while (--lines
> 0);
77 disable_kernel_altivec();
80 EXPORT_SYMBOL(xor_altivec_2
);
82 void xor_altivec_3(unsigned long bytes
, unsigned long *v1_in
,
83 unsigned long *v2_in
, unsigned long *v3_in
)
88 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
91 enable_kernel_altivec();
104 } while (--lines
> 0);
106 disable_kernel_altivec();
109 EXPORT_SYMBOL(xor_altivec_3
);
111 void xor_altivec_4(unsigned long bytes
, unsigned long *v1_in
,
112 unsigned long *v2_in
, unsigned long *v3_in
,
113 unsigned long *v4_in
)
119 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
122 enable_kernel_altivec();
138 } while (--lines
> 0);
140 disable_kernel_altivec();
143 EXPORT_SYMBOL(xor_altivec_4
);
145 void xor_altivec_5(unsigned long bytes
, unsigned long *v1_in
,
146 unsigned long *v2_in
, unsigned long *v3_in
,
147 unsigned long *v4_in
, unsigned long *v5_in
)
154 unsigned long lines
= bytes
/ (sizeof(unative_t
)) / 4;
157 enable_kernel_altivec();
176 } while (--lines
> 0);
178 disable_kernel_altivec();
181 EXPORT_SYMBOL(xor_altivec_5
);