tests/tcg/hexagon/Makefile.target | 146 ------------------------------
tests/tcg/hexagon/meson.build | 111 +++++++++++++++++++++++
tests/tcg/meson.build | 1 +
3 files changed, 112 insertions(+), 146 deletions(-)
delete mode 100644 tests/tcg/hexagon/Makefile.target
create mode 100644 tests/tcg/hexagon/meson.build
diff --git a/tests/tcg/hexagon/Makefile.target
b/tests/tcg/hexagon/Makefile.target
deleted file mode 100644
index 70a8ec2e7fb..00000000000
--- a/tests/tcg/hexagon/Makefile.target
+++ /dev/null
@@ -1,146 +0,0 @@
-##
-## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights
Reserved.
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, see <http://www.gnu.org/licenses/>.
-##
-
-# Hexagon doesn't support gdb, so skip the EXTRA_RUNS
-EXTRA_RUNS =
-
-CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal
-CFLAGS += -fno-unroll-loops -fno-stack-protector
-
-HEX_SRC=$(SRC_PATH)/tests/tcg/hexagon
-VPATH += $(HEX_SRC)
-
-%: $(HEX_SRC)/%.S $(HEX_SRC)/crt.S
- $(CC) -static -mv67 -nostdlib $^ -o $@
-
-HEX_TESTS = first
-HEX_TESTS += hex_sigsegv
-HEX_TESTS += misc
-HEX_TESTS += usr
-HEX_TESTS += preg_alias
-HEX_TESTS += dual_stores
-HEX_TESTS += multi_result
-HEX_TESTS += mem_noshuf
-HEX_TESTS += mem_noshuf_exception
-HEX_TESTS += circ
-HEX_TESTS += brev
-HEX_TESTS += load_unpack
-HEX_TESTS += load_align
-HEX_TESTS += atomics
-HEX_TESTS += fpstuff
-HEX_TESTS += overflow
-HEX_TESTS += signal_context
-HEX_TESTS += reg_mut
-HEX_TESTS += read_write_overlap
-HEX_TESTS += vector_add_int
-HEX_TESTS += scatter_gather
-HEX_TESTS += hvx_misc
-HEX_TESTS += hvx_histogram
-HEX_TESTS += invalid-slots
-HEX_TESTS += invalid-encoding
-HEX_TESTS += multiple-writes
-HEX_TESTS += unaligned_pc
-
-HEX_TESTS += test_abs
-HEX_TESTS += test_bitcnt
-HEX_TESTS += test_bitsplit
-HEX_TESTS += test_call
-HEX_TESTS += test_clobber
-HEX_TESTS += test_cmp
-HEX_TESTS += test_dotnew
-HEX_TESTS += test_ext
-HEX_TESTS += test_fibonacci
-HEX_TESTS += test_hl
-HEX_TESTS += test_hwloops
-HEX_TESTS += test_jmp
-HEX_TESTS += test_lsr
-HEX_TESTS += test_mpyi
-HEX_TESTS += test_packet
-HEX_TESTS += test_reorder
-HEX_TESTS += test_round
-HEX_TESTS += test_vavgw
-HEX_TESTS += test_vcmpb
-HEX_TESTS += test_vcmpw
-HEX_TESTS += test_vlsrw
-HEX_TESTS += test_vmaxh
-HEX_TESTS += test_vminh
-HEX_TESTS += test_vpmpyh
-HEX_TESTS += test_vspliceb
-
-HEX_TESTS += check_rev_gating
-HEX_TESTS += test_pnew_jump_loads
-
-HEX_TESTS += v68_scalar
-HEX_TESTS += v68_hvx
-HEX_TESTS += v69_hvx
-HEX_TESTS += v73_scalar
-
-TESTS += $(HEX_TESTS)
-
-atomics: atomics.c hex_test.h
-brev: brev.c hex_test.h
-circ: circ.c hex_test.h
-dual_stores: dual_stores.c hex_test.h
-fpstuff: fpstuff.c hex_test.h
-hex_sigsegv: hex_sigsegv.c hex_test.h
-load_align: load_align.c hex_test.h
-load_unpack: load_unpack.c hex_test.h
-mem_noshuf_exception: mem_noshuf_exception.c hex_test.h
-mem_noshuf: mem_noshuf.c hex_test.h
-misc: misc.c hex_test.h
-multi_result: multi_result.c hex_test.h
-overflow: overflow.c hex_test.h
-preg_alias: preg_alias.c hex_test.h
-read_write_overlap: read_write_overlap.c hex_test.h
-reg_mut: reg_mut.c hex_test.h
-test_pnew_jump_loads: test_pnew_jump_loads.c hex_test.h
-unaligned_pc: unaligned_pc.c
-
-# Compile for v66 so that the ELF selects a v66 CPU; the test then
-# exercises revision gating by executing a v68 .word instruction.
-run-check_rev_gating: QEMU_OPTS += -cpu v66
-check_rev_gating: check_rev_gating.c
- $(CC) $(CFLAGS) -mv66 -O2 $< -o $@ $(LDFLAGS)
-
-# This test has to be compiled for the -mv67t target
-usr: usr.c hex_test.h
- $(CC) $(CFLAGS) -mv67t -O2 -Wno-inline-asm -Wno-expansion-to-defined $<
-o $@ $(LDFLAGS)
-
-# Build this test with -mv71 to exercise the CABAC instruction
-misc: misc.c
- $(CC) $(CFLAGS) -mv71 -O2 $< -o $@ $(LDFLAGS)
-scatter_gather: CFLAGS += -mhvx
-vector_add_int: CFLAGS += -mhvx -fvectorize
-hvx_misc: hvx_misc.c hvx_misc.h
-hvx_misc: CFLAGS += -mhvx
-hvx_histogram: CFLAGS += -mhvx -Wno-gnu-folding-constant
-v68_hvx: v68_hvx.c hvx_misc.h v6mpy_ref.c.inc
-v68_hvx: CFLAGS += -mhvx -Wno-unused-function
-v69_hvx: v69_hvx.c hvx_misc.h
-v69_hvx: CFLAGS += -mhvx -Wno-unused-function
-v73_scalar: CFLAGS += -Wno-unused-function
-
-hvx_histogram: hvx_histogram.c hvx_histogram_row.S
- $(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS)
-
-ifeq ($(CONFIG_PLUGIN),y)
-# LLVM is way too aggressive with inlining and dead code elimination even at
-# -O0, which interferes with the test. What looks like dead code in this test
-# to the compiler isn't actually dead code, so we need to disable all potential
-# LLVM optimization passes.
-test-plugin-set-pc: CFLAGS += -Xclang -disable-llvm-passes
-endif
diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build
new file mode 100644
index 00000000000..423d125d2ae
--- /dev/null
+++ b/tests/tcg/hexagon/meson.build
@@ -0,0 +1,111 @@
+tests = []
+
+cflags = ['-Wno-incompatible-pointer-types', '-Wno-undefined-internal',
+ '-fno-unroll-loops', '-fno-stack-protector']
+asmflags = [cflags, '-nostdlib', '-mv67', files('crt.S')]
+
+multi_src = []
+foreach t: tcg_tests['multiarch-linux-user']['tests']
+ foreach src, setup: t
+ if 'gdb_test' in setup
+ # gdb does not support hexagon, ignore test
+ continue
+ endif
+ new_cflags = []
+ if 'cflags' in setup
+ new_cflags += setup['cflags']
+ endif
+ new_cflags += cflags
+ if src not in multi_src
+ setup += {'cflags': [new_cflags]}
+ multi_src += src
+ endif
+ tests += {src: setup}
+ endforeach
+endforeach
+
+tests += {
+ 'atomics.c': {'cflags': cflags},
+ 'brev.c': {'cflags': cflags},
+ # Compile for v66 so that the ELF selects a v66 CPU; the test then
+ # exercises revision gating by executing a v68 .word instruction.
+ 'check_rev_gating.c': {
+ 'cflags': [cflags, '-mv66', '-O2'],
+ 'qemu_args': ['-cpu', 'v66'],
+ },
+ 'circ.c': {'cflags': cflags},
+ 'first.S': {'cflags': asmflags},
+ 'fpstuff.c': {'cflags': cflags},
+ 'hex_sigsegv.c': {'cflags': cflags},
+ 'hvx_misc.c': {'cflags': [cflags, '-mhvx', '-mv69']},
+ 'hvx_histogram.c': {
+ 'cflags': [cflags, '-mhvx', '-Wno-gnu-folding-constant',
+ files('hvx_histogram_row.S')]
+ },
+ 'invalid-encoding.c': {'cflags': cflags},
+ 'invalid-slots.c': {'cflags': cflags},
+ 'load_align.c': {'cflags': cflags},
+ 'load_unpack.c': {'cflags': cflags},
+ # Build this test with -mv71 to exercise the CABAC instruction
+ 'misc.c': {'cflags': [cflags, '-mv71', '-O2']},
+ 'multiple-writes.c': {'cflags': cflags},
+ 'overflow.c': {'cflags': cflags, 'exe_name': 'hex-overflow'},
+ 'preg_alias.c': {'cflags': cflags},
+ 'dual_stores.c': {'cflags': cflags},
+ 'multi_result.c': {'cflags': cflags},
+ 'mem_noshuf.c': {'cflags': cflags},
+ 'mem_noshuf_exception.c': {'cflags': cflags},
+ 'read_write_overlap.c': {'cflags': cflags},
+ 'reg_mut.c': {'cflags': cflags},
+ 'scatter_gather.c': {'cflags': [cflags, '-mhvx']},
+ 'signal_context.c': {'cflags': cflags},
+ 'test_abs.S': {'cflags': asmflags},
+ 'test_bitcnt.S': {'cflags': asmflags},
+ 'test_bitsplit.S': {'cflags': asmflags},
+ 'test_call.S': {'cflags': asmflags},
+ 'test_clobber.S': {'cflags': asmflags},
+ 'test_cmp.S': {'cflags': asmflags},
+ 'test_dotnew.S': {'cflags': asmflags},
+ 'test_ext.S': {'cflags': asmflags},
+ 'test_fibonacci.S': {'cflags': asmflags},
+ 'test_hl.S': {'cflags': asmflags},
+ 'test_hwloops.S': {'cflags': asmflags},
+ 'test_jmp.S': {'cflags': asmflags},
+ 'test_lsr.S': {'cflags': asmflags},
+ 'test_mpyi.S': {'cflags': asmflags},
+ 'test_packet.S': {'cflags': asmflags},
+ 'test_reorder.S': {'cflags': asmflags},
+ 'test_round.S': {'cflags': asmflags},
+ 'test_vavgw.S': {'cflags': asmflags},
+ 'test_vcmpb.S': {'cflags': asmflags},
+ 'test_vcmpw.S': {'cflags': asmflags},
+ 'test_vlsrw.S': {'cflags': asmflags},
+ 'test_vmaxh.S': {'cflags': asmflags},
+ 'test_vminh.S': {'cflags': asmflags},
+ 'test_vpmpyh.S': {'cflags': asmflags},
+ 'test_vspliceb.S': {'cflags': asmflags},
+ 'unaligned_pc.c': {'cflags': cflags},
+ 'usr.c': {
+ 'cflags': [cflags, '-mv67t', '-O2',
+ '-Wno-inline-asm', '-Wno-expansion-to-defined']
+ },
+ 'v68_scalar.c': {'cflags': [cflags, '-mv68']},
+ 'v68_hvx.c': {'cflags': [cflags, '-mhvx', '-Wno-unused-function', '-mv68']},
+ 'v69_hvx.c': {'cflags': [cflags, '-mhvx', '-Wno-unused-function', '-mv69']},
+ 'v73_scalar.c': {'cflags': [cflags, '-Wno-unused-function', '-mv73']},
+ 'vector_add_int.c': {'cflags': [cflags, '-mhvx', '-fvectorize']},
+}
+
+if 'qemu-hexagon' in emulators
+ tcg_tests += {
+ 'hexagon-linux-user': {
+ 'cc': 'hexagon-unknown-linux-musl-clang',
+ 'cc_dockerfile': 'debian-hexagon-cross',
+ 'cc_docker_host_arch': ['x86_64'],
+ 'folder': 'hexagon',
+ 'gdb_arch': 'hexagon_is_not_supported_by_gdb',
+ 'qemu': emulators['qemu-hexagon'],
+ 'tests': tests,
+ }
+ }
+endif
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index e2bc582ab5b..e6206ae670a 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -137,6 +137,7 @@ subdir('aarch64')
subdir('aarch64_be')
subdir('alpha')
subdir('arm')
+subdir('hexagon')
image_targets = {}
exe_targets = []