xref: /linux/lib/raid6/Makefile (revision 751ba79cc552c146595cd439b21c4ff8998c3b69)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2f5e70d0fSDavid Woodhouseobj-$(CONFIG_RAID6_PQ)	+= raid6_pq.o
3f5e70d0fSDavid Woodhouse
44f8c55c5SYuanhan Liuraid6_pq-y	+= algos.o recov.o tables.o int1.o int2.o int4.o \
54f8c55c5SYuanhan Liu		   int8.o int16.o int32.o
64f8c55c5SYuanhan Liu
713c520b2SGayatri Kammelaraid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o avx512.o recov_avx512.o
8*751ba79cSMatt Brownraid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \
9*751ba79cSMatt Brown                              vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
106ec4e251SArd Biesheuvelraid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
11ae77cbc1SKen Steeleraid6_pq-$(CONFIG_TILEGX) += tilegx8.o
12f5b55fa1SMartin Schwidefskyraid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
134f8c55c5SYuanhan Liu
14f5e70d0fSDavid Woodhousehostprogs-y	+= mktables
15f5e70d0fSDavid Woodhouse
16f5e70d0fSDavid Woodhousequiet_cmd_unroll = UNROLL  $@
172144381dSDavid Woodhouse      cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \
18f5e70d0fSDavid Woodhouse                   < $< > $@ || ( rm -f $@ && exit 1 )
19f5e70d0fSDavid Woodhouse
20f5e70d0fSDavid Woodhouseifeq ($(CONFIG_ALTIVEC),y)
211fb3f5a7SAnton Blanchardaltivec_flags := -maltivec $(call cc-option,-mabi=altivec)
22f5e70d0fSDavid Woodhouseendif
23f5e70d0fSDavid Woodhouse
247d11965dSArd Biesheuvel# The GCC option -ffreestanding is required in order to compile code containing
257d11965dSArd Biesheuvel# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
267d11965dSArd Biesheuvelifeq ($(CONFIG_KERNEL_MODE_NEON),y)
277d11965dSArd BiesheuvelNEON_FLAGS := -ffreestanding
287d11965dSArd Biesheuvelifeq ($(ARCH),arm)
297d11965dSArd BiesheuvelNEON_FLAGS += -mfloat-abi=softfp -mfpu=neon
307d11965dSArd Biesheuvelendif
316ec4e251SArd BiesheuvelCFLAGS_recov_neon_inner.o += $(NEON_FLAGS)
327d11965dSArd Biesheuvelifeq ($(ARCH),arm64)
336ec4e251SArd BiesheuvelCFLAGS_REMOVE_recov_neon_inner.o += -mgeneral-regs-only
347d11965dSArd BiesheuvelCFLAGS_REMOVE_neon1.o += -mgeneral-regs-only
357d11965dSArd BiesheuvelCFLAGS_REMOVE_neon2.o += -mgeneral-regs-only
367d11965dSArd BiesheuvelCFLAGS_REMOVE_neon4.o += -mgeneral-regs-only
377d11965dSArd BiesheuvelCFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
387d11965dSArd Biesheuvelendif
397d11965dSArd Biesheuvelendif
407d11965dSArd Biesheuvel
41cc4589ebSDavid Woodhousetargets += int1.c
42cc4589ebSDavid Woodhouse$(obj)/int1.c:   UNROLL := 1
43cc4589ebSDavid Woodhouse$(obj)/int1.c:   $(src)/int.uc $(src)/unroll.awk FORCE
44f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
45f5e70d0fSDavid Woodhouse
46cc4589ebSDavid Woodhousetargets += int2.c
47cc4589ebSDavid Woodhouse$(obj)/int2.c:   UNROLL := 2
48cc4589ebSDavid Woodhouse$(obj)/int2.c:   $(src)/int.uc $(src)/unroll.awk FORCE
49f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
50f5e70d0fSDavid Woodhouse
51cc4589ebSDavid Woodhousetargets += int4.c
52cc4589ebSDavid Woodhouse$(obj)/int4.c:   UNROLL := 4
53cc4589ebSDavid Woodhouse$(obj)/int4.c:   $(src)/int.uc $(src)/unroll.awk FORCE
54f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
55f5e70d0fSDavid Woodhouse
56cc4589ebSDavid Woodhousetargets += int8.c
57cc4589ebSDavid Woodhouse$(obj)/int8.c:   UNROLL := 8
58cc4589ebSDavid Woodhouse$(obj)/int8.c:   $(src)/int.uc $(src)/unroll.awk FORCE
59f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
60f5e70d0fSDavid Woodhouse
61cc4589ebSDavid Woodhousetargets += int16.c
62cc4589ebSDavid Woodhouse$(obj)/int16.c:  UNROLL := 16
63cc4589ebSDavid Woodhouse$(obj)/int16.c:  $(src)/int.uc $(src)/unroll.awk FORCE
64f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
65f5e70d0fSDavid Woodhouse
66cc4589ebSDavid Woodhousetargets += int32.c
67cc4589ebSDavid Woodhouse$(obj)/int32.c:  UNROLL := 32
68cc4589ebSDavid Woodhouse$(obj)/int32.c:  $(src)/int.uc $(src)/unroll.awk FORCE
69f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
70f5e70d0fSDavid Woodhouse
71cc4589ebSDavid WoodhouseCFLAGS_altivec1.o += $(altivec_flags)
72cc4589ebSDavid Woodhousetargets += altivec1.c
73cc4589ebSDavid Woodhouse$(obj)/altivec1.c:   UNROLL := 1
74cc4589ebSDavid Woodhouse$(obj)/altivec1.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
75f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
76f5e70d0fSDavid Woodhouse
77cc4589ebSDavid WoodhouseCFLAGS_altivec2.o += $(altivec_flags)
78cc4589ebSDavid Woodhousetargets += altivec2.c
79cc4589ebSDavid Woodhouse$(obj)/altivec2.c:   UNROLL := 2
80cc4589ebSDavid Woodhouse$(obj)/altivec2.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
81f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
82f5e70d0fSDavid Woodhouse
83cc4589ebSDavid WoodhouseCFLAGS_altivec4.o += $(altivec_flags)
84cc4589ebSDavid Woodhousetargets += altivec4.c
85cc4589ebSDavid Woodhouse$(obj)/altivec4.c:   UNROLL := 4
86cc4589ebSDavid Woodhouse$(obj)/altivec4.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
87f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
88f5e70d0fSDavid Woodhouse
89cc4589ebSDavid WoodhouseCFLAGS_altivec8.o += $(altivec_flags)
90cc4589ebSDavid Woodhousetargets += altivec8.c
91cc4589ebSDavid Woodhouse$(obj)/altivec8.c:   UNROLL := 8
92cc4589ebSDavid Woodhouse$(obj)/altivec8.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
93f5e70d0fSDavid Woodhouse	$(call if_changed,unroll)
94f5e70d0fSDavid Woodhouse
95*751ba79cSMatt BrownCFLAGS_vpermxor1.o += $(altivec_flags)
96*751ba79cSMatt Browntargets += vpermxor1.c
97*751ba79cSMatt Brown$(obj)/vpermxor1.c: UNROLL := 1
98*751ba79cSMatt Brown$(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
99*751ba79cSMatt Brown	$(call if_changed,unroll)
100*751ba79cSMatt Brown
101*751ba79cSMatt BrownCFLAGS_vpermxor2.o += $(altivec_flags)
102*751ba79cSMatt Browntargets += vpermxor2.c
103*751ba79cSMatt Brown$(obj)/vpermxor2.c: UNROLL := 2
104*751ba79cSMatt Brown$(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
105*751ba79cSMatt Brown	$(call if_changed,unroll)
106*751ba79cSMatt Brown
107*751ba79cSMatt BrownCFLAGS_vpermxor4.o += $(altivec_flags)
108*751ba79cSMatt Browntargets += vpermxor4.c
109*751ba79cSMatt Brown$(obj)/vpermxor4.c: UNROLL := 4
110*751ba79cSMatt Brown$(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
111*751ba79cSMatt Brown	$(call if_changed,unroll)
112*751ba79cSMatt Brown
113*751ba79cSMatt BrownCFLAGS_vpermxor8.o += $(altivec_flags)
114*751ba79cSMatt Browntargets += vpermxor8.c
115*751ba79cSMatt Brown$(obj)/vpermxor8.c: UNROLL := 8
116*751ba79cSMatt Brown$(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
117*751ba79cSMatt Brown	$(call if_changed,unroll)
118*751ba79cSMatt Brown
1197d11965dSArd BiesheuvelCFLAGS_neon1.o += $(NEON_FLAGS)
1207d11965dSArd Biesheuveltargets += neon1.c
1217d11965dSArd Biesheuvel$(obj)/neon1.c:   UNROLL := 1
1227d11965dSArd Biesheuvel$(obj)/neon1.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
1237d11965dSArd Biesheuvel	$(call if_changed,unroll)
1247d11965dSArd Biesheuvel
1257d11965dSArd BiesheuvelCFLAGS_neon2.o += $(NEON_FLAGS)
1267d11965dSArd Biesheuveltargets += neon2.c
1277d11965dSArd Biesheuvel$(obj)/neon2.c:   UNROLL := 2
1287d11965dSArd Biesheuvel$(obj)/neon2.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
1297d11965dSArd Biesheuvel	$(call if_changed,unroll)
1307d11965dSArd Biesheuvel
1317d11965dSArd BiesheuvelCFLAGS_neon4.o += $(NEON_FLAGS)
1327d11965dSArd Biesheuveltargets += neon4.c
1337d11965dSArd Biesheuvel$(obj)/neon4.c:   UNROLL := 4
1347d11965dSArd Biesheuvel$(obj)/neon4.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
1357d11965dSArd Biesheuvel	$(call if_changed,unroll)
1367d11965dSArd Biesheuvel
1377d11965dSArd BiesheuvelCFLAGS_neon8.o += $(NEON_FLAGS)
1387d11965dSArd Biesheuveltargets += neon8.c
1397d11965dSArd Biesheuvel$(obj)/neon8.c:   UNROLL := 8
1407d11965dSArd Biesheuvel$(obj)/neon8.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
1417d11965dSArd Biesheuvel	$(call if_changed,unroll)
1427d11965dSArd Biesheuvel
143ae77cbc1SKen Steeletargets += tilegx8.c
144ae77cbc1SKen Steele$(obj)/tilegx8.c:   UNROLL := 8
145ae77cbc1SKen Steele$(obj)/tilegx8.c:   $(src)/tilegx.uc $(src)/unroll.awk FORCE
146ae77cbc1SKen Steele	$(call if_changed,unroll)
147ae77cbc1SKen Steele
148474fd6e8SMartin Schwidefskytargets += s390vx8.c
149474fd6e8SMartin Schwidefsky$(obj)/s390vx8.c:   UNROLL := 8
150474fd6e8SMartin Schwidefsky$(obj)/s390vx8.c:   $(src)/s390vx.uc $(src)/unroll.awk FORCE
151474fd6e8SMartin Schwidefsky	$(call if_changed,unroll)
152474fd6e8SMartin Schwidefsky
153f5e70d0fSDavid Woodhousequiet_cmd_mktable = TABLE   $@
154f5e70d0fSDavid Woodhouse      cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 )
155f5e70d0fSDavid Woodhouse
156cc4589ebSDavid Woodhousetargets += tables.c
157cc4589ebSDavid Woodhouse$(obj)/tables.c: $(obj)/mktables FORCE
158f5e70d0fSDavid Woodhouse	$(call if_changed,mktable)
159