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