diff options
author | Yuanhan Liu <yuanhan.liu@linux.intel.com> | 2012-11-30 16:10:40 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-12-13 03:51:04 -0500 |
commit | 4f8c55c5ad491dbc7b52ce08bb702ca39ce944cf (patch) | |
tree | 6d321f8a55c2cbd8aacb5a24870e6eccc6e37d9f /lib/raid6 | |
parent | 2c935842bdb46f5f557426feb4d2bdfdad1aa5f9 (diff) |
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/raid6')
-rw-r--r-- | lib/raid6/Makefile | 9 | ||||
-rw-r--r-- | lib/raid6/altivec.uc | 3 | ||||
-rw-r--r-- | lib/raid6/mmx.c | 2 | ||||
-rw-r--r-- | lib/raid6/recov_avx2.c | 4 | ||||
-rw-r--r-- | lib/raid6/recov_ssse3.c | 4 | ||||
-rw-r--r-- | lib/raid6/sse1.c | 2 | ||||
-rw-r--r-- | lib/raid6/sse2.c | 8 | ||||
-rw-r--r-- | lib/raid6/test/Makefile | 23 |
8 files changed, 28 insertions, 27 deletions
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile index 3430711b9bdf..9f7c184725d7 100644 --- a/lib/raid6/Makefile +++ b/lib/raid6/Makefile | |||
@@ -1,8 +1,11 @@ | |||
1 | obj-$(CONFIG_RAID6_PQ) += raid6_pq.o | 1 | obj-$(CONFIG_RAID6_PQ) += raid6_pq.o |
2 | 2 | ||
3 | raid6_pq-y += algos.o recov.o recov_ssse3.o recov_avx2.o tables.o int1.o int2.o int4.o \ | 3 | raid6_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 | |
6 | raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o | ||
7 | raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o | ||
8 | |||
6 | hostprogs-y += mktables | 9 | hostprogs-y += mktables |
7 | 10 | ||
8 | quiet_cmd_unroll = UNROLL $@ | 11 | quiet_cmd_unroll = UNROLL $@ |
diff --git a/lib/raid6/altivec.uc b/lib/raid6/altivec.uc index b71012b756f4..7cc12b532e95 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 279347f23094..590c71c9e200 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 43a9bab91879..e1eea433a493 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 ecb710c0b4d9..a9168328f03b 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 10dd91948c07..f76297139445 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 bc2d57daa589..85b82c85f28e 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 754cbac0f9f8..087332dbf8aa 100644 --- a/lib/raid6/test/Makefile +++ b/lib/raid6/test/Makefile | |||
@@ -10,16 +10,31 @@ LD = ld | |||
10 | AWK = awk -f | 10 | AWK = awk -f |
11 | AR = ar | 11 | AR = ar |
12 | RANLIB = ranlib | 12 | RANLIB = ranlib |
13 | OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o | ||
13 | 14 | ||
14 | ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) | 15 | ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) |
15 | ifeq ($(ARCH),i386) | 16 | ifeq ($(ARCH),i386) |
16 | CFLAGS += -DCONFIG_X86_32 | 17 | CFLAGS += -DCONFIG_X86_32 |
18 | IS_X86 = yes | ||
17 | endif | 19 | endif |
18 | ifeq ($(ARCH),x86_64) | 20 | ifeq ($(ARCH),x86_64) |
19 | CFLAGS += -DCONFIG_X86_64 | 21 | CFLAGS += -DCONFIG_X86_64 |
22 | IS_X86 = yes | ||
23 | endif | ||
24 | |||
25 | ifeq ($(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) | ||
30 | else | ||
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 | ||
20 | endif | 37 | endif |
21 | CFLAGS += $(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 | ||
33 | all: raid6.a raid6test | 48 | all: raid6.a raid6test |
34 | 49 | ||
35 | raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o avx2.o \ | 50 | raid6.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) $@ |