1# SPDX-License-Identifier: GPL-2.0
2# The loops are all 64-bit code
3CFLAGS += -m64
4CFLAGS += -I$(CURDIR)
5CFLAGS += -D SELFTEST
6CFLAGS += -maltivec
7CFLAGS += -mcpu=power4
8
9# Use our CFLAGS for the implicit .S rule & set the asm machine type
10ASFLAGS = $(CFLAGS) -Wa,-mpower4
11
12TEST_GEN_PROGS := copyuser_64_t0 copyuser_64_t1 copyuser_64_t2 \
13		copyuser_p7_t0 copyuser_p7_t1 \
14		memcpy_64_t0 memcpy_64_t1 memcpy_64_t2 \
15		memcpy_p7_t0 memcpy_p7_t1 copy_mc_64 \
16		copyuser_64_exc_t0 copyuser_64_exc_t1 copyuser_64_exc_t2 \
17		memmove_64
18
19EXTRA_SOURCES := validate.c ../harness.c stubs.S
20
21top_srcdir = ../../../../..
22include ../../lib.mk
23
24$(OUTPUT)/copyuser_64_t%:	copyuser_64.S $(EXTRA_SOURCES)
25	$(CC) $(CPPFLAGS) $(CFLAGS) \
26		-D COPY_LOOP=test___copy_tofrom_user_base \
27		-D SELFTEST_CASE=$(subst copyuser_64_t,,$(notdir $@)) \
28		-o $@ $^
29
30$(OUTPUT)/copyuser_p7_t%:	copyuser_power7.S $(EXTRA_SOURCES)
31	$(CC) $(CPPFLAGS) $(CFLAGS) \
32		-D COPY_LOOP=test___copy_tofrom_user_power7 \
33		-D SELFTEST_CASE=$(subst copyuser_p7_t,,$(notdir $@)) \
34		-o $@ $^
35
36# Strictly speaking, we only need the memcpy_64 test cases for big-endian
37$(OUTPUT)/memcpy_64_t%:	memcpy_64.S $(EXTRA_SOURCES)
38	$(CC) $(CPPFLAGS) $(CFLAGS) \
39		-D COPY_LOOP=test_memcpy \
40		-D SELFTEST_CASE=$(subst memcpy_64_t,,$(notdir $@)) \
41		-o $@ $^
42
43$(OUTPUT)/memcpy_p7_t%:	memcpy_power7.S $(EXTRA_SOURCES)
44	$(CC) $(CPPFLAGS) $(CFLAGS) \
45		-D COPY_LOOP=test_memcpy_power7 \
46		-D SELFTEST_CASE=$(subst memcpy_p7_t,,$(notdir $@)) \
47		-o $@ $^
48
49$(OUTPUT)/copy_mc_64: copy_mc_64.S $(EXTRA_SOURCES)
50	$(CC) $(CPPFLAGS) $(CFLAGS) \
51		-D COPY_LOOP=test_copy_mc_generic \
52		-o $@ $^
53
54$(OUTPUT)/copyuser_64_exc_t%: copyuser_64.S exc_validate.c ../harness.c \
55		copy_tofrom_user_reference.S stubs.S
56	$(CC) $(CPPFLAGS) $(CFLAGS) \
57		-D COPY_LOOP=test___copy_tofrom_user_base \
58		-D SELFTEST_CASE=$(subst copyuser_64_exc_t,,$(notdir $@)) \
59		-o $@ $^
60
61$(OUTPUT)/memmove_64: mem_64.S memcpy_64.S memmove_validate.c ../harness.c \
62		memcpy_stubs.S
63	$(CC) $(CPPFLAGS) $(CFLAGS) \
64		-D TEST_MEMMOVE=test_memmove \
65		-o $@ $^
66