Patch for gcc/config/

Will Cohen
Wed Oct 18 06:29:00 GMT 2000

I agree with you entirely that the patch doesn't fix the root cause of
the problem.  It merely avoids generating incorrect code for this
particular situation.  A note  is created when the initial rtl is

I have included a testcase that shows the problem.  The resulting
phase dumps were created with "cc1 -O2 -dap test104448a.c"

insn 46 and insn 48 in test104448a.c.00.rtl are the zero_extendsidi2
operation.  You will see a note on insn 48 which is later optimized
incorrectly. In test104448a.c.02.cse the note on insn 48 is changed
to zero_extend the psuedo register that holds the constant. In
test104448a.c.04.gcse puts in the constant.  Unfortunately,
because constants include information about the bits of precision,
the negative number is sign extended to the full 64-bit width.


Jeffrey A Law wrote:
>   In message < >you write:
>   > I have found that the define_expand "zero_extendsidi2" does not
>   > improve the quality of code generated for the mips. The compiler
>   > generates the same sequence of RTL statements without it.  An
>   > unfortunate side effect of this define expand is that the compiler
>   > generates a note which with is later optimized incorrectly. This
>   > mistake occurs when a negative value is type casted into an unsigned
>   > int.  The resulting value should have the upper 32-bits of the 64-bit
>   > register be zero, but the compiler generates constant that sign
>   > extends, setting the upper 32-bits to 1's.  This patch removes the
>   > define_expand and eliminates the problem note.
> I'm not objecting to the patch itself, but to the fact that it doesn't
> appear as if you're fixing the problem.  Instead you're just avoiding it.
> Can you explain in more detail when/how the note is created and when/how
> it no longer is valid?
> I'd like to understand that in more detail before we make any decisions about
> this patch.
> jeff
signed flg = 0 ;

void main( void )
        signed char  Asch1 ;
        unsigned long  Auln1 ;
        int skip = 0 ;

        Asch1 = -128 ; Auln1 = 0L ;

        do {
	  if ( skip++ ) {
        } while ( ( Auln1 = ( unsigned int )Asch1) == 0xffffff80 ) ;

        if ( flg ) {
        } else {

More information about the Gcc-patches mailing list