0efb12823cbf4fe183c41b0013cca50e5a55999e
[riscv-tests.git] / isa / rv64ui / Makefile
1 #=======================================================================
2 # Makefile for riscv-tests
3 #-----------------------------------------------------------------------
4
5 default: all
6
7 #--------------------------------------------------------------------
8 # Sources
9 #--------------------------------------------------------------------
10
11 rv64ui_sc_tests = \
12 add addi addiw addw \
13 amoadd_d amoand_d amomax_d amomaxu_d amomin_d amominu_d amoor_d amoswap_d \
14 amoadd_w amoand_w amomax_w amomaxu_w amomin_w amominu_w amoor_w amoswap_w \
15 and andi \
16 auipc \
17 beq bge bgeu blt bltu bne \
18 div divu divuw divw \
19 example simple \
20 fence_i \
21 j jal jalr jalr_j jalr_r \
22 lb lbu lh lhu lw lwu ld \
23 lui \
24 mul mulh mulhsu mulhu mulw \
25 or ori \
26 rem remu remuw remw \
27 sb sh sw sd \
28 sll slli slliw sllw \
29 slt slti sltiu sltu \
30 sra srai sraiw sraw \
31 srl srli srliw srlw \
32 sub subw \
33 xor xori \
34
35 rv64ui_mc_tests =\
36 lrsc
37
38 rv64ui_sc_vec_tests = \
39 add addi addiw addw \
40 and andi \
41 lui \
42 mul mulh mulhsu mulhu mulw \
43 or ori \
44 sll slli slliw sllw \
45 slt slti sltiu sltu \
46 sra srai sraiw sraw \
47 srl srli srliw srlw \
48 sub subw \
49 xor xori \
50
51 #--------------------------------------------------------------------
52 # Build rules
53 #--------------------------------------------------------------------
54
55 RISCV_GCC = riscv-gcc
56 RISCV_GCC_OPTS = -nostdlib -nostartfiles
57 RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.data --section=.bss
58 RISCV_SIM = riscv-isa-run
59
60 #------------------------------------------------------------
61 # Build assembly tests
62
63 %.hex: %
64 elf2hex 16 16384 $< > $@
65
66 %.dump: %
67 $(RISCV_OBJDUMP) $< > $@
68
69 %.out: %
70 $(RISCV_SIM) $< 2> $@
71
72 rv64ui_p_tests_bin = $(addprefix rv64ui-p-, $(rv64ui_sc_tests))
73 rv64ui_p_tests_dump = $(addsuffix .dump, $(rv64ui_p_tests_bin))
74 rv64ui_p_tests_hex = $(addsuffix .hex, $(rv64ui_p_tests_bin))
75 rv64ui_p_tests_out = $(addsuffix .out, $(rv64ui_p_tests_bin))
76
77 $(rv64ui_p_tests_bin): rv64ui-p-%: %.S
78 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/scalar -T../../env/p/link.ld $< -o $@
79
80 rv64ui_pm_tests_bin = $(addprefix rv64ui-pm-, $(rv64ui_mc_tests))
81 rv64ui_pm_tests_dump = $(addsuffix .dump, $(rv64ui_pm_tests_bin))
82 rv64ui_pm_tests_hex = $(addsuffix .hex, $(rv64ui_pm_tests_bin))
83 rv64ui_pm_tests_out = $(addsuffix .out, $(rv64ui_pm_tests_bin))
84
85 $(rv64ui_pm_tests_bin): rv64ui-pm-%: %.S
86 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pm -I../macros/scalar -T../../env/pm/link.ld $< -o $@
87
88 rv64ui_v_tests_bin = $(addprefix rv64ui-v-, $(rv64ui_sc_tests))
89 rv64ui_v_tests_dump = $(addsuffix .dump, $(rv64ui_v_tests_bin))
90 rv64ui_v_tests_hex = $(addsuffix .hex, $(rv64ui_v_tests_bin))
91 rv64ui_v_tests_out = $(addsuffix .out, $(rv64ui_v_tests_bin))
92
93 $(rv64ui_v_tests_bin): rv64ui-v-%: %.S
94 $(RISCV_GCC) $(RISCV_GCC_OPTS) -std=gnu99 -O2 -I../../env/v -I../macros/scalar -T../../env/v/link.ld ../../env/v/entry.S ../../env/v/vm.c $< -lc -o $@
95
96 rv64ui_p_vec_tests_bin = $(addprefix rv64ui-p-vec-, $(rv64ui_sc_vec_tests))
97 rv64ui_p_vec_tests_dump = $(addsuffix .dump, $(rv64ui_p_vec_tests_bin))
98 rv64ui_p_vec_tests_hex = $(addsuffix .hex, $(rv64ui_p_vec_tests_bin))
99 rv64ui_p_vec_tests_out = $(addsuffix .out, $(rv64ui_p_vec_tests_bin))
100
101 $(rv64ui_p_vec_tests_bin): rv64ui-p-vec-%: %.S
102 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/vector -T../../env/p/link.ld $< -o $@
103
104 rv64ui_pt_vec_tests_bin = $(addprefix rv64ui-pt-vec-, $(rv64ui_sc_vec_tests))
105 rv64ui_pt_vec_tests_dump = $(addsuffix .dump, $(rv64ui_pt_vec_tests_bin))
106 rv64ui_pt_vec_tests_hex = $(addsuffix .hex, $(rv64ui_pt_vec_tests_bin))
107 rv64ui_pt_vec_tests_out = $(addsuffix .out, $(rv64ui_pt_vec_tests_bin))
108
109 $(rv64ui_pt_vec_tests_bin): rv64ui-pt-vec-%: %.S
110 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pt -I../macros/vector -T../../env/pt/link.ld $< -o $@
111
112 rv64ui_v_vec_tests_bin = $(addprefix rv64ui-v-vec-, $(rv64ui_sc_vec_tests))
113 rv64ui_v_vec_tests_dump = $(addsuffix .dump, $(rv64ui_v_vec_tests_bin))
114 rv64ui_v_vec_tests_hex = $(addsuffix .hex, $(rv64ui_v_vec_tests_bin))
115 rv64ui_v_vec_tests_out = $(addsuffix .out, $(rv64ui_v_vec_tests_bin))
116
117 $(rv64ui_v_vec_tests_bin): rv64ui-v-vec-%: %.S
118 $(RISCV_GCC) $(RISCV_GCC_OPTS) -std=gnu99 -O2 -I../../env/v -I../macros/vector -T../../env/v/link.ld ../../env/v/entry.S ../../env/v/vm.c $< -lc -o $@
119
120 riscv-: \
121 $(rv64ui_p_tests_dump) $(rv64ui_p_tests_hex) \
122 $(rv64ui_pm_tests_dump) $(rv64ui_pm_tests_hex) \
123 $(rv64ui_v_tests_dump) $(rv64ui_v_tests_hex) \
124 $(rv64ui_p_vec_tests_dump) $(rv64ui_p_vec_tests_hex) \
125 $(rv64ui_pt_vec_tests_dump) $(rv64ui_pt_vec_tests_hex) \
126 $(rv64ui_v_vec_tests_dump) $(rv64ui_v_vec_tests_hex) \
127
128 out = $(rv64ui_p_tests_out) $(rv64ui_pm_tests_out) $(rv64ui_v_tests_out) $(rv64ui_p_vec_tests_out) $(rv64ui_v_vec_tests_out)
129
130 run: $(out)
131 echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
132 $(out); echo;
133
134 junk += \
135 $(rv64ui_p_tests_bin) $(rv64ui_p_tests_dump) $(rv64ui_p_tests_hex) $(rv64ui_p_tests_out) \
136 $(rv64ui_pm_tests_bin) $(rv64ui_pm_tests_dump) $(rv64ui_pm_tests_hex) $(rv64ui_pm_tests_out) \
137 $(rv64ui_v_tests_bin) $(rv64ui_v_tests_dump) $(rv64ui_v_tests_hex) $(rv64ui_v_tests_out) \
138 $(rv64ui_p_vec_tests_bin) $(rv64ui_p_vec_tests_dump) $(rv64ui_p_vec_tests_hex) $(rv64ui_p_vec_tests_out) \
139 $(rv64ui_pt_vec_tests_bin) $(rv64ui_pt_vec_tests_dump) $(rv64ui_pt_vec_tests_hex) $(rv64ui_pt_vec_tests_out) \
140 $(rv64ui_v_vec_tests_bin) $(rv64ui_v_vec_tests_dump) $(rv64ui_v_vec_tests_hex) $(rv64ui_v_vec_tests_out) \
141
142 #------------------------------------------------------------
143 # Default
144
145 all: riscv-
146
147 #------------------------------------------------------------
148 # Clean up
149
150 clean:
151 rm -rf $(junk)