| 1 | ## |
| 2 | ## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved. |
| 3 | ## |
| 4 | ## This program is free software; you can redistribute it and/or modify |
| 5 | ## it under the terms of the GNU General Public License as published by |
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
| 7 | ## (at your option) any later version. |
| 8 | ## |
| 9 | ## This program is distributed in the hope that it will be useful, |
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | ## GNU General Public License for more details. |
| 13 | ## |
| 14 | ## You should have received a copy of the GNU General Public License |
| 15 | ## along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | ## |
| 17 | |
| 18 | # Hexagon doesn't support gdb, so skip the EXTRA_RUNS |
| 19 | EXTRA_RUNS = |
| 20 | |
| 21 | CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal |
| 22 | CFLAGS += -fno-unroll-loops -fno-stack-protector |
| 23 | |
| 24 | HEX_SRC=$(SRC_PATH)/tests/tcg/hexagon |
| 25 | VPATH += $(HEX_SRC) |
| 26 | |
| 27 | %: $(HEX_SRC)/%.S $(HEX_SRC)/crt.S |
| 28 | $(CC) -static -mv67 -nostdlib $^ -o $@ |
| 29 | |
| 30 | HEX_TESTS = first |
| 31 | HEX_TESTS += hex_sigsegv |
| 32 | HEX_TESTS += misc |
| 33 | HEX_TESTS += usr |
| 34 | HEX_TESTS += preg_alias |
| 35 | HEX_TESTS += dual_stores |
| 36 | HEX_TESTS += multi_result |
| 37 | HEX_TESTS += mem_noshuf |
| 38 | HEX_TESTS += mem_noshuf_exception |
| 39 | HEX_TESTS += circ |
| 40 | HEX_TESTS += brev |
| 41 | HEX_TESTS += load_unpack |
| 42 | HEX_TESTS += load_align |
| 43 | HEX_TESTS += atomics |
| 44 | HEX_TESTS += fpstuff |
| 45 | HEX_TESTS += overflow |
| 46 | HEX_TESTS += signal_context |
| 47 | HEX_TESTS += reg_mut |
| 48 | HEX_TESTS += read_write_overlap |
| 49 | HEX_TESTS += vector_add_int |
| 50 | HEX_TESTS += scatter_gather |
| 51 | HEX_TESTS += hvx_misc |
| 52 | HEX_TESTS += hvx_histogram |
| 53 | HEX_TESTS += fp_hvx |
| 54 | HEX_TESTS += fp_hvx_cvt |
| 55 | HEX_TESTS += fp_hvx_cmp |
| 56 | HEX_TESTS += fp_hvx_disabled |
| 57 | HEX_TESTS += invalid-slots |
| 58 | HEX_TESTS += valid-slots |
| 59 | HEX_TESTS += invalid-encoding |
| 60 | HEX_TESTS += multiple-writes |
| 61 | HEX_TESTS += unaligned_pc |
| 62 | HEX_TESTS += unaligned_data |
| 63 | |
| 64 | HEX_TESTS += test_abs |
| 65 | HEX_TESTS += test_bitcnt |
| 66 | HEX_TESTS += test_bitsplit |
| 67 | HEX_TESTS += test_call |
| 68 | HEX_TESTS += test_clobber |
| 69 | HEX_TESTS += test_cmp |
| 70 | HEX_TESTS += test_dotnew |
| 71 | HEX_TESTS += test_ext |
| 72 | HEX_TESTS += test_fibonacci |
| 73 | HEX_TESTS += test_hl |
| 74 | HEX_TESTS += test_hwloops |
| 75 | HEX_TESTS += test_jmp |
| 76 | HEX_TESTS += test_lsr |
| 77 | HEX_TESTS += test_mpyi |
| 78 | HEX_TESTS += test_packet |
| 79 | HEX_TESTS += test_reorder |
| 80 | HEX_TESTS += test_round |
| 81 | HEX_TESTS += test_vavgw |
| 82 | HEX_TESTS += test_vcmpb |
| 83 | HEX_TESTS += test_vcmpw |
| 84 | HEX_TESTS += test_vlsrw |
| 85 | HEX_TESTS += test_vmaxh |
| 86 | HEX_TESTS += test_vminh |
| 87 | HEX_TESTS += test_vpmpyh |
| 88 | HEX_TESTS += test_vspliceb |
| 89 | |
| 90 | HEX_TESTS += check_rev_gating |
| 91 | HEX_TESTS += test_pnew_jump_loads |
| 92 | |
| 93 | HEX_TESTS += v68_scalar |
| 94 | HEX_TESTS += v68_hvx |
| 95 | HEX_TESTS += v69_hvx |
| 96 | HEX_TESTS += v73_scalar |
| 97 | |
| 98 | TESTS += $(HEX_TESTS) |
| 99 | |
| 100 | atomics: atomics.c hex_test.h |
| 101 | brev: brev.c hex_test.h |
| 102 | circ: circ.c hex_test.h |
| 103 | dual_stores: dual_stores.c hex_test.h |
| 104 | fpstuff: fpstuff.c hex_test.h |
| 105 | hex_sigsegv: hex_sigsegv.c hex_test.h |
| 106 | load_align: load_align.c hex_test.h |
| 107 | load_unpack: load_unpack.c hex_test.h |
| 108 | mem_noshuf_exception: mem_noshuf_exception.c hex_test.h |
| 109 | mem_noshuf: mem_noshuf.c hex_test.h |
| 110 | misc: misc.c hex_test.h |
| 111 | multi_result: multi_result.c hex_test.h |
| 112 | overflow: overflow.c hex_test.h |
| 113 | preg_alias: preg_alias.c hex_test.h |
| 114 | read_write_overlap: read_write_overlap.c hex_test.h |
| 115 | reg_mut: reg_mut.c hex_test.h |
| 116 | test_pnew_jump_loads: test_pnew_jump_loads.c hex_test.h |
| 117 | unaligned_data: unaligned_data.c hex_test.h |
| 118 | unaligned_pc: unaligned_pc.c |
| 119 | |
| 120 | # Compile for v66 so that the ELF selects a v66 CPU; the test then |
| 121 | # exercises revision gating by executing a v68 .word instruction. |
| 122 | run-check_rev_gating: QEMU_OPTS += -cpu v66 |
| 123 | check_rev_gating: check_rev_gating.c |
| 124 | $(CC) $(CFLAGS) -mv66 -O2 $< -o $@ $(LDFLAGS) |
| 125 | |
| 126 | # This test has to be compiled for the -mv67t target |
| 127 | usr: usr.c hex_test.h |
| 128 | $(CC) $(CFLAGS) -mv67t -O2 -Wno-inline-asm -Wno-expansion-to-defined $< -o $@ $(LDFLAGS) |
| 129 | |
| 130 | # Build this test with -mv71 to exercise the CABAC instruction |
| 131 | misc: misc.c |
| 132 | $(CC) $(CFLAGS) -mv71 -O2 $< -o $@ $(LDFLAGS) |
| 133 | scatter_gather: CFLAGS += -mhvx |
| 134 | vector_add_int: CFLAGS += -mhvx -fvectorize |
| 135 | hvx_misc: hvx_misc.c hvx_misc.h |
| 136 | hvx_misc: CFLAGS += -mhvx |
| 137 | hvx_histogram: CFLAGS += -mhvx -Wno-gnu-folding-constant |
| 138 | v68_hvx: v68_hvx.c hvx_misc.h v6mpy_ref.c.inc |
| 139 | v68_hvx: CFLAGS += -mhvx -Wno-unused-function |
| 140 | v69_hvx: v69_hvx.c hvx_misc.h |
| 141 | v69_hvx: CFLAGS += -mhvx -Wno-unused-function |
| 142 | v73_scalar: CFLAGS += -Wno-unused-function |
| 143 | fp_hvx: fp_hvx.c hvx_misc.h hex_test.h |
| 144 | fp_hvx: CFLAGS += -mhvx -mhvx-ieee-fp |
| 145 | fp_hvx_disabled: fp_hvx_disabled.c hvx_misc.h hex_test.h |
| 146 | fp_hvx_disabled: CFLAGS += -mhvx -mhvx-ieee-fp |
| 147 | fp_hvx_cvt: fp_hvx_cvt.c hvx_misc.h hex_test.h |
| 148 | fp_hvx_cvt: CFLAGS += -mhvx -mhvx-ieee-fp |
| 149 | fp_hvx_cmp: fp_hvx_cmp.c hvx_misc.h hex_test.h |
| 150 | fp_hvx_cmp: CFLAGS += -mhvx -mhvx-ieee-fp |
| 151 | |
| 152 | run-fp_hvx_disabled: QEMU_OPTS += -cpu v73,ieee-fp=false |
| 153 | |
| 154 | hvx_histogram: hvx_histogram.c hvx_histogram_row.S |
| 155 | $(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS) |
| 156 | |
| 157 | ifeq ($(CONFIG_PLUGIN),y) |
| 158 | # LLVM is way too aggressive with inlining and dead code elimination even at |
| 159 | # -O0, which interferes with the test. What looks like dead code in this test |
| 160 | # to the compiler isn't actually dead code, so we need to disable all potential |
| 161 | # LLVM optimization passes. |
| 162 | test-plugin-set-pc: CFLAGS += -Xclang -disable-llvm-passes |
| 163 | endif |