Home | History | Annotate | Download | only in arm-neon-tests
      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 CPU=cortex-a9
     23 # ARM RVCT
     24 CC.rvct := armcc
     25 CFLAGS.rvct = -g --cpu=$(CPU) --fp16_format=ieee -Ono_special_regs_postregalloc -I.
     26 LD.rvct := armlink
     27 LDFLAGS.rvct := --cpu=$(CPU) --entry 0x2000
     28 
     29 # GCC/ARM cross compiler
     30 CC.gccarm := arm-none-eabi-gcc
     31 CFLAGS.gccarm := -g -Wall -mcpu=$(CPU) -mfloat-abi=softfp -mfpu=neon -Wno-unused-variable -Wno-unused-function -ffast-math
     32 #LD.gccarm := $(LD.rvct)
     33 #LDFLAGS.gccarm := $(LDFLAGS.rvct)
     34 LD.gccarm := $(CC.gccarm)
     35 LDFLAGS.gccarm := $(CFLAGS.gccarm) -Tmop500-pm.ld
     36 
     37 # List of validated intrinsics
     38 REFNAMES = vld1 vadd vld1_lane vld1_dup vdup vget_high vget_low		\
     39 	   vqdmlal_lane vqdmlsl_lane vext vshrn_n vset_lane vget_lane	\
     40 	   vqsub vqdmulh_lane vqdmull vqdmlal vqdmlsl vceq vcge vcle	\
     41 	   vcgt vclt vbsl vshl vldX vdup_lane vrshrn_n vqdmull_lane	\
     42 	   vst1_lane vqshl vqshl_n vqrshrn_n vsub vqadd vabs vqabs	\
     43 	   vcombine vmax vmin vneg vqneg vmlal vmlal_lane vmlsl		\
     44 	   vmlsl_lane vmovl vmovn vmull vmull_lane vrev vrshl vshl_n	\
     45 	   vshr_n vsra_n vtrn vuzp vzip vreinterpret vqdmulh vqrdmulh	\
     46 	   vqrdmulh_lane vqrshl vaba vabal vabd vabdl vand vorr vorn	\
     47 	   veor vbic vcreate vldX_lane vldX_dup vmla vmls vmul		\
     48 	   vmul_lane vmul_n vmull_n vqdmulh_n vqdmull_n vqrdmulh_n	\
     49 	   vmla_lane vmls_lane vmla_n vmls_n vmlal_n vmlsl_n vqdmlal_n	\
     50 	   vqdmlsl_n vsri_n vsli_n vtst vaddhn vraddhn vaddl vaddw	\
     51 	   vhadd vrhadd vhsub vsubl vsubw vsubhn vrsubhn vmvn vqmovn	\
     52 	   vqmovun vrshr_n vrsra_n vshll_n vpaddl vpadd vpadal		\
     53 	   vqshlu_n vclz vcls vcnt vqshrn_n vpmax vpmin vqshrun_n	\
     54 	   vqrshrun_n vstX_lane vtbX vrecpe vrsqrte vcage vcagt vcale	\
     55 	   vcalt vrecps vrsqrts vcvt
     56 REFLIST = $(addprefix ref_, $(REFNAMES))
     57 
     58 REFNAMES_INT = integer dsp dspfns
     59 REFLIST_INT = $(addprefix ref_, $(REFNAMES_INT))
     60 
     61 all: ref-rvct.qemu
     62 
     63 check: check-rvct check-gccarm check-gccarm-rvct
     64 
     65 # Building reference files with RVCT
     66 REFOBJS.rvct = $(addsuffix .rvct.o, $(REFLIST) $(REFLIST_INT))
     67 REFRVCT=stm-arm-neon.refrvct
     68 ref-rvct: $(REFRVCT)
     69 ref-rvct.qemu: $(REFRVCT).qemu
     70 
     71 check-rvct: $(REFRVCT)
     72 	diff $(REFRVCT) ref-rvct-all.txt
     73 
     74 $(REFRVCT): compute_ref.axf
     75 	rvdebug -stdiolog=stdio.log -jou=journal.log -log=log.log -nologo -cmd -init @coretile.core.cpu0@RTSM -inc armscript.inc -exec $^
     76 
     77 $(REFRVCT).qemu: compute_ref.axf
     78 	qemu-system-arm -cpu $(CPU) -semihosting -nographic -kernel $^
     79 # Avoid rebuilding compute_ref.axf if already present, for users who
     80 # don't have rvct
     81 .PRECIOUS .INTERMEDIATE: compute_ref.rvct.o retarget.rvct.o	\
     82 	InitCache.o Init.o $(REFOBJS.rvct)
     83 
     84 compute_ref.axf: scatter.scat compute_ref.rvct.o retarget.rvct.o	\
     85 	InitCache.o Init.o $(REFOBJS.rvct)
     86 	$(LD.rvct) $(LDFLAGS.rvct) --scatter $^ -o $@
     87 
     88 compute_ref.rvct.o retarget.rvct.o: %.rvct.o: %.c
     89 	$(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@ -DREFFILE=\"$(REFRVCT)\" -DGCCTESTS_FILE=\"expected_input4gcc.txt\"
     90 
     91 ref_%.rvct.o: ref_%.c stm-arm-neon-ref.h
     92 	$(CC.rvct) $(CFLAGS.rvct) -c $< -o $@
     93 
     94 InitCache.o Init.o: %.o: %.s
     95 	$(CC.rvct) $(CFLAGS.rvct) -c $^ -o $@
     96 
     97 
     98 # Building reference files with GCC/ARM. Link with GCC/ld.
     99 REFOBJS.gccarm = $(addsuffix .gccarm.o, $(REFLIST))
    100 REFGCCARM=stm-arm-neon.gccarm
    101 ref-gccarm: $(REFGCCARM)
    102 
    103 check-gccarm: $(REFGCCARM)
    104 	diff  $(REFGCCARM) ref-rvct-neon-nofp16.txt
    105 
    106 $(REFGCCARM): compute_ref.gccarm
    107 	rvdebug -stdiolog=stdio.log -jou=journal.log -log=log.log -nologo -cmd -init @coretile.core.cpu0@RTSM -inc armscript.inc -exec $^
    108 
    109 compute_ref.gccarm: compute_ref.gccarm.o $(REFOBJS.gccarm)
    110 	$(LD.gccarm) $(LDFLAGS.gccarm) $^ -o $@
    111 
    112 compute_ref.gccarm.o: %.gccarm.o: %.c
    113 	$(CC.gccarm) $(CFLAGS.gccarm) -c $^ -o $@ -DREFFILE=\"$(REFGCCARM)\"
    114 
    115 # Building reference files with GCC/ARM. Link with armlink.
    116 REFGCCARM_RVCT=stm-arm-neon.gccarm-rvct
    117 ref-gccarm-rvct: $(REFGCCARM_RVCT)
    118 
    119 check-gccarm-rvct: $(REFGCCARM_RVCT)
    120 	diff $(REFGCCARM_RVCT) ref-rvct-neon-nofp16.txt
    121 
    122 $(REFGCCARM_RVCT): compute_ref.gccarm-rvct
    123 	rvdebug -stdiolog=stdio.log -jou=journal.log -log=log.log -nologo -cmd -init @coretile.core.cpu0@RTSM -inc armscript.inc -exec $^
    124 
    125 compute_ref.gccarm-rvct: scatter.scat compute_ref.gccarm-rvct.o	\
    126 	retarget.rvct.o InitCache.o Init.o $(REFOBJS.gccarm)
    127 	$(LD.rvct) $(LDFLAGS.rvct) --no_strict_wchar_size --scatter $^ -o $@
    128 
    129 compute_ref.gccarm-rvct.o: %.gccarm-rvct.o: %.c
    130 	$(CC.gccarm) $(CFLAGS.gccarm) -c $^ -o $@ -DREFFILE=\"$(REFGCCARM_RVCT)\"
    131 
    132 ref_%.gccarm.o: ref_%.c stm-arm-neon-ref.h
    133 	$(CC.gccarm) $(CFLAGS.gccarm) -c $< -o $@
    134 
    135 # Use '*' rather than '%' in these rules:
    136 # - using '%' does not make them add to the implicit rules above (they
    137 #   are different rules, only the 1st one matches)
    138 # - they are needed only when the target already exists, so the
    139 #   wildcard matches when needed.
    140 # - if the target does not already exist, the implicit rules apply.
    141 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
    142 ref_vqadd.*.o ref_vqsub.*.o: ref_v_binary_sat_op.c
    143 ref_vabs.*.o ref_vneg.*.o  ref_vmvn.*.o: ref_v_unary_op.c
    144 ref_vqabs.*.o ref_vqneg.*.o: ref_v_unary_sat_op.c
    145 ref_vceq.*.o ref_vcge.*.o ref_vcle.*.o ref_vcgt.*.o ref_vclt.*.o: ref_v_comp_op.c
    146 ref_vhadd.*.o ref_vrhadd.*.o ref_vhsub.*.o ref_vmin.*.o: ref_vmax.c
    147 ref_vmls.*.o: ref_vmla.c
    148 ref_vmls_lane.*.o: ref_vmla_lane.c
    149 ref_vmls_n.*.o: ref_vmla_n.c
    150 ref_vmlsl.*.o: ref_vmlal.c
    151 ref_vmlsl_lane.*.o: ref_vmlal_lane.c
    152 ref_vmlsl_n.*.o: ref_vmlal_n.c
    153 ref_vqdmlsl.*.o: ref_vqdmlal.c
    154 ref_vqdmlsl_lane.*.o: ref_vqdmlal_lane.c
    155 ref_vqdmlsl_n.*.o: ref_vqdmlal_n.c
    156 ref_vtrn.*.o ref_vzip.*.o: ref_vuzp.c
    157 ref_vsli_n.*.o ref_vsri_n.*.o: ref_vsXi_n.c
    158 ref_vsli_n.*.o: ref_vsli_n.c
    159 ref_vsri_n.*.o: ref_vsri_n.c
    160 ref_vraddhn.*.o ref_vsubhn.*.o ref_vrsubhn.*.o: ref_vaddhn.c
    161 ref_vsubl.*.o: ref_vaddl.c
    162 ref_vsubw.*.o: ref_vaddw.c
    163 ref_vcage.*.o ref_vcale.*.o ref_vcagt.*.o ref_vcalt.*.o: ref_v_comp_f_op.c
    164 
    165 clean:
    166 	rm -f *.o *.log stm-arm-neon.refrvct expected_input4gcc.txt
    167