xref: /aosp_15_r20/external/arm-neon-tests/Makefile.gcc (revision f37826520a923688f9e110915f3811e385d8b6d1)
1*f3782652STreehugger Robot# Copyright (c) 2014 STMicroelectronics
2*f3782652STreehugger Robot# Written by Christophe Lyon
3*f3782652STreehugger Robot
4*f3782652STreehugger Robot# Permission is hereby granted, free of charge, to any person obtaining a copy
5*f3782652STreehugger Robot# of this software and associated documentation files (the "Software"), to deal
6*f3782652STreehugger Robot# in the Software without restriction, including without limitation the rights
7*f3782652STreehugger Robot# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8*f3782652STreehugger Robot# copies of the Software, and to permit persons to whom the Software is
9*f3782652STreehugger Robot# furnished to do so, subject to the following conditions:
10*f3782652STreehugger Robot
11*f3782652STreehugger Robot# The above copyright notice and this permission notice shall be included in
12*f3782652STreehugger Robot# all copies or substantial portions of the Software.
13*f3782652STreehugger Robot
14*f3782652STreehugger Robot# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*f3782652STreehugger Robot# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*f3782652STreehugger Robot# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17*f3782652STreehugger Robot# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18*f3782652STreehugger Robot# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19*f3782652STreehugger Robot# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20*f3782652STreehugger Robot# THE SOFTWARE.
21*f3782652STreehugger Robot
22*f3782652STreehugger Robot# This Makefile is aimed at helping GCC validation, for ARM and
23*f3782652STreehugger Robot# AArch64 targets.
24*f3782652STreehugger Robot# For example:
25*f3782652STreehugger Robot# $ make -f Makefile.gcc clean
26*f3782652STreehugger Robot# $ make -f Makefile.gcc CC.gccarm=/path/to/gcc check
27*f3782652STreehugger Robot# Note that this will use qemu-system-arm as execution engine which
28*f3782652STreehugger Robot# may not be what you want.
29*f3782652STreehugger Robot# Alternatively:
30*f3782652STreehugger Robot# $ make -f Makefile.gcc clean
31*f3782652STreehugger Robot# $ make -f Makefile.gcc CC.gccarm=/path/to/gcc compute_ref.gccarm
32*f3782652STreehugger Robot# $ /path/to/qemu -L /path/to/sysroot/lib compute_ref.gccarm
33*f3782652STreehugger Robot# $ diff stm-arm-neon.gccarm ref-rvct-neon.txt
34*f3782652STreehugger Robot
35*f3782652STreehugger RobotCPU=cortex-a9
36*f3782652STreehugger Robot
37*f3782652STreehugger Robot# GCC/ARM cross compiler
38*f3782652STreehugger RobotCC.gccarm := arm-none-eabi-gcc
39*f3782652STreehugger RobotCFLAGS.gccarm := -g -Wall -mcpu=$(CPU) -mfloat-abi=hard -mfpu=neon -Wno-unused-variable -Wno-unused-function -ffast-math
40*f3782652STreehugger RobotLD.gccarm := $(CC.gccarm)
41*f3782652STreehugger RobotLDFLAGS.gccarm := $(CFLAGS.gccarm)
42*f3782652STreehugger Robot
43*f3782652STreehugger Robot# List of validated intrinsics
44*f3782652STreehugger RobotREFNAMES = vld1 vadd vld1_lane vld1_dup vdup vget_high vget_low		\
45*f3782652STreehugger Robot	   vqdmlal_lane vqdmlsl_lane vext vshrn_n vset_lane vget_lane	\
46*f3782652STreehugger Robot	   vqsub vqdmulh_lane vqdmull vqdmlal vqdmlsl vceq vcge vcle	\
47*f3782652STreehugger Robot	   vcgt vclt vbsl vshl vldX vdup_lane vrshrn_n vqdmull_lane	\
48*f3782652STreehugger Robot	   vst1_lane vqshl vqshl_n vqrshrn_n vsub vqadd vabs vqabs	\
49*f3782652STreehugger Robot	   vcombine vmax vmin vneg vqneg vmlal vmlal_lane vmlsl		\
50*f3782652STreehugger Robot	   vmlsl_lane vmovl vmovn vmull vmull_lane vrev vrshl vshl_n	\
51*f3782652STreehugger Robot	   vshr_n vsra_n vtrn vuzp vzip vreinterpret vqdmulh vqrdmulh	\
52*f3782652STreehugger Robot	   vqrdmulh_lane vqrshl vaba vabal vabd vabdl vand vorr vorn	\
53*f3782652STreehugger Robot	   veor vbic vcreate vldX_lane vldX_dup vmla vmls vmul		\
54*f3782652STreehugger Robot	   vmul_lane vmul_n vmull_n vqdmulh_n vqdmull_n vqrdmulh_n	\
55*f3782652STreehugger Robot	   vmla_lane vmls_lane vmla_n vmls_n vmlal_n vmlsl_n vqdmlal_n	\
56*f3782652STreehugger Robot	   vqdmlsl_n vsri_n vsli_n vtst vaddhn vraddhn vaddl vaddw	\
57*f3782652STreehugger Robot	   vhadd vrhadd vhsub vsubl vsubw vsubhn vrsubhn vmvn vqmovn	\
58*f3782652STreehugger Robot	   vqmovun vrshr_n vrsra_n vshll_n vpaddl vpadd vpadal		\
59*f3782652STreehugger Robot	   vqshlu_n vclz vcls vcnt vqshrn_n vpmax vpmin vqshrun_n	\
60*f3782652STreehugger Robot	   vqrshrun_n vstX_lane vtbX vrecpe vrsqrte vcage vcagt vcale	\
61*f3782652STreehugger Robot	   vcalt vrecps vrsqrts vcvt
62*f3782652STreehugger RobotREFLIST = $(addprefix ref_, $(REFNAMES))
63*f3782652STreehugger Robot
64*f3782652STreehugger RobotREFNAMES_INT = integer dsp dspfns
65*f3782652STreehugger RobotREFLIST_INT = $(addprefix ref_, $(REFNAMES_INT))
66*f3782652STreehugger Robot
67*f3782652STreehugger Robotall: ref-gccarm
68*f3782652STreehugger Robot
69*f3782652STreehugger Robotcheck: check-gccarm
70*f3782652STreehugger Robot
71*f3782652STreehugger Robot# Building reference files with GCC/ARM. Link with GCC/ld.
72*f3782652STreehugger RobotREFOBJS.gccarm = $(addsuffix .gccarm.o, $(REFLIST))
73*f3782652STreehugger RobotREFGCCARM=stm-arm-neon.gccarm
74*f3782652STreehugger Robotref-gccarm: $(REFGCCARM)
75*f3782652STreehugger Robot
76*f3782652STreehugger Robotcheck-gccarm: $(REFGCCARM)
77*f3782652STreehugger Robot	diff  $(REFGCCARM) ref-rvct-neon.txt
78*f3782652STreehugger Robot
79*f3782652STreehugger RobotSIM=qemu-system-arm
80*f3782652STreehugger RobotSIMFLAGS=-cpu $(CPU) -semihosting -nographic -kernel
81*f3782652STreehugger Robot$(REFGCCARM): compute_ref.gccarm
82*f3782652STreehugger Robot	$(SIM) $(SIMFLAGS) $^
83*f3782652STreehugger Robot
84*f3782652STreehugger Robotcompute_ref.gccarm: compute_ref.gccarm.o $(REFOBJS.gccarm)
85*f3782652STreehugger Robot	$(LD.gccarm) $(LDFLAGS.gccarm) $^ -o $@
86*f3782652STreehugger Robot
87*f3782652STreehugger Robotcompute_ref.gccarm.o: %.gccarm.o: %.c
88*f3782652STreehugger Robot	$(CC.gccarm) $(CFLAGS.gccarm) -c $^ -o $@ -DREFFILE=\"$(REFGCCARM)\" -DGCCTESTS_FILE=\"expected_input4gcc.txt\"
89*f3782652STreehugger Robot
90*f3782652STreehugger Robotref_%.gccarm.o: ref_%.c stm-arm-neon-ref.h
91*f3782652STreehugger Robot	$(CC.gccarm) $(CFLAGS.gccarm) -c $< -o $@
92*f3782652STreehugger Robot
93*f3782652STreehugger Robot# Use '*' rather than '%' in these rules:
94*f3782652STreehugger Robot# - using '%' does not make them add to the implicit rules above (they
95*f3782652STreehugger Robot#   are different rules, only the 1st one matches)
96*f3782652STreehugger Robot# - they are needed only when the target already exists, so the
97*f3782652STreehugger Robot#   wildcard matches when needed.
98*f3782652STreehugger Robot# - if the target does not already exist, the implicit rules apply.
99*f3782652STreehugger Robotref_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
100*f3782652STreehugger Robotref_vqadd.*.o ref_vqsub.*.o: ref_v_binary_sat_op.c
101*f3782652STreehugger Robotref_vabs.*.o ref_vneg.*.o  ref_vmvn.*.o: ref_v_unary_op.c
102*f3782652STreehugger Robotref_vqabs.*.o ref_vqneg.*.o: ref_v_unary_sat_op.c
103*f3782652STreehugger Robotref_vceq.*.o ref_vcge.*.o ref_vcle.*.o ref_vcgt.*.o ref_vclt.*.o: ref_v_comp_op.c
104*f3782652STreehugger Robotref_vhadd.*.o ref_vrhadd.*.o ref_vhsub.*.o ref_vmin.*.o: ref_vmax.c
105*f3782652STreehugger Robotref_vmls.*.o: ref_vmla.c
106*f3782652STreehugger Robotref_vmls_lane.*.o: ref_vmla_lane.c
107*f3782652STreehugger Robotref_vmls_n.*.o: ref_vmla_n.c
108*f3782652STreehugger Robotref_vmlsl.*.o: ref_vmlal.c
109*f3782652STreehugger Robotref_vmlsl_lane.*.o: ref_vmlal_lane.c
110*f3782652STreehugger Robotref_vmlsl_n.*.o: ref_vmlal_n.c
111*f3782652STreehugger Robotref_vqdmlsl.*.o: ref_vqdmlal.c
112*f3782652STreehugger Robotref_vqdmlsl_lane.*.o: ref_vqdmlal_lane.c
113*f3782652STreehugger Robotref_vqdmlsl_n.*.o: ref_vqdmlal_n.c
114*f3782652STreehugger Robotref_vtrn.*.o ref_vzip.*.o: ref_vuzp.c
115*f3782652STreehugger Robotref_vsli_n.*.o ref_vsri_n.*.o: ref_vsXi_n.c
116*f3782652STreehugger Robotref_vsli_n.*.o: ref_vsli_n.c
117*f3782652STreehugger Robotref_vsri_n.*.o: ref_vsri_n.c
118*f3782652STreehugger Robotref_vraddhn.*.o ref_vsubhn.*.o ref_vrsubhn.*.o: ref_vaddhn.c
119*f3782652STreehugger Robotref_vsubl.*.o: ref_vaddl.c
120*f3782652STreehugger Robotref_vsubw.*.o: ref_vaddw.c
121*f3782652STreehugger Robotref_vcage.*.o ref_vcale.*.o ref_vcagt.*.o ref_vcalt.*.o: ref_v_comp_f_op.c
122*f3782652STreehugger Robot
123*f3782652STreehugger Robotclean:
124*f3782652STreehugger Robot	rm -f *.o *.log
125