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]

Re: Load hoisting bug


>>>>> Richard Henderson writes:

>> (set (reg:DI 3) ...) uses the register pair r3 and r4 on a 32-bit target!

Richard> Blah.  Gimme a preprocessed file and I'll look at it.

	The testcase only fails on AIX, not pure PowerPC, because AIX
common mode creates the DImode hard register dependency that is not a CALL
or inlined assembly.

Thanks, David


extern long long scale, num[5];

void
hoist ()
{
  int i;
  unsigned long long work, carry = 0;

  for (i = 0; i <= 3; i++)
    {
      work = (num[i] * scale) + carry;
      num[i] = work & 0xf;
      carry = (unsigned long long) work >> 4;
    }
}


gcc -O2 -S hoist.c

	.file	"hoist.c"
	.toc
	.csect .text[PR]
	.toc
LC..0:
	.tc num[TC],num[RW]
LC..1:
	.tc scale[TC],scale[RW]
	.csect .text[PR]
	.align 2
	.globl hoist
	.globl .hoist
	.csect hoist[DS]
hoist:
	.long .hoist, TOC[tc0], 0
	.csect .text[PR]
.hoist:
	.extern __mulh
	.extern __mull
	.extern __divss
	.extern __divus
	.extern __quoss
	.extern __quous
	mflr 0
	lwz 9,LC..1(2)
	stw 0,8(1)
	li 0,4
	stw 28,-16(1)
	mtctr 0
	stw 29,-12(1)
	lwz 28,0(9)
	lwz 29,4(9)
	stw 27,-20(1)
	lwz 5,LC..0(2)
	srwi 27,29,31
	mr 4,29		# r4 set
	stw 30,-8(1)
	add 27,27,28
	li 30,0
	stw 31,-4(1)
	li 31,0
L..9:			# loop label
	lwz 9,0(5)
	lwz 10,4(5)
	li 7,0
	mr 3,10
	srwi 6,10,31
	mullw 11,27,10
	add 6,6,9
	bla __mull	# r3 & r4 killed
	mullw 6,6,29
	mr 9,3		# r3 result used
	mr 10,4		# r4 result used
	add 9,9,11
	add 9,9,6
	addc 12,10,31
	adde 11,9,30
	rlwinm 8,12,0,28,31
	slwi 9,11,28
	srwi 0,12,4
	stw 7,0(5)
	stw 8,4(5)
	srwi 30,11,4
	or 31,9,0
	addi 5,5,8
	bdnz L..9	# loop iteration
	lwz 0,8(1)
	lwz 27,-20(1)
	mtlr 0
	lwz 28,-16(1)
	lwz 29,-12(1)
	lwz 30,-8(1)
	lwz 31,-4(1)
	blr
LT..hoist:
	.long 0
	.byte 0,0,32,65,0,5,0,0
	.long LT..hoist-.hoist
	.short 5
	.byte "hoist"
_section_.text:
	.csect .data[RW],3
	.long _section_.text

===============================================================================
David Edelsohn                                      T.J. Watson Research Center
dje@watson.ibm.com                                  P.O. Box 218
+1 914 945 4364 (TL 862)                            Yorktown Heights, NY 10598


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