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

--- Comment #12 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Richard Sandiford from comment #11)
> I suppose the problem with BImode is that it isn't really a natural memory
> mode.  It also isn't a mode that pseudo registers would naturally have, if
> you want to have moves between the T register and pseudos (and it seems like
> you do).

Yes, moves between T and normal regs is required.  I guess since a move T ->
reg is always an SImode operation, the easiest way to deal with it was to have
the T reg SImode.

> 
> Accessing the T register as SImode seems reasonable for a 32-bit target.  I
> just don't understand why accessing it as HImode and QImode is specifically
> not allowed, even though the register is a single bit.

That's probably just an oversight that has never been caught, since, like you
said, RTL is not validated that strictly in this regard.  Perhaps should try it
out.

> I don't think anything would get rid of the:
> 
>   (zero_extend:SI (subreg:QI (reg:SI 147 t) 3)
> 
> during or after RA.  The pattern:
> 
> (define_insn "movt"
>   [(set (match_operand:SI 0 "arith_reg_dest" "=r")
>       (match_operand:SI 1 "t_reg_operand"))]
>   "TARGET_SH1"
>   "movt       %0"
>   [(set_attr "type" "arith")])
> 
> doesn't have a constraint for operand 1, so the operand will just be left
> as-is.
> 
> For example, if I use -fdisable-rtl-late_combine{1,2} to bypass the ICE, I
> still see:
> 
> (insn 10 12 13 (set (reg:SI 7 r7 [orig:170 _16+-3 ] [170])
>         (zero_extend:SI (subreg:QI (reg:SI 147 t) 3))) … {movt}
>      (nil))
> 
> in the final dump.

Ugh.  For whatever reason I thought those would get eliminated/simplified in
one of the split passes before RA.  Oh well ... 

> Anyway, thanks for the info.  If accepting the zero-extend-of-subreg is
> “just” for combine, rather than something that is needed for correctness,
> then I think I'll go ahead with a version of yesterday's patch.

Thanks for looking into it!

Reply via email to