[Bug target/50751] SH Target: Displacement addressing does not work for QImode and HImode

kkojima at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 27 02:31:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50751

--- Comment #8 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-10-27 02:31:35 UTC ---
(In reply to comment #7)
> Created attachment 25622 [details]
> asmcons and ira pass log for the reload failure of "z" insn constraint

The original insn 13 was

(insn 13 12 14 3 (set (reg:SI 193)
        (plus:SI (subreg:SI (reg:QI 191 [ MEM[(char *)buf1_4(D) + 4B] ]) 0)
            (subreg:SI (reg:QI 192 [ MEM[(char *)buf0_1(D) + 5B] ]) 0)))

and RA chooses r1 and r0 as the registers to where memories will
be loaded.  The problem is we have no direct way to load buf1[4]
to r1.  In such situation, a secondary reload is needed.  See
the description of TARGET_SECONDARY_RELOAD in the gcc manual.
Here is a trial:

--- ORIG/trunk/gcc/config/sh/sh.c    2011-10-16 10:18:53.000000000 +0900
+++ trunk/gcc/config/sh/sh.c    2011-10-27 10:13:21.000000000 +0900
@@ -12430,6 +12453,10 @@ sh_secondary_reload (bool in_p, rtx x, r
   if (rclass != GENERAL_REGS && REG_P (x)
       && TARGET_REGISTER_P (REGNO (x)))
     return GENERAL_REGS;
+  if (rclass == GENERAL_REGS && mode == QImode
+      && MEM_P (x) && GET_CODE (XEXP (x, 0)) == PLUS
+      && CONST_INT_P (XEXP (XEXP (x, 0), 1)))
+    return R0_REGS;
   return NO_REGS;
 }

The ICE for your testcase went away with it, though I've got

../../../INTEST/trunk/zlib/trees.c: In function 'send_tree':
../../../INTEST/trunk/zlib/trees.c:797:1: error: unable to find a register to
spill in class 'R0_REGS'
../../../INTEST/trunk/zlib/trees.c:797:1: error: this is the insn:
(insn 415 414 416 28 (set (mem:QI (plus:SI (reg/f:SI 6 r6 [orig:742
s_34(D)->pending_buf ] [742])
                (reg:SI 7 r7 [orig:307 D.4248 ] [307])) [0 *D.4249_209+0 S1
A8])
        (reg:QI 746 [ s_34(D)->bi_buf ]))
../../../INTEST/trunk/zlib/trees.c:780 206 {*movqi_m_reg_reg_store}
     (expr_list:REG_DEAD (reg:QI 746 [ s_34(D)->bi_buf ])
        (expr_list:REG_DEAD (reg/f:SI 6 r6 [orig:742 s_34(D)->pending_buf ]
[742])
            (expr_list:REG_DEAD (reg:SI 7 r7 [orig:307 D.4248 ] [307])
                (nil)))))
../../../INTEST/trunk/zlib/trees.c:797:1: internal compiler error: in
spill_failure, at reload1.c:2118

when bootstrapping.



More information about the Gcc-bugs mailing list