Skip to content

Commit 72ad210

Browse files
committed
lib/raid6: refactor unroll rules with pattern rules
This Makefile repeats very similar rules. Let's use pattern rules. $(UNROLL) can be replaced with $*. No intended change in behavior. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 7747bad commit 72ad210

File tree

1 file changed

+11
-86
lines changed

1 file changed

+11
-86
lines changed

lib/raid6/Makefile

Lines changed: 11 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
1212

1313
hostprogs-y += mktables
1414

15-
quiet_cmd_unroll = UNROLL $@
16-
cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) < $< > $@
17-
1815
ifeq ($(CONFIG_ALTIVEC),y)
1916
altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
2017

@@ -50,111 +47,39 @@ CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
5047
endif
5148
endif
5249

53-
targets += int1.c
54-
$(obj)/int1.c: UNROLL := 1
55-
$(obj)/int1.c: $(src)/int.uc $(src)/unroll.awk FORCE
56-
$(call if_changed,unroll)
57-
58-
targets += int2.c
59-
$(obj)/int2.c: UNROLL := 2
60-
$(obj)/int2.c: $(src)/int.uc $(src)/unroll.awk FORCE
61-
$(call if_changed,unroll)
62-
63-
targets += int4.c
64-
$(obj)/int4.c: UNROLL := 4
65-
$(obj)/int4.c: $(src)/int.uc $(src)/unroll.awk FORCE
66-
$(call if_changed,unroll)
67-
68-
targets += int8.c
69-
$(obj)/int8.c: UNROLL := 8
70-
$(obj)/int8.c: $(src)/int.uc $(src)/unroll.awk FORCE
71-
$(call if_changed,unroll)
72-
73-
targets += int16.c
74-
$(obj)/int16.c: UNROLL := 16
75-
$(obj)/int16.c: $(src)/int.uc $(src)/unroll.awk FORCE
76-
$(call if_changed,unroll)
50+
quiet_cmd_unroll = UNROLL $@
51+
cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$* < $< > $@
7752

78-
targets += int32.c
79-
$(obj)/int32.c: UNROLL := 32
80-
$(obj)/int32.c: $(src)/int.uc $(src)/unroll.awk FORCE
53+
targets += int1.c int2.c int4.c int8.c int16.c int32.c
54+
$(obj)/int%.c: $(src)/int.uc $(src)/unroll.awk FORCE
8155
$(call if_changed,unroll)
8256

8357
CFLAGS_altivec1.o += $(altivec_flags)
84-
targets += altivec1.c
85-
$(obj)/altivec1.c: UNROLL := 1
86-
$(obj)/altivec1.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
87-
$(call if_changed,unroll)
88-
8958
CFLAGS_altivec2.o += $(altivec_flags)
90-
targets += altivec2.c
91-
$(obj)/altivec2.c: UNROLL := 2
92-
$(obj)/altivec2.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
93-
$(call if_changed,unroll)
94-
9559
CFLAGS_altivec4.o += $(altivec_flags)
96-
targets += altivec4.c
97-
$(obj)/altivec4.c: UNROLL := 4
98-
$(obj)/altivec4.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
99-
$(call if_changed,unroll)
100-
10160
CFLAGS_altivec8.o += $(altivec_flags)
102-
targets += altivec8.c
103-
$(obj)/altivec8.c: UNROLL := 8
104-
$(obj)/altivec8.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
61+
targets += altivec1.c altivec2.c altivec4.c altivec8.c
62+
$(obj)/altivec%.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
10563
$(call if_changed,unroll)
10664

10765
CFLAGS_vpermxor1.o += $(altivec_flags)
108-
targets += vpermxor1.c
109-
$(obj)/vpermxor1.c: UNROLL := 1
110-
$(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
111-
$(call if_changed,unroll)
112-
11366
CFLAGS_vpermxor2.o += $(altivec_flags)
114-
targets += vpermxor2.c
115-
$(obj)/vpermxor2.c: UNROLL := 2
116-
$(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
117-
$(call if_changed,unroll)
118-
11967
CFLAGS_vpermxor4.o += $(altivec_flags)
120-
targets += vpermxor4.c
121-
$(obj)/vpermxor4.c: UNROLL := 4
122-
$(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
123-
$(call if_changed,unroll)
124-
12568
CFLAGS_vpermxor8.o += $(altivec_flags)
126-
targets += vpermxor8.c
127-
$(obj)/vpermxor8.c: UNROLL := 8
128-
$(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
69+
targets += vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
70+
$(obj)/vpermxor%.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
12971
$(call if_changed,unroll)
13072

13173
CFLAGS_neon1.o += $(NEON_FLAGS)
132-
targets += neon1.c
133-
$(obj)/neon1.c: UNROLL := 1
134-
$(obj)/neon1.c: $(src)/neon.uc $(src)/unroll.awk FORCE
135-
$(call if_changed,unroll)
136-
13774
CFLAGS_neon2.o += $(NEON_FLAGS)
138-
targets += neon2.c
139-
$(obj)/neon2.c: UNROLL := 2
140-
$(obj)/neon2.c: $(src)/neon.uc $(src)/unroll.awk FORCE
141-
$(call if_changed,unroll)
142-
14375
CFLAGS_neon4.o += $(NEON_FLAGS)
144-
targets += neon4.c
145-
$(obj)/neon4.c: UNROLL := 4
146-
$(obj)/neon4.c: $(src)/neon.uc $(src)/unroll.awk FORCE
147-
$(call if_changed,unroll)
148-
14976
CFLAGS_neon8.o += $(NEON_FLAGS)
150-
targets += neon8.c
151-
$(obj)/neon8.c: UNROLL := 8
152-
$(obj)/neon8.c: $(src)/neon.uc $(src)/unroll.awk FORCE
77+
targets += neon1.c neon2.c neon4.c neon8.c
78+
$(obj)/neon%.c: $(src)/neon.uc $(src)/unroll.awk FORCE
15379
$(call if_changed,unroll)
15480

15581
targets += s390vx8.c
156-
$(obj)/s390vx8.c: UNROLL := 8
157-
$(obj)/s390vx8.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
82+
$(obj)/s390vx%.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
15883
$(call if_changed,unroll)
15984

16085
quiet_cmd_mktable = TABLE $@

0 commit comments

Comments
 (0)