https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67506

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-09
     Ever confirmed|0                           |1

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
The 'sh_extending_set_of_reg' thing seems to be working OK in this case. 
However, the expected resulting reg is assumed to be SImode.  But for this insn
...

(insn 124 123 125 13 (set (reg:HI 262 [ *_48 ])
        (zero_extend:HI (reg:QI 263 [ *_48 ]))) tfoo.c:41 223
{zero_extendqihi2}
     (expr_list:REG_DEAD (reg:QI 263 [ *_48 ])
        (nil)))

... this is not the case (obviously it's HImode).
In the other function 'use_as_unextended_reg' I used 'simplify_gen_subreg'.  In
'use_as_extended_reg' I assumed that the extension is always towards SImode and
forgot to handle it.  It seems the following fixes it:

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 5813a77..d5e1a21 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -14332,6 +14332,11 @@ sh_extending_set_of_reg::use_as_extended_reg
(rtx_insn* use_at_insn) const
   else
     {
       rtx extension_dst = XEXP (set_rtx, 0);
+
+      if (GET_MODE (extension_dst) != SImode)
+       extension_dst = simplify_gen_subreg (SImode, extension_dst,
+                                            GET_MODE (extension_dst), 0);
+
       if (modified_between_p (extension_dst, insn, use_at_insn))
        {
          if (dump_file)

Could you please test it?

Reply via email to