This is the mail archive of the gcc-patches@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]

Re: [patch] h8300.c: Improve shifts.


Hi,

Looking back at the code example, I realized that I used slightly
different example for generating the unpatched and patched versions.
The shift insns inside the loops are different.  (I probably used
'unsigned n' for one example and 'signed n' for the other.)

Sorry if the previous code example was confusing.

Here is a revised example.  I used strictly the same code.  The only
difference between the two versions is whether h8300.c is patched or
not.

/* h8300-hms-gcc -Wall -O2 -fomit-frame-pointer */

int global1;
int global2;

unsigned int
test_gcc (int n, int m, int dummy1, int dummy2)
{
  n >>= m;
  global1 = dummy1;
  global2 = dummy2;
  return n;
}

/* Without the patch:
_test_gcc:
	push	r4           <- This will be gone once patched.
	mov.w	@(4,r7),r3
	mov.b	r1l,r4l      <- We could use r1l as a loop counter.
	ble	.Lle1
.Llt1:
	shar	r0h
	rotxr	r0l
	add	#0xff,r4l
	bne	.Llt1
.Lle1:
	mov.w	r2,@_global1
	mov.w	r3,@_global2
	pop	r4           <- This will be gone once patched.
	rts
*/

/* With the patch:
_test_gcc:
	mov.b	r1l,r1l      <- We are not generating a scratch.
	ble	.L4
.L3:
	shar	r0h
	rotxr	r0l
	add.b	#-1,r1l
	bne	.L3
.L4:
	mov.w	r2,@_global1
	mov.w	@(2,r7),r2
	mov.w	r2,@_global2
	rts
*/

Thanks,

Kazu Hirata


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