blob: cf4a5b35f76684197a58ec4e27da6e65f072cec2 [file] [log] [blame]
Christophe Lyon073831a2011-01-24 17:37:40 +01001# Copyright (c) 2009, 2010, 2011 STMicroelectronics
2# Written by Christophe Lyon
3
4# Permission is hereby granted, free of charge, to any person obtaining a copy
5# of this software and associated documentation files (the "Software"), to deal
6# in the Software without restriction, including without limitation the rights
7# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8# copies of the Software, and to permit persons to whom the Software is
9# furnished to do so, subject to the following conditions:
10
11# The above copyright notice and this permission notice shall be included in
12# all copies or substantial portions of the Software.
13
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20# THE SOFTWARE.
21
22# ARM RVCT
23CC.rvct := armcc
24CFLAGS.rvct = -g --cpu=cortex-a9 -Ono_special_regs_postregalloc -I.
25LD.rvct := armlink
26LDFLAGS.rvct := --cpu=cortex-a9 --entry 0x2000
27
28# GCC/ARM cross compiler
29CC.gccarm := arm-none-eabi-gcc
30CFLAGS.gccarm := -g -Wall -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon -fshort-wchar -Wno-unused-variable -Wno-unused-function
31LD.gccarm := armlink
32LDFLAGS.gccarm := --cpu=cortex-a9 --entry 0x2000
33
34# List of validated intrinsics
35REFNAMES = vld1 vadd vld1_lane vld1_dup vdup vget_high vget_low \
36 vqdmlal_lane vqdmlsl_lane vext vshrn_n vset_lane vget_lane \
37 vqsub vqdmulh_lane vqdmull vqdmlal vqdmlsl vceq vcge vcle \
38 vcgt vclt vbsl vshl vldX vdup_lane vrshrn_n vqdmull_lane \
39 vst1_lane vqshl vqshl_n vqrshrn_n vsub vqadd vabs vqabs \
40 vcombine vmax vmin vneg vqneg vmlal vmlal_lane vmlsl \
41 vmlsl_lane vmovl vmovn vmull vmull_lane vrev vrshl vshl_n \
42 vshr_n vsra_n vtrn vuzp vzip vreinterpret vqdmulh vqrdmulh \
43 vqrdmulh_lane vqrshl vaba vabal vabd vabdl vand vorr vorn \
44 veor vbic vcreate vldX_lane vldX_dup vmla vmls vmul \
45 vmul_lane vmul_n vmull_n vqdmulh_n vqdmull_n vqrdmulh_n \
46 vmla_lane vmls_lane vmla_n vmls_n vmlal_n vmlsl_n vqdmlal_n \
47 vqdmlsl_n vsri_n vsli_n vtst vaddhn vraddhn vaddl vaddw \
48 vhadd vrhadd vhsub vsubl vsubw vsubhn vrsubhn vmvn vqmovn \
49 vqmovun vrshr_n vrsra_n vshll_n vpaddl vpadd vpadal \
50 vqshlu_n vclz vcls vcnt vqshrn_n vpmax vpmin vqshrun_n \
51 vqrshrun_n vstX_lane vtbX vrecpe vrsqrte integer vcage \
52 vcagt vcale vcalt vrecps vrsqrts vcvt dsp dspfns
53REFLIST = $(addprefix ref_, $(REFNAMES))
54
55all: ref-rvct.qemu
56
57check:
58 diff stm-arm-neon.refrvct ref-rvct.txt
59
60# Building reference files with RVCT
61REFOBJS.rvct = $(addsuffix .rvct.o, $(REFLIST))
62REFRVCT=stm-arm-neon.refrvct
63ref-rvct: $(REFRVCT)
64ref-rvct.qemu: $(REFRVCT).qemu
65
66$(REFRVCT): compute_ref.axf
67 rvdebug -stdiolog=stdio.log -jou=journal.log -log=log.log -nologo -cmd -init @coretile.core.cpu0@RTSM -inc armscript.inc -exec $^
68
69$(REFRVCT).qemu: compute_ref.axf
70 qemu-system-arm -cpu cortex-a9 -semihosting -nographic -kernel $^
Christophe Lyon2eeafa42011-01-24 18:02:18 +010071# Avoid rebuilding compute_ref.axf if already present, for users who
72# don't have rvct
Christophe Lyona6b7ca22011-02-08 18:33:03 +010073.PRECIOUS .INTERMEDIATE: compute_ref.rvct.o retarget.rvct.o \
74 InitCache.o Init.o $(REFOBJS.rvct)
Christophe Lyon073831a2011-01-24 17:37:40 +010075
76compute_ref.axf: scatter.scat compute_ref.rvct.o retarget.rvct.o \
77 InitCache.o Init.o $(REFOBJS.rvct)
78 $(LD.rvct) $(LDFLAGS.rvct) --scatter $^ -o $@
79
80compute_ref.rvct.o retarget.rvct.o: %.rvct.o: %.c
81 $(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@ -DREFFILE=\"$(REFRVCT)\"
82
Christophe Lyon2eeafa42011-01-24 18:02:18 +010083ref_%.rvct.o: ref_%.c stm-arm-neon-ref.h
Christophe Lyon073831a2011-01-24 17:37:40 +010084 $(CC.rvct) $(CFLAGS.rvct) -c $< -o $@
85
86InitCache.o Init.o: %.o: %.s
87 $(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@
88
89
90# Building reference files with GCC/ARM
91REFOBJS.gccarm = $(addsuffix .gccarm.o, $(REFLIST))
92REFGCCARM=stm-arm-neon.gccarm
93ref-gccarm: $(REFGCCARM)
94
95$(REFGCCARM): compute_ref.gccarm
96 rvdebug -stdiolog=stdio.log -jou=journal.log -log=log.log -nologo -cmd -init @coretile.core.cpu0@RTSM -inc armscript.inc -exec $^
97
98compute_ref.gccarm: scatter.scat compute_ref.gccarm.o retarget.rvct.o \
99 InitCache.o Init.o $(REFOBJS.gccarm)
100 $(LD.rvct) $(LDFLAG.rvct) --scatter $^ -o $@
101
102compute_ref.gccarm.o: %.gccarm.o: %.c
103 $(CC.gccarm) $(CFLAGS.gccarm) -c $^ -o $@ -DREFFILE=\"$(REFGCCARM)\"
104
105ref_%.gccarm.o: ref_%.c stm-arm-neon-ref.h
106 $(CC.gccarm) $(CFLAGS.gccarm) -c $< -o $@
107
108# Use '*' rather than '%' in these rules:
109# - using '%' does not make them add to the implicit rules above (they
110# are different rules, only the 1st one matches)
111# - they are needed only when the target already exists, so the
112# wildcard matches when needed.
113# - if the target does not already exist, the implicit rules apply.
114ref_vadd.*.o ref_vsub.*.o ref_vand.*.o ref_vbic.*.o ref_veor.*.o ref_vorn.*.o ref_vorr.*.o: ref_v_binary_op.c
115ref_vqadd.*.o ref_vqsub.*.o: ref_v_binary_sat_op.c
116ref_vabs.*.o ref_vneg.*.o ref_vmvn.*.o: ref_v_unary_op.c
117ref_vqabs.*.o ref_vqneg.*.o: ref_v_unary_sat_op.c
118ref_vceq.*.o ref_vcge.*.o ref_vcle.*.o ref_vcgt.*.o ref_vclt.*.o: ref_v_comp_op.c
119ref_vhadd.*.o ref_vrhadd.*.o ref_vhsub.*.o ref_vmin.*.o: ref_vmax.c
120ref_vmls.*.o: ref_vmla.c
121ref_vmls_lane.*.o: ref_vmla_lane.c
122ref_vmls_n.*.o: ref_vmla_n.c
123ref_vmlsl.*.o: ref_vmlal.c
124ref_vmlsl_lane.*.o: ref_vmlal_lane.c
125ref_vmlsl_n.*.o: ref_vmlal_n.c
126ref_vqdmlsl.*.o: ref_vqdmlal.c
127ref_vqdmlsl_lane.*.o: ref_vqdmlal_lane.c
128ref_vqdmlsl_n.*.o: ref_vqdmlal_n.c
129ref_vtrn.*.o ref_vzip.*.o: ref_vuzp.c
Christophe Lyonf0ecb5a2011-02-08 18:15:05 +0100130ref_vsli_n.*.o ref_vsri_n.*.o: ref_vsXi_n.c
Christophe Lyon073831a2011-01-24 17:37:40 +0100131ref_vraddhn.*.o ref_vsubhn.*.o ref_vrsubhn.*.o: ref_vaddhn.c
132ref_vsubl.*.o: ref_vaddl.c
133ref_vsubw.*.o: ref_vaddw.c
134ref_vcage.*.o ref_vcale.*.o ref_vcagt.*.o ref_vcalt.*.o: ref_v_comp_f_op.c
135
136clean:
137 rm -f *.o *.log stm-arm-neon.refrvct