xref: /openbmc/qemu/tests/tcg/i386/Makefile.target (revision 25657fc6)
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
21run-plugin-test-i386-sse-exceptions-%: QEMU_OPTS += -cpu max
22
23test-i386-pcmpistri: CFLAGS += -msse4.2
24run-test-i386-pcmpistri: QEMU_OPTS += -cpu max
25run-plugin-test-i386-pcmpistri-%: QEMU_OPTS += -cpu max
26
27test-i386-bmi2: CFLAGS=-O2
28run-test-i386-bmi2: QEMU_OPTS += -cpu max
29run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
30
31test-i386-adcox: CFLAGS=-O2
32run-test-i386-adcox: QEMU_OPTS += -cpu max
33run-plugin-test-i386-adcox-%: QEMU_OPTS += -cpu max
34
35#
36# hello-i386 is a barebones app
37#
38hello-i386: CFLAGS+=-ffreestanding
39hello-i386: LDFLAGS+=-nostdlib
40
41# test-386 includes a couple of additional objects that need to be
42# linked together, we also need a no-pie capable compiler due to the
43# non-pic calls into 16-bit mode
44ifneq ($(CROSS_CC_HAS_I386_NOPIE),)
45test-i386: CFLAGS += -fno-pie
46
47test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h
48	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ \
49	   $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
50else
51test-i386:
52	$(call skip-test, "BUILD of $@", "missing -no-pie compiler support")
53run-test-i386:
54	$(call skip-test, "RUN of test-i386", "not built")
55run-plugin-test-i386-with-%:
56	$(call skip-test, "RUN of test-i386 ($*)", "not built")
57endif
58
59ifeq ($(SPEED), slow)
60
61test-i386-fprem.ref: test-i386-fprem
62	$(call quiet-command, ./$< > $@,"GENREF","generating $@")
63
64run-test-i386-fprem: TIMEOUT=60
65run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
66	$(call run-test,test-i386-fprem, $(QEMU) $<)
67	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
68else
69SKIP_I386_TESTS+=test-i386-fprem
70endif
71
72# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so
73run-plugin-%-with-libinsn.so:
74	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
75	       -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
76	       -d plugin -D $*-with-libinsn.so.pout $*)
77
78# Update TESTS
79I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
80TESTS=$(MULTIARCH_TESTS) $(I386_TESTS)
81
82# On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack)
83EXTRA_RUNS+=run-test-mmap-4096
84
85sha512-sse: CFLAGS=-msse4.1 -O3
86sha512-sse: sha512.c
87	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
88
89run-sha512-sse: QEMU_OPTS+=-cpu max
90run-plugin-sha512-sse-with-%: QEMU_OPTS+=-cpu max
91
92TESTS+=sha512-sse
93
94CLEANFILES += test-avx.h test-mmx.h test-3dnow.h
95test-3dnow.h: test-mmx.py x86.csv
96	$(PYTHON) $(I386_SRC)/test-mmx.py $(I386_SRC)/x86.csv $@ 3DNOW
97
98test-mmx.h: test-mmx.py x86.csv
99	$(PYTHON) $(I386_SRC)/test-mmx.py $(I386_SRC)/x86.csv $@ MMX SSE SSE2 SSE3 SSSE3
100
101test-avx.h: test-avx.py x86.csv
102	$(PYTHON) $(I386_SRC)/test-avx.py $(I386_SRC)/x86.csv $@
103
104test-3dnow: CFLAGS += -masm=intel -O -I.
105run-test-3dnow: QEMU_OPTS += -cpu max
106run-plugin-test-3dnow: QEMU_OPTS += -cpu max
107test-3dnow: test-3dnow.h
108
109test-mmx: CFLAGS += -masm=intel -O -I.
110run-test-mmx: QEMU_OPTS += -cpu max
111run-plugin-test-mmx: QEMU_OPTS += -cpu max
112test-mmx: test-mmx.h
113
114test-avx: CFLAGS += -mavx -masm=intel -O -I.
115run-test-avx: QEMU_OPTS += -cpu max
116run-plugin-test-avx: QEMU_OPTS += -cpu max
117test-avx: test-avx.h
118