xref: /linux/lib/raid/raid6/Makefile (revision 1b78070aaef63512688aebfbc82365ef9d6660f1)
1# SPDX-License-Identifier: GPL-2.0
2
3CONTEXT_ANALYSIS := y
4
5ccflags-y			+= -I $(src)
6
7ifeq ($(CONFIG_RAID6_PQ_ARCH),y)
8CFLAGS_algos.o			+= -I$(src)/$(SRCARCH)
9endif
10
11obj-$(CONFIG_RAID6_PQ)		+= raid6_pq.o tests/
12
13raid6_pq-y			+= algos.o tables.o
14
15# generic integer generation and recovery implementation
16raid6_pq-y			+= int1.o int2.o int4.o int8.o
17raid6_pq-y			+= recov.o
18
19# architecture-specific generation and recovery implementations:
20raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += arm/neon.o \
21				   arm/neon1.o \
22				   arm/neon2.o \
23				   arm/neon4.o \
24				   arm/neon8.o \
25				   arm/recov_neon.o \
26				   arm/recov_neon_inner.o
27raid6_pq-$(CONFIG_LOONGARCH)	+= loongarch/loongarch_simd.o \
28				   loongarch/recov_loongarch_simd.o
29raid6_pq-$(CONFIG_ALTIVEC)	+= powerpc/altivec1.o \
30				   powerpc/altivec2.o \
31				   powerpc/altivec4.o \
32				   powerpc/altivec8.o \
33				   powerpc/vpermxor1.o \
34				   powerpc/vpermxor2.o \
35				   powerpc/vpermxor4.o \
36				   powerpc/vpermxor8.o
37raid6_pq-$(CONFIG_RISCV_ISA_V)	+= riscv/rvv.o \
38				   riscv/recov_rvv.o
39raid6_pq-$(CONFIG_S390)		+= s390/s390vx8.o \
40				   s390/recov_s390xc.o
41ifeq ($(CONFIG_X86),y)
42raid6_pq-$(CONFIG_X86_32)	+= x86/mmx.o \
43				   x86/sse1.o
44endif
45raid6_pq-$(CONFIG_X86)		+= x86/sse2.o \
46				   x86/avx2.o \
47				   x86/avx512.o \
48				   x86/recov_ssse3.o \
49				   x86/recov_avx2.o \
50				   x86/recov_avx512.o
51
52hostprogs			+= mktables
53
54CFLAGS_arm/neon1.o += $(CC_FLAGS_FPU)
55CFLAGS_arm/neon2.o += $(CC_FLAGS_FPU)
56CFLAGS_arm/neon4.o += $(CC_FLAGS_FPU)
57CFLAGS_arm/neon8.o += $(CC_FLAGS_FPU)
58CFLAGS_arm/recov_neon_inner.o += $(CC_FLAGS_FPU)
59CFLAGS_REMOVE_arm/neon1.o += $(CC_FLAGS_NO_FPU)
60CFLAGS_REMOVE_arm/neon2.o += $(CC_FLAGS_NO_FPU)
61CFLAGS_REMOVE_arm/neon4.o += $(CC_FLAGS_NO_FPU)
62CFLAGS_REMOVE_arm/neon8.o += $(CC_FLAGS_NO_FPU)
63CFLAGS_REMOVE_arm/recov_neon_inner.o += $(CC_FLAGS_NO_FPU)
64
65ifeq ($(CONFIG_ALTIVEC),y)
66altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
67# Enable <altivec.h>
68altivec_flags += -isystem $(shell $(CC) -print-file-name=include)
69
70CFLAGS_powerpc/altivec1.o += $(altivec_flags)
71CFLAGS_powerpc/altivec2.o += $(altivec_flags)
72CFLAGS_powerpc/altivec4.o += $(altivec_flags)
73CFLAGS_powerpc/altivec8.o += $(altivec_flags)
74CFLAGS_powerpc/vpermxor1.o += $(altivec_flags)
75CFLAGS_powerpc/vpermxor2.o += $(altivec_flags)
76CFLAGS_powerpc/vpermxor4.o += $(altivec_flags)
77CFLAGS_powerpc/vpermxor8.o += $(altivec_flags)
78
79ifdef CONFIG_CC_IS_CLANG
80# clang ppc port does not yet support -maltivec when -msoft-float is
81# enabled. A future release of clang will resolve this
82# https://llvm.org/pr31177
83CFLAGS_REMOVE_powerpc/altivec1.o  += -msoft-float
84CFLAGS_REMOVE_powerpc/altivec2.o  += -msoft-float
85CFLAGS_REMOVE_powerpc/altivec4.o  += -msoft-float
86CFLAGS_REMOVE_powerpc/altivec8.o  += -msoft-float
87CFLAGS_REMOVE_powerpc/vpermxor1.o += -msoft-float
88CFLAGS_REMOVE_powerpc/vpermxor2.o += -msoft-float
89CFLAGS_REMOVE_powerpc/vpermxor4.o += -msoft-float
90CFLAGS_REMOVE_powerpc/vpermxor8.o += -msoft-float
91endif # CONFIG_CC_IS_CLANG
92endif # CONFIG_ALTIVEC
93
94quiet_cmd_mktable = TABLE   $@
95      cmd_mktable = $(obj)/mktables > $@
96
97targets += tables.c
98$(obj)/tables.c: $(obj)/mktables FORCE
99	$(call if_changed,mktable)
100
101quiet_cmd_unroll = UNROLL  $@
102      cmd_unroll = $(AWK) -v N=$* -f $(src)/unroll.awk < $< > $@
103
104targets += int1.c int2.c int4.c int8.c
105$(obj)/int%.c: $(src)/int.uc $(src)/unroll.awk FORCE
106	$(call if_changed,unroll)
107
108targets += arm/neon1.c arm/neon2.c arm/neon4.c arm/neon8.c
109$(obj)/arm/neon%.c: $(src)/arm/neon.uc $(src)/unroll.awk FORCE
110	$(call if_changed,unroll)
111
112targets += powerpc/altivec1.c \
113	   powerpc/altivec2.c \
114	   powerpc/altivec4.c \
115	   powerpc/altivec8.c
116$(obj)/powerpc/altivec%.c: $(src)/powerpc/altivec.uc $(src)/unroll.awk FORCE
117	$(call if_changed,unroll)
118
119targets += powerpc/vpermxor1.c \
120	   powerpc/vpermxor2.c \
121	   powerpc/vpermxor4.c \
122	   powerpc/vpermxor8.c
123$(obj)/powerpc/vpermxor%.c: $(src)/powerpc/vpermxor.uc $(src)/unroll.awk FORCE
124	$(call if_changed,unroll)
125
126targets += s390/s390vx8.c
127$(obj)/s390/s390vx%.c: $(src)/s390/s390vx.uc $(src)/unroll.awk FORCE
128	$(call if_changed,unroll)
129