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