xref: /openbmc/qemu/tests/tcg/i386/Makefile.target (revision e409c905)
1# i386 cross compile notes
2
3I386_SRC=$(SRC_PATH)/tests/tcg/i386
4
5# Set search path for all sources
6VPATH 		+= $(I386_SRC)
7
8config-cc.mak: Makefile
9	$(quiet-@)( \
10          $(call cc-option,-fno-pie, CROSS_CC_HAS_I386_NOPIE)) 3> config-cc.mak
11
12-include config-cc.mak
13
14I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
15ALL_X86_TESTS=$(I386_SRCS:.c=)
16SKIP_I386_TESTS=test-i386-ssse3 test-avx test-3dnow test-mmx
17X86_64_TESTS:=$(filter test-i386-adcox test-i386-bmi2 $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
18
19test-i386-sse-exceptions: CFLAGS += -msse4.1 -mfpmath=sse
20run-test-i386-sse-exceptions: QEMU_OPTS += -cpu max
21
22test-i386-pcmpistri: CFLAGS += -msse4.2
23run-test-i386-pcmpistri: QEMU_OPTS += -cpu max
24
25test-i386-bmi2: CFLAGS=-O2
26run-test-i386-bmi2: QEMU_OPTS += -cpu max
27
28test-i386-adcox: CFLAGS=-O2
29run-test-i386-adcox: QEMU_OPTS += -cpu max
30
31#
32# hello-i386 is a barebones app
33#
34hello-i386: CFLAGS+=-ffreestanding
35hello-i386: LDFLAGS+=-nostdlib
36
37# test-386 includes a couple of additional objects that need to be
38# linked together, we also need a no-pie capable compiler due to the
39# non-pic calls into 16-bit mode
40ifneq ($(CROSS_CC_HAS_I386_NOPIE),)
41test-i386: CFLAGS += -fno-pie
42
43test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h
44	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ \
45	   $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
46else
47test-i386:
48	$(call skip-test, "BUILD of $@", "missing -no-pie compiler support")
49run-test-i386:
50	$(call skip-test, "RUN of test-i386", "not built")
51endif
52
53ifeq ($(SPEED), slow)
54
55test-i386-fprem.ref: test-i386-fprem
56	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
57
58run-test-i386-fprem: TIMEOUT=60
59run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
60	$(call run-test,test-i386-fprem, $(QEMU) $<)
61	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
62else
63SKIP_I386_TESTS+=test-i386-fprem
64endif
65
66# Update TESTS
67I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
68TESTS=$(MULTIARCH_TESTS) $(I386_TESTS)
69
70# On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
71EXTRA_RUNS+=run-test-mmap-4096
72
73sha512-sse: CFLAGS=-msse4.1 -O3
74sha512-sse: sha512.c
75	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
76
77run-sha512-sse: QEMU_OPTS+=-cpu max
78
79TESTS+=sha512-sse
80
81CLEANFILES += test-avx.h test-mmx.h test-3dnow.h
82test-3dnow.h: test-mmx.py x86.csv
83	$(PYTHON) $(I386_SRC)/test-mmx.py $(I386_SRC)/x86.csv $@ 3DNOW
84
85test-mmx.h: test-mmx.py x86.csv
86	$(PYTHON) $(I386_SRC)/test-mmx.py $(I386_SRC)/x86.csv $@ MMX SSE SSE2 SSE3 SSSE3
87
88test-avx.h: test-avx.py x86.csv
89	$(PYTHON) $(I386_SRC)/test-avx.py $(I386_SRC)/x86.csv $@
90
91test-3dnow: CFLAGS += -masm=intel -O -I.
92run-test-3dnow: QEMU_OPTS += -cpu max
93test-3dnow: test-3dnow.h
94
95test-mmx: CFLAGS += -masm=intel -O -I.
96run-test-mmx: QEMU_OPTS += -cpu max
97test-mmx: test-mmx.h
98
99test-avx: CFLAGS += -mavx -masm=intel -O -I.
100run-test-avx: QEMU_OPTS += -cpu max
101test-avx: test-avx.h
102