blob: 45e17619422b4ef4b3c278b242806668d034b19f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
David Woodhousef5e70d02009-07-13 11:35:12 +01002obj-$(CONFIG_RAID6_PQ) += raid6_pq.o
3
Yuanhan Liu4f8c55c2012-11-30 13:10:40 -08004raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \
5 int8.o int16.o int32.o
6
Gayatri Kammela13c520b2016-08-12 18:03:20 -07007raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o avx512.o recov_avx512.o
Matt Brown751ba792017-08-04 13:42:32 +10008raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \
9 vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
Ard Biesheuvel6ec4e2512017-07-13 18:16:01 +010010raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
Martin Schwidefskyf5b55fa2016-08-31 09:27:35 +020011raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
Yuanhan Liu4f8c55c2012-11-30 13:10:40 -080012
Masahiro Yamada5f2fb522020-02-02 01:49:24 +090013hostprogs += mktables
David Woodhousef5e70d02009-07-13 11:35:12 +010014
David Woodhousef5e70d02009-07-13 11:35:12 +010015ifeq ($(CONFIG_ALTIVEC),y)
Anton Blanchard1fb3f5a2015-05-26 08:53:26 +100016altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
Alexey Dobriyan04e85bb2021-08-02 23:43:15 +030017# Enable <altivec.h>
18altivec_flags += -isystem $(shell $(CC) -print-file-name=include)
Joel Stanleye2135742018-11-02 11:14:55 +103019
20ifdef CONFIG_CC_IS_CLANG
21# clang ppc port does not yet support -maltivec when -msoft-float is
22# enabled. A future release of clang will resolve this
23# https://bugs.llvm.org/show_bug.cgi?id=31177
24CFLAGS_REMOVE_altivec1.o += -msoft-float
25CFLAGS_REMOVE_altivec2.o += -msoft-float
26CFLAGS_REMOVE_altivec4.o += -msoft-float
27CFLAGS_REMOVE_altivec8.o += -msoft-float
Joel Stanleye2135742018-11-02 11:14:55 +103028CFLAGS_REMOVE_vpermxor1.o += -msoft-float
29CFLAGS_REMOVE_vpermxor2.o += -msoft-float
30CFLAGS_REMOVE_vpermxor4.o += -msoft-float
31CFLAGS_REMOVE_vpermxor8.o += -msoft-float
32endif
David Woodhousef5e70d02009-07-13 11:35:12 +010033endif
34
Ard Biesheuvel7d119652013-05-16 17:20:32 +020035# The GCC option -ffreestanding is required in order to compile code containing
36# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
37ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
38NEON_FLAGS := -ffreestanding
Alexey Dobriyan04e85bb2021-08-02 23:43:15 +030039# Enable <arm_neon.h>
40NEON_FLAGS += -isystem $(shell $(CC) -print-file-name=include)
Ard Biesheuvel7d119652013-05-16 17:20:32 +020041ifeq ($(ARCH),arm)
Nathan Chancellorde9c0d42019-02-02 03:34:36 +010042NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
Ard Biesheuvel7d119652013-05-16 17:20:32 +020043endif
Ard Biesheuvel6ec4e2512017-07-13 18:16:01 +010044CFLAGS_recov_neon_inner.o += $(NEON_FLAGS)
Ard Biesheuvel7d119652013-05-16 17:20:32 +020045ifeq ($(ARCH),arm64)
Ard Biesheuvel6ec4e2512017-07-13 18:16:01 +010046CFLAGS_REMOVE_recov_neon_inner.o += -mgeneral-regs-only
Ard Biesheuvel7d119652013-05-16 17:20:32 +020047CFLAGS_REMOVE_neon1.o += -mgeneral-regs-only
48CFLAGS_REMOVE_neon2.o += -mgeneral-regs-only
49CFLAGS_REMOVE_neon4.o += -mgeneral-regs-only
50CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
51endif
52endif
53
Masahiro Yamada72ad2102019-06-17 02:48:05 +090054quiet_cmd_unroll = UNROLL $@
John Millikin0c36d882020-12-23 15:23:25 +090055 cmd_unroll = $(AWK) -v N=$* -f $(srctree)/$(src)/unroll.awk < $< > $@
David Woodhousef5e70d02009-07-13 11:35:12 +010056
Masahiro Yamada72ad2102019-06-17 02:48:05 +090057targets += int1.c int2.c int4.c int8.c int16.c int32.c
58$(obj)/int%.c: $(src)/int.uc $(src)/unroll.awk FORCE
David Woodhousef5e70d02009-07-13 11:35:12 +010059 $(call if_changed,unroll)
60
David Woodhousecc4589e2010-08-11 00:19:05 +010061CFLAGS_altivec1.o += $(altivec_flags)
David Woodhousecc4589e2010-08-11 00:19:05 +010062CFLAGS_altivec2.o += $(altivec_flags)
David Woodhousecc4589e2010-08-11 00:19:05 +010063CFLAGS_altivec4.o += $(altivec_flags)
David Woodhousecc4589e2010-08-11 00:19:05 +010064CFLAGS_altivec8.o += $(altivec_flags)
Masahiro Yamada72ad2102019-06-17 02:48:05 +090065targets += altivec1.c altivec2.c altivec4.c altivec8.c
66$(obj)/altivec%.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
David Woodhousef5e70d02009-07-13 11:35:12 +010067 $(call if_changed,unroll)
68
Matt Brown751ba792017-08-04 13:42:32 +100069CFLAGS_vpermxor1.o += $(altivec_flags)
Matt Brown751ba792017-08-04 13:42:32 +100070CFLAGS_vpermxor2.o += $(altivec_flags)
Matt Brown751ba792017-08-04 13:42:32 +100071CFLAGS_vpermxor4.o += $(altivec_flags)
Matt Brown751ba792017-08-04 13:42:32 +100072CFLAGS_vpermxor8.o += $(altivec_flags)
Masahiro Yamadae2a280d2019-07-31 01:40:42 +090073targets += vpermxor1.c vpermxor2.c vpermxor4.c vpermxor8.c
Masahiro Yamada72ad2102019-06-17 02:48:05 +090074$(obj)/vpermxor%.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
Matt Brown751ba792017-08-04 13:42:32 +100075 $(call if_changed,unroll)
76
Ard Biesheuvel7d119652013-05-16 17:20:32 +020077CFLAGS_neon1.o += $(NEON_FLAGS)
Ard Biesheuvel7d119652013-05-16 17:20:32 +020078CFLAGS_neon2.o += $(NEON_FLAGS)
Ard Biesheuvel7d119652013-05-16 17:20:32 +020079CFLAGS_neon4.o += $(NEON_FLAGS)
Ard Biesheuvel7d119652013-05-16 17:20:32 +020080CFLAGS_neon8.o += $(NEON_FLAGS)
Masahiro Yamada72ad2102019-06-17 02:48:05 +090081targets += neon1.c neon2.c neon4.c neon8.c
82$(obj)/neon%.c: $(src)/neon.uc $(src)/unroll.awk FORCE
Ard Biesheuvel7d119652013-05-16 17:20:32 +020083 $(call if_changed,unroll)
84
Martin Schwidefsky474fd6e2016-08-23 13:30:24 +020085targets += s390vx8.c
Masahiro Yamada72ad2102019-06-17 02:48:05 +090086$(obj)/s390vx%.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
Martin Schwidefsky474fd6e2016-08-23 13:30:24 +020087 $(call if_changed,unroll)
88
David Woodhousef5e70d02009-07-13 11:35:12 +010089quiet_cmd_mktable = TABLE $@
Masahiro Yamada172caf12018-12-31 17:24:08 +090090 cmd_mktable = $(obj)/mktables > $@
David Woodhousef5e70d02009-07-13 11:35:12 +010091
David Woodhousecc4589e2010-08-11 00:19:05 +010092targets += tables.c
93$(obj)/tables.c: $(obj)/mktables FORCE
David Woodhousef5e70d02009-07-13 11:35:12 +010094 $(call if_changed,mktable)