raeburn@ATHENA.MIT.EDU (Ken Raeburn) (02/16/89)
Using gcc 1.33, vax version, configured for GNU assembler, 3 patches from RMS; optimizing, with -fcombine-regs and -fstrength-reduce enabled. Source file (one I reported back for 1.28, I think; still have the file but not the bug report): typedef struct x { struct { int numRects; } *pCompositeClip; struct x *devPriv; } *GCPtr; extern int Nchannels; tlsetspan( pGC, x, y, width) GCPtr pGC; int x,y; int width; { register unsigned short *p; register short zblock; /* generates even worse code for `int' */ int i; int nclip = pGC->devPriv->pCompositeClip->numRects; while (nclip-- > 0) { for (i=0; i<Nchannels; i++) { zblock = 0x1234567 ; *p++ = x & 0x3fff; *p++ = y & 0x3fff; *p++ = width &0x3fff; *p++ = 0x07a0 | zblock; *p++ = 0x6000 |(0x1fff & -width); } } } Assembly output: #NO_APP gcc_compiled.: .text .align 1 .globl _tlsetspan _tlsetspan: .word 0x7c0 movl 16(ap),r9 movl 4(ap),r10 movl *4(r10),r0 movl (r0),r5 bicw3 $49152,8(ap),r8 bicw3 $49152,12(ap),r6 jbr L1 L7: clrl r2 cmpl r2,_Nchannels jgeq L1 movw r9,r3 bicw3 $49152,r3,r4 movw $18407,r7 L6: movw r8,(r1)+ movw r6,(r1)+ movw r4,(r1)+ movw r7,(r1)+ mnegw r3,r0 # unchanging bicw2 $57344,r0 bisw3 $24576,r0,(r1)+ jaoblss _Nchannels,r2,L6 L1: decl r5 cmpl r5,$-1 jgtr L7 ret The three lines starting at the comment compute values that are the same each pass through the loops. Furthermore, the assignment after L7 of r3 from r9 can also be moved outside the loop it is in. (Actually, I don't see the need for two registers there.) -- Ken