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);
79 EXPORT_SYMBOL(xor_altivec_2);
81 void xor_altivec_3(unsigned long bytes, unsigned long *v1_in,
82 unsigned long *v2_in, unsigned long *v3_in)
87 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
90 enable_kernel_altivec();
103 } while (--lines > 0);
107 EXPORT_SYMBOL(xor_altivec_3);
109 void xor_altivec_4(unsigned long bytes, unsigned long *v1_in,
110 unsigned long *v2_in, unsigned long *v3_in,
111 unsigned long *v4_in)
117 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
120 enable_kernel_altivec();
136 } while (--lines > 0);
140 EXPORT_SYMBOL(xor_altivec_4);
142 void xor_altivec_5(unsigned long bytes, unsigned long *v1_in,
143 unsigned long *v2_in, unsigned long *v3_in,
144 unsigned long *v4_in, unsigned long *v5_in)
151 unsigned long lines = bytes / (sizeof(unative_t)) / 4;
154 enable_kernel_altivec();
173 } while (--lines > 0);
177 EXPORT_SYMBOL(xor_altivec_5);