ICE in push_reload for avr

Pitchumani Sivanupandi <[email protected]> Tue, 15 Mar 2016 14:10:42 +0530
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <20160315084042.GA7276@CHELT0346>
Hi Johann,

There is an ICE in push_reload for AVR target which is very similar to
PR64452. Attached the test case (options: -mmcu=atmega1280 -O1).

PR64452's fix makes the virtual reloads in one chunk for push operation.
What is the significance to address the virtuals only in range of
FIRST_VIRTUAL_REGISTER to LAST_VIRTUAL_REGISTER?

I tried below split to load the symbol reference to register before
doing the arithmetic on it. This avoids the defect, but it is un-optimal
and may split RTLs for non-push operations also.

(define_split
  [(set (match_operand:HI 0 "register_operand" "")
        (const:HI (plus:HI (match_operand:HI 1 "symbol_ref_operand" "")
                      (match_operand:ALL2 2 "immediate_operand" ""))))]
  "!reload_completed
   && (REGNO (operands[0]) >= FIRST_VIRTUAL_REGISTER)"
  [(set (match_dup 0)
        (match_dup 1))
   (set (match_dup 0)
        (plus:HI (match_dup 0)
                 (match_dup 2)))])

Any suggestions?

Regards,
Pitchumani

_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
ice-reload-avr.c (text/plain, 228 B)
struct {
    short i[8];
} v;

void main ()
{
  char FILL;
  int (* volatile vp)(const char *, ...);

  for (FILL = 0; FILL < 4; FILL++)
  {
    vp ("%d\n", v.i + 0, v.i + 1, v.i + 2, v.i + 3, v.i + 4, v.i + 5, v.i + 6);
  }
}