Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 1 | # 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 |
| 23 | CC.rvct := armcc |
| 24 | CFLAGS.rvct = -g --cpu=cortex-a9 -Ono_special_regs_postregalloc -I. |
| 25 | LD.rvct := armlink |
| 26 | LDFLAGS.rvct := --cpu=cortex-a9 --entry 0x2000 |
| 27 | |
| 28 | # GCC/ARM cross compiler |
| 29 | CC.gccarm := arm-none-eabi-gcc |
| 30 | CFLAGS.gccarm := -g -Wall -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon -fshort-wchar -Wno-unused-variable -Wno-unused-function |
| 31 | LD.gccarm := armlink |
| 32 | LDFLAGS.gccarm := --cpu=cortex-a9 --entry 0x2000 |
| 33 | |
| 34 | # List of validated intrinsics |
| 35 | REFNAMES = 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 |
| 53 | REFLIST = $(addprefix ref_, $(REFNAMES)) |
| 54 | |
| 55 | all: ref-rvct.qemu |
| 56 | |
| 57 | check: |
| 58 | diff stm-arm-neon.refrvct ref-rvct.txt |
| 59 | |
| 60 | # Building reference files with RVCT |
| 61 | REFOBJS.rvct = $(addsuffix .rvct.o, $(REFLIST)) |
| 62 | REFRVCT=stm-arm-neon.refrvct |
| 63 | ref-rvct: $(REFRVCT) |
| 64 | ref-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 Lyon | 2eeafa4 | 2011-01-24 18:02:18 +0100 | [diff] [blame] | 71 | # Avoid rebuilding compute_ref.axf if already present, for users who |
| 72 | # don't have rvct |
Christophe Lyon | a6b7ca2 | 2011-02-08 18:33:03 +0100 | [diff] [blame^] | 73 | .PRECIOUS .INTERMEDIATE: compute_ref.rvct.o retarget.rvct.o \ |
| 74 | InitCache.o Init.o $(REFOBJS.rvct) |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 75 | |
| 76 | compute_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 | |
| 80 | compute_ref.rvct.o retarget.rvct.o: %.rvct.o: %.c |
| 81 | $(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@ -DREFFILE=\"$(REFRVCT)\" |
| 82 | |
Christophe Lyon | 2eeafa4 | 2011-01-24 18:02:18 +0100 | [diff] [blame] | 83 | ref_%.rvct.o: ref_%.c stm-arm-neon-ref.h |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 84 | $(CC.rvct) $(CFLAGS.rvct) -c $< -o $@ |
| 85 | |
| 86 | InitCache.o Init.o: %.o: %.s |
| 87 | $(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@ |
| 88 | |
| 89 | |
| 90 | # Building reference files with GCC/ARM |
| 91 | REFOBJS.gccarm = $(addsuffix .gccarm.o, $(REFLIST)) |
| 92 | REFGCCARM=stm-arm-neon.gccarm |
| 93 | ref-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 | |
| 98 | compute_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 | |
| 102 | compute_ref.gccarm.o: %.gccarm.o: %.c |
| 103 | $(CC.gccarm) $(CFLAGS.gccarm) -c $^ -o $@ -DREFFILE=\"$(REFGCCARM)\" |
| 104 | |
| 105 | ref_%.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. |
| 114 | ref_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 |
| 115 | ref_vqadd.*.o ref_vqsub.*.o: ref_v_binary_sat_op.c |
| 116 | ref_vabs.*.o ref_vneg.*.o ref_vmvn.*.o: ref_v_unary_op.c |
| 117 | ref_vqabs.*.o ref_vqneg.*.o: ref_v_unary_sat_op.c |
| 118 | ref_vceq.*.o ref_vcge.*.o ref_vcle.*.o ref_vcgt.*.o ref_vclt.*.o: ref_v_comp_op.c |
| 119 | ref_vhadd.*.o ref_vrhadd.*.o ref_vhsub.*.o ref_vmin.*.o: ref_vmax.c |
| 120 | ref_vmls.*.o: ref_vmla.c |
| 121 | ref_vmls_lane.*.o: ref_vmla_lane.c |
| 122 | ref_vmls_n.*.o: ref_vmla_n.c |
| 123 | ref_vmlsl.*.o: ref_vmlal.c |
| 124 | ref_vmlsl_lane.*.o: ref_vmlal_lane.c |
| 125 | ref_vmlsl_n.*.o: ref_vmlal_n.c |
| 126 | ref_vqdmlsl.*.o: ref_vqdmlal.c |
| 127 | ref_vqdmlsl_lane.*.o: ref_vqdmlal_lane.c |
| 128 | ref_vqdmlsl_n.*.o: ref_vqdmlal_n.c |
| 129 | ref_vtrn.*.o ref_vzip.*.o: ref_vuzp.c |
Christophe Lyon | f0ecb5a | 2011-02-08 18:15:05 +0100 | [diff] [blame] | 130 | ref_vsli_n.*.o ref_vsri_n.*.o: ref_vsXi_n.c |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 131 | ref_vraddhn.*.o ref_vsubhn.*.o ref_vrsubhn.*.o: ref_vaddhn.c |
| 132 | ref_vsubl.*.o: ref_vaddl.c |
| 133 | ref_vsubw.*.o: ref_vaddw.c |
| 134 | ref_vcage.*.o ref_vcale.*.o ref_vcagt.*.o ref_vcalt.*.o: ref_v_comp_f_op.c |
| 135 | |
| 136 | clean: |
| 137 | rm -f *.o *.log stm-arm-neon.refrvct |