On 10/14/2026 4:24 PM, Pierrick Bouvier wrote:
On 10/14/2026 12:52 PM, Brian Cain wrote:
Add tests for: vallocframe, atomics, trap2, CFI/restricted branches, and
scalar fp instructions.
New instructions not yet supported by the toolchain are manually encoded
with .word directives.
Signed-off-by: Brian Cain <[email protected]>
---
tests/tcg/hexagon/cfi_tgts.h | 16 +++
tests/tcg/hexagon/atomics.c | 102 +++++++++++++++++
tests/tcg/hexagon/cfi_user.c | 63 +++++++++++
tests/tcg/hexagon/check_rev_gating.c | 10 ++
tests/tcg/hexagon/invalid-encoding.c | 20 ++++
tests/tcg/hexagon/trap2.c | 34 ++++++
tests/tcg/hexagon/v83_scalar_fp.c | 98 +++++++++++++++++
tests/tcg/hexagon/vallocframe.c | 111 +++++++++++++++++++
tests/tcg/hexagon/cfi_tgts.S | 157 +++++++++++++++++++++++++++
tests/tcg/hexagon/meson.build | 19 +++-
10 files changed, 628 insertions(+), 2 deletions(-)
create mode 100644 tests/tcg/hexagon/cfi_tgts.h
create mode 100644 tests/tcg/hexagon/cfi_user.c
create mode 100644 tests/tcg/hexagon/trap2.c
create mode 100644 tests/tcg/hexagon/v83_scalar_fp.c
create mode 100644 tests/tcg/hexagon/vallocframe.c
create mode 100644 tests/tcg/hexagon/cfi_tgts.S
...
diff --git a/tests/tcg/hexagon/invalid-encoding.c
b/tests/tcg/hexagon/invalid-encoding.c
index 639d7f24959..7c4dd244559 100644
--- a/tests/tcg/hexagon/invalid-encoding.c
+++ b/tests/tcg/hexagon/invalid-encoding.c
@@ -89,6 +89,25 @@ static int test_invalid_nonduplex(void)
return sig;
}
+/* L4_loadw_phys bit 7 was reserved beginning with v83. */
+static int test_v83_loadw_phys_reserved_bit(void)
+{
+ int sig;
+
+ asm volatile(
+ "r0 = #0\n"
+ "r1 = ##1f\n"
+ "memw(%1) = r1\n"
+ ".word 0x9200e080\n"
Please add a comments saying which instruction this is encoding.
...
tests += {
- 'atomics.c': {'cflags': cflags},
+ # The cross assembler does not know v85; v85 instructions in atomics.c
+ # are encoded with .word directives.
+ 'atomics.c': {'cflags': cflags, 'qemu_args': ['-cpu', 'v85']},
'brev.c': {'cflags': cflags},
+ # The cross assembler does not know v83; cfi_tgts.S uses raw encodings.
+ 'cfi_user.c': {
+ 'cflags': [cflags, '-O0', files('cfi_tgts.S')],
-O0 is part of default flags for tcg tests, no need to set it here.
---
^^ will fix these in v2.
Overall, looks good to me.
Reviewed-by: Pierrick Bouvier <[email protected]>
I guess we don't have yet a public toolchain available yet, but if there
is one (even without source code available), it would be better,
especially for cfi_tgts.S.
Yeah it's unfortunate - these instruction encodings haven't landed in
upstream LLVM yet. When it lands, we can replace these encodings with
the real mnemonics.
If there is a v85 toolchain available somewhere, feel free to update the
hexagon dockerfile as part of this series.
Regards,
Pierrick