target/7248: gcc 2.95.3 for m68k generates broken "inclusive or" code

martin@blom.org martin@blom.org
Tue Jul 9 12:36:00 GMT 2002


>Number:         7248
>Category:       target
>Synopsis:       gcc 2.95.3 for m68k generates broken "inclusive or" code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 09 12:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     martin@blom.org
>Release:        gcc version 2.95.3 20010315 (release)
>Organization:
>Environment:
AmigaOS or Linux cross compiler.
>Description:
The following test example outputs 0000000a:00000000 instead
of 0000000a:ffffffff as one would expect.

#include <stdio.h>

typedef unsigned long long Fixed64;

void
test( int a )
{
  Fixed64 f = ( (Fixed64) a << 32) | 0xffffffffULL;

  printf( "%08x:%08x\n", (long) (f >> 32), (long) (f & 0xffffffffULL) );
}

int
main( void )
{
  test( 10 );
}
>How-To-Repeat:

>Fix:
--- config/m68k/m68k.md.orig    Tue Jul  9 21:03:52 2002                            +++ config/m68k/m68k.md Tue Jul  9 21:03:55 2002
@@ -3813,23 +3813,23 @@
       if (GET_CODE (operands[0]) == REG)
        operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
       else
        operands[0] = adj_offsettable_operand (operands[0], 4);
       switch (INTVAL (lo))
        {
          case 0 :
            break;                                                                            case -1 :                                                                             /* FIXME : a scratch register would be welcome here if operand[0]                      is not a register */
-           output_asm_insn (\"move%.l %#-1,%R0\", operands);
+           output_asm_insn (\"move%.l %#-1,%0\", operands);
            break;                                                                            default :
            {                                                                                   rtx xoperands[3];
 
            xoperands[0] = operands[0];
            xoperands[2] = lo;
            output_asm_insn (output_iorsi3 (xoperands), xoperands);                
            }
        }
       return \"\";
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list