[committed] Fix minor c6x backend bug exposed by CRC patches

This is a minor bug in the c6x port I saw when testing Mariam's CRC work.
Specifically some of the CRC tests were failing with a segfault testing if an
operand was an "a_register" from within the dest_regfile attribute.  We were
extracting what we thought should have been a register operand then looking at
the REGNO.  The underlying data was totally bogus, hence the fault in the
accessor macros.

The core issue is we were trying to extract operands from a nop insn which has
no operands.  As far as I can tell "unknown" is a reasonable answer for the
dest_regfile attribute on a nop insn, so this patch adds an explicit setting of
dest_regfile rather than letting the default processing kick in.

I'm applying the attached patch to the trunk.

There's still a backend bug affecting ~15 CRC tests.  Essentially the assembler
complains about a label (related to debugging info) not at the start of an
execution packet.  I'm not chasing this down.

gcc/

	* config/c6x/c6x.md (nop, nop_count): Add explicit
	"dest_regfile" attribute setting.
This commit is contained in:
Jeff Law 2024-11-12 06:15:50 -07:00
parent de6fe61839
commit b8ecd96aea

View File

@ -365,12 +365,14 @@
(define_insn "nop"
[(const_int 0)]
""
"nop")
"nop"
[(set_attr "dest_regfile" "unknown")])
(define_insn "nop_count"
[(unspec [(match_operand 0 "const_int_operand" "n")] UNSPEC_NOP)]
""
"%|%.\\tnop\\t%0")
"%|%.\\tnop\\t%0"
[(set_attr "dest_regfile" "unknown")])
;; -------------------------------------------------------------------------
;; Move instructions