Commit graph

7 commits

Author SHA1 Message Date
Paul Iannetta
512707c2e2 kvx: Improve lexing & parsing
Up until now, we used ENV.PROMOTE_IMMEDIATE to get the next candidates,
however this candidate can be directly extracted from the array (in
kvx-parse.h) registering all the immediates.

During lexing, we ignored trailing characters after a number, this is
not good enough since now number can be followed by a modifier.  The
function READ_TOKEN and GET_TOKEN_CLASS have been update to take this
into account.

gas/ChangeLog:

	* config/kvx-parse.c (promote_token): Do not rely on
	  env.promote_immediate anymore.
	(get_token_class): Do not ignore trailing characters after a
	number.
	(read_token): Likewise.
	(print_token_list): THIS SHOULD NOT BE HERE.
2024-02-20 12:07:57 +01:00
Paul Iannetta
04e46d3bd9 kvx: gas: fix the detection of negative powers of 2
The detection of negative powers of 2 was wrong and could lead to
well-formed bundles ending up taking more syllables than necessary.

gas/ChangeLog:

	* config/kvx-parse.c (get_token_class): Use the signed value.
	* testsuite/gas/kvx/np2-detection.d: New test.
	* testsuite/gas/kvx/np2-detection.s: New test.
2024-02-20 12:07:57 +01:00
Alan Modra
fd67aa1129 Update year range in copyright notice of binutils files
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:

1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
   author I haven't committed, 'Kalray SA.', to cover gas testsuite
   files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
2024-01-04 22:58:12 +10:30
Paul Iannetta
af6242628a kvx: use {u,}int32_t and {u,}int64_t
gas/
	* config/kvx-parse.c (promote_token): Use {u,}int32_t and
	{u,}int64_t.
	(get_token_class): Likewise.
	* config/tc-kvx.c (insert_operand): Likewise.
	* config/tc-kvx.h (struct token_s): Likewise.
	(struct token_list): Likewise.

opcodes/
	* kvx-dis.c (struct decoded_insn): Use {u,}int32_t and
	{u,}int64_t.
	(decode_insn): Likewise.
	(print_insn_kvx): Likewise.
	(decode_prologue_epilogue_bundle): Likewise.
	* kvx-dis.h (struct kvx_prologue_epilogue_insn): Likewise.
2023-08-24 12:36:25 +09:30
Alan Modra
36a52ab3bf kvx: O_pseudo_fixup
O_pseudo_fixup was defined as O_max+1, missing the fact that O_md1
through O_md32 enums are for use by target code.  Worse, kvx-parse.c
used 64 rather than O_pseudo_fixup.  Fix this, and wrap some overlong
lines.

	* config/tc-kvx.h (O_pseudo_fixup): Define.
	* config/tc-kvx.c (O_pseudo_fixup): Don't define here.
	(insert_operand): Delete bogus comment and cast.
	* config/kvx-parse.c (promote_token): Use O_pseudo_fixup
	rather than hardcoded value.  Wrap overlong lines.
	(get_token_class): Likewise.
	(parse_with_restarts): Wrap overlong line.
2023-08-23 11:03:52 +09:30
Alan Modra
990f9a1d13 kvx: ubsan: integer overflow
This fixes a few places where ubsan complains about signed integer
overflow when running the testsuite, and that clz(0) is undefined.
When fixing the clz problem, I also noticed that we'd get complaints
if pval is ever LLONG_MIN.  Fix that by using unsigned arithmetic.

	* config/kvx-parse.c (get_token_class): Avoid signed overflow.
	Don't clz(0).
	* config/tc-kvx.c (PARALLEL_BIT): Avoid signed overflow.
2023-08-23 11:03:52 +09:30
Paul Iannetta
6e712424f5 kvx: New port. 2023-08-16 14:22:54 +01:00