This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/15869] New: No NOP after LW (with -mips1 -O0)


* the complete command line that triggers the bug;

mips64-none-elf-gcc bar.c -v -O0 -G0 -mips1 -mabi=32 -S -v

     * The resultant code works incorrectly because there is no NOP between
       the following commands:

	lw	$2,%lo(lastc.1)($2)
	xor	$2,$3,$2



     * the  preprocessed  file (*.i*) that triggers the bug, generated by
       adding -save-temps to the complete compilation command, or, in the
       case  of  a  bug  report for the GNAT front end, a complete set of
       source files (see below).

void bar (int n, int c)
{
  static int lastn = -1, lastc = -1;

  if (lastn != n)
    {
      if (lastc != lastn)
	abort ();
      lastc = 0;
      lastn = n;
    }

  if (c != (char) (lastc ^ (n << 3)))
    abort ();
  lastc++;
}

     * The resultant assembler code

	.file	1 "bar.c"
	.section .mdebug.abi32
	.previous
	.data
	.align	2
	.type	lastn.0, @object
	.size	lastn.0, 4
lastn.0:
	.word	-1
	.align	2
	.type	lastc.1, @object
	.size	lastc.1, 4
lastc.1:
	.word	-1
	.text
	.align	2
	.globl	bar
	.ent	bar
bar:
	.frame	$fp,24,$31		# vars= 0, regs= 2/0, args= 16, gp= 0
	.mask	0xc0000000,-4
	.fmask	0x00000000,0
	.set	noreorder
	.set	nomacro
	
	addiu	$sp,$sp,-24
	sw	$31,20($sp)
	sw	$fp,16($sp)
	move	$fp,$sp
	sw	$4,24($fp)
	sw	$5,28($fp)
	lui	$2,%hi(lastn.0)
	lw	$3,%lo(lastn.0)($2)
	lw	$2,24($fp)
	nop
	beq	$3,$2,$L2
	nop

	lui	$2,%hi(lastc.1)
	lui	$3,%hi(lastn.0)
	lw	$4,%lo(lastc.1)($2)
	lw	$2,%lo(lastn.0)($3)
	nop
	beq	$4,$2,$L3
	nop

	jal	abort
	nop

$L3:
	lui	$2,%hi(lastc.1)
	sw	$0,%lo(lastc.1)($2)
	lui	$3,%hi(lastn.0)
	lw	$2,24($fp)
	nop
	sw	$2,%lo(lastn.0)($3)
$L2:
	lw	$2,24($fp)
	nop
	sll	$3,$2,3
	lui	$2,%hi(lastc.1)
	lw	$2,%lo(lastc.1)($2)
	xor	$2,$3,$2
	sll	$3,$2,24
	sra	$3,$3,24
	lw	$2,28($fp)
	nop
	beq	$3,$2,$L4
	nop

	jal	abort
	nop

$L4:
	lui	$3,%hi(lastc.1)
	lui	$2,%hi(lastc.1)
	lw	$2,%lo(lastc.1)($2)
	nop
	addiu	$2,$2,1
	sw	$2,%lo(lastc.1)($3)
	move	$sp,$fp
	lw	$31,20($sp)
	lw	$fp,16($sp)
	addiu	$sp,$sp,24
	j	$31
	nop

	.set	macro
	.set	reorder
	.end	bar

-- 
           Summary: No NOP after LW (with -mips1 -O0)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: niva at niisi dot msk dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mips64-none-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15869


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]