aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYuanhan Liu2012-11-30 15:10:40 -0600
committerNeilBrown2012-12-13 02:51:04 -0600
commit4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf (patch)
tree6d321f8a55c2cbd8aacb5a24870e6eccc6e37d9f /lib
parent2c935842bdb46f5f557426feb4d2bdfdad1aa5f9 (diff)
downloadkernel-common-4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf.tar.gz
kernel-common-4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf.tar.xz
kernel-common-4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf.zip
lib/raid6: build proper files on corresponding arch
sse and avx2 stuff only exist on x86 arch, and we don't need to build altivec on x86. And we can do that at lib/raid6/Makefile. Proposed-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/raid6/Makefile9
-rw-r--r--lib/raid6/altivec.uc3
-rw-r--r--lib/raid6/mmx.c2
-rw-r--r--lib/raid6/recov_avx2.c4
-rw-r--r--lib/raid6/recov_ssse3.c4
-rw-r--r--lib/raid6/sse1.c2
-rw-r--r--lib/raid6/sse2.c8
-rw-r--r--lib/raid6/test/Makefile23
8 files changed, 28 insertions, 27 deletions
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
index 3430711b9bd..9f7c184725d 100644
--- a/lib/raid6/Makefile
+++ b/lib/raid6/Makefile
@@ -1,8 +1,11 @@
1obj-$(CONFIG_RAID6_PQ) += raid6_pq.o 1obj-$(CONFIG_RAID6_PQ) += raid6_pq.o
2 2
3raid6_pq-y += algos.o recov.o recov_ssse3.o recov_avx2.o tables.o int1.o int2.o int4.o \ 3raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \
4 int8.o int16.o int32.o altivec1.o altivec2.o altivec4.o \ 4 int8.o int16.o int32.o
5 altivec8.o mmx.o sse1.o sse2.o avx2.o 5
6raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o
7raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o
8
6hostprogs-y += mktables 9hostprogs-y += mktables
7 10
8quiet_cmd_unroll = UNROLL $@ 11quiet_cmd_unroll = UNROLL $@
diff --git a/lib/raid6/altivec.uc b/lib/raid6/altivec.uc
index b71012b756f..7cc12b532e9 100644
--- a/lib/raid6/altivec.uc
+++ b/lib/raid6/altivec.uc
@@ -24,13 +24,10 @@
24 24
25#include <linux/raid/pq.h> 25#include <linux/raid/pq.h>
26 26
27#ifdef CONFIG_ALTIVEC
28
29#include <altivec.h> 27#include <altivec.h>
30#ifdef __KERNEL__ 28#ifdef __KERNEL__
31# include <asm/cputable.h> 29# include <asm/cputable.h>
32# include <asm/switch_to.h> 30# include <asm/switch_to.h>
33#endif
34 31
35/* 32/*
36 * This is the C data type to use. We use a vector of 33 * This is the C data type to use. We use a vector of
diff --git a/lib/raid6/mmx.c b/lib/raid6/mmx.c
index 279347f2309..590c71c9e20 100644
--- a/lib/raid6/mmx.c
+++ b/lib/raid6/mmx.c
@@ -16,7 +16,7 @@
16 * MMX implementation of RAID-6 syndrome functions 16 * MMX implementation of RAID-6 syndrome functions
17 */ 17 */
18 18
19#if defined(__i386__) && !defined(__arch_um__) 19#ifdef CONFIG_X86_32
20 20
21#include <linux/raid/pq.h> 21#include <linux/raid/pq.h>
22#include "x86.h" 22#include "x86.h"
diff --git a/lib/raid6/recov_avx2.c b/lib/raid6/recov_avx2.c
index 43a9bab9187..e1eea433a49 100644
--- a/lib/raid6/recov_avx2.c
+++ b/lib/raid6/recov_avx2.c
@@ -8,8 +8,6 @@
8 * of the License. 8 * of the License.
9 */ 9 */
10 10
11#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
12
13#if CONFIG_AS_AVX2 11#if CONFIG_AS_AVX2
14 12
15#include <linux/raid/pq.h> 13#include <linux/raid/pq.h>
@@ -323,5 +321,3 @@ const struct raid6_recov_calls raid6_recov_avx2 = {
323#else 321#else
324#warning "your version of binutils lacks AVX2 support" 322#warning "your version of binutils lacks AVX2 support"
325#endif 323#endif
326
327#endif
diff --git a/lib/raid6/recov_ssse3.c b/lib/raid6/recov_ssse3.c
index ecb710c0b4d..a9168328f03 100644
--- a/lib/raid6/recov_ssse3.c
+++ b/lib/raid6/recov_ssse3.c
@@ -7,8 +7,6 @@
7 * of the License. 7 * of the License.
8 */ 8 */
9 9
10#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
11
12#include <linux/raid/pq.h> 10#include <linux/raid/pq.h>
13#include "x86.h" 11#include "x86.h"
14 12
@@ -332,5 +330,3 @@ const struct raid6_recov_calls raid6_recov_ssse3 = {
332#endif 330#endif
333 .priority = 1, 331 .priority = 1,
334}; 332};
335
336#endif
diff --git a/lib/raid6/sse1.c b/lib/raid6/sse1.c
index 10dd91948c0..f7629713944 100644
--- a/lib/raid6/sse1.c
+++ b/lib/raid6/sse1.c
@@ -21,7 +21,7 @@
21 * worthwhile as a separate implementation. 21 * worthwhile as a separate implementation.
22 */ 22 */
23 23
24#if defined(__i386__) && !defined(__arch_um__) 24#ifdef CONFIG_X86_32
25 25
26#include <linux/raid/pq.h> 26#include <linux/raid/pq.h>
27#include "x86.h" 27#include "x86.h"
diff --git a/lib/raid6/sse2.c b/lib/raid6/sse2.c
index bc2d57daa58..85b82c85f28 100644
--- a/lib/raid6/sse2.c
+++ b/lib/raid6/sse2.c
@@ -17,8 +17,6 @@
17 * 17 *
18 */ 18 */
19 19
20#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
21
22#include <linux/raid/pq.h> 20#include <linux/raid/pq.h>
23#include "x86.h" 21#include "x86.h"
24 22
@@ -159,9 +157,7 @@ const struct raid6_calls raid6_sse2x2 = {
159 1 /* Has cache hints */ 157 1 /* Has cache hints */
160}; 158};
161 159
162#endif 160#ifdef CONFIG_X86_64
163
164#if defined(__x86_64__) && !defined(__arch_um__)
165 161
166/* 162/*
167 * Unrolled-by-4 SSE2 implementation 163 * Unrolled-by-4 SSE2 implementation
@@ -259,4 +255,4 @@ const struct raid6_calls raid6_sse2x4 = {
259 1 /* Has cache hints */ 255 1 /* Has cache hints */
260}; 256};
261 257
262#endif 258#endif /* CONFIG_X86_64 */
diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
index 754cbac0f9f..087332dbf8a 100644
--- a/lib/raid6/test/Makefile
+++ b/lib/raid6/test/Makefile
@@ -10,16 +10,31 @@ LD = ld
10AWK = awk -f 10AWK = awk -f
11AR = ar 11AR = ar
12RANLIB = ranlib 12RANLIB = ranlib
13OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
13 14
14ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) 15ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/)
15ifeq ($(ARCH),i386) 16ifeq ($(ARCH),i386)
16 CFLAGS += -DCONFIG_X86_32 17 CFLAGS += -DCONFIG_X86_32
18 IS_X86 = yes
17endif 19endif
18ifeq ($(ARCH),x86_64) 20ifeq ($(ARCH),x86_64)
19 CFLAGS += -DCONFIG_X86_64 21 CFLAGS += -DCONFIG_X86_64
22 IS_X86 = yes
23endif
24
25ifeq ($(IS_X86),yes)
26 OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o
27 CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \
28 gcc -c -x assembler - >&/dev/null && \
29 rm ./-.o && echo -DCONFIG_AS_AVX2=1)
30else
31 HAS_ALTIVEC := $(shell echo -e '\#include <altivec.h>\nvector int a;' |\
32 gcc -c -x c - >&/dev/null && \
33 rm ./-.o && echo yes)
34 ifeq ($(HAS_ALTIVEC),yes)
35 OBJS += altivec1.o altivec2.o altivec4.o altivec8.o
36 endif
20endif 37endif
21CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1"| gcc -c -x assembler - &&\
22 rm ./-.o && echo -DCONFIG_AS_AVX2=1)
23 38
24.c.o: 39.c.o:
25 $(CC) $(CFLAGS) -c -o $@ $< 40 $(CC) $(CFLAGS) -c -o $@ $<
@@ -32,9 +47,7 @@ CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1"| gcc -c -x assembler - &&\
32 47
33all: raid6.a raid6test 48all: raid6.a raid6test
34 49
35raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o avx2.o \ 50raid6.a: $(OBJS)
36 altivec1.o altivec2.o altivec4.o altivec8.o recov.o recov_ssse3.o recov_avx2.o algos.o \
37 tables.o
38 rm -f $@ 51 rm -f $@
39 $(AR) cq $@ $^ 52 $(AR) cq $@ $^
40 $(RANLIB) $@ 53 $(RANLIB) $@