SH: may miscompile zero extension and test

Jim Wilson wilson@tuliptree.org
Sun Aug 10 06:55:00 GMT 2003


kaz Kojima wrote:
> (insn 52 51 53 1 (set (reg:SI 147 t)
>         (eq:SI (subreg:SI (reg:QI 178 [ a ]) 0)
>             (const_int 0 [0x0]))) 1 {cmpeqsi_t} (insn_list 50 (nil))
>     (expr_list:REG_DEAD (reg:QI 178 [ a ])
>         (nil)))

Subregs act much like regs when recognizing operands.  So if  (REG:SI 
...) is a valid operand, then so is (subreg:SI ...).

The SH port defines WORD_REGISTER_OPERATIONS, which means if you put a 
QImode value in a register, then you can interchangable use either 
(reg:SI) or (reg:qi) because moving a QImode value sets the entire register.

You do have to get the signedness right though.  There is some 
interaction with LOAD_EXTEND_OP here to only generate the paradoxical 
subreg when the signedness is OK.  There are occasional problems with 
this code.

It isn't obvious what is wrong from your assembly language fragment.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list