]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[committed] Fix minor c6x backend bug exposed by CRC patches
authorJeff Law <jlaw@ventanamicro.com>
Tue, 12 Nov 2024 13:15:50 +0000 (06:15 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Tue, 12 Nov 2024 13:16:38 +0000 (06:16 -0700)
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.

gcc/config/c6x/c6x.md

index ea9ffe8b4e107faaa59883951c9d22d7da0e7b24..9e0aa61947ebaaa93aaea7c8dae6dc68097d5785 100644 (file)
 (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