Jeff Law <l...@redhat.com> writes:

> On 04/02/14 06:08, Anthony Green wrote:
>>
>> One embarrassing feature of the moxie compiler port is that it really
>> doesn't understand how to promote integral types.  Moxie cores
>> zero-extend all loads, but the compiler still shifts loaded values back
>> and forth to zero out the upper bits.
> I'm a bit surprised LOAD_EXTEND_OP doesn't cover this for you.  Maybe
> other aspects of the moxie are getting in the way:
>
>
> (insn 7 6 8 2 (set (reg:SI 32)
>         (const_int 24 [0x18])) j.c:4 19 {*movsi}
>      (nil))
> (insn 8 7 10 2 (set (reg:SI 30 [ D.1371 ])
>         (ashift:SI (subreg:SI (mem:QI (reg:SI 2 $r0 [ c ]) [0
> *c_2(D)+0 S1 A8]) 0)
>             (reg:SI 32))) j.c:4 14 {ashlsi3}
>      (expr_list:REG_DEAD (reg:SI 2 $r0 [ c ])
>         (nil)))
> (note 10 8 15 2 NOTE_INSN_DELETED)
> (insn 15 10 16 2 (set (reg/i:SI 2 $r0)
>         (lshiftrt:SI (reg:SI 30 [ D.1371 ])
>             (reg:SI 32))) j.c:5 16 {lshrsi3}
>      (expr_list:REG_DEAD (reg:SI 32)
>         (expr_list:REG_DEAD (reg:SI 30 [ D.1371 ])
>             (nil))))
>
>
> Looks problematical.  The shift count is used twice, so combine's
> going to have a bit of a tough time with this.
>
> Perhaps allow constant shift counts then force them into registers
> after combine with splitters?

Rather than use shifts, I've added "sign-extend byte" and "sign-extend
short" instructions (I have the luxury of a soft-core architecture with
a tiny user base :).  Switching char to unsigned by default was also a
good thing given zero-extend by default.

I've tested RTEMS apps on QEMU, so it's all good so far.  I'll submit
patches tonight.

AG

Reply via email to