Article View: gnu.gcc.bug
Article #2532gcc 1.34 makes inefficient code
From: Lawrence Butcher
Date: Wed, 12 Apr 1989 04:06
Date: Wed, 12 Apr 1989 04:06
84 lines
2154 bytes
2154 bytes
Source Code:
void
Update_Rect (x1, y1, x2, y2)
register short x1, y1, x2, y2;
{ register unsigned char *From, *To;
register unsigned char *ColorMap;
register short Count;
short Complete, Partial, Lines;
for (; Complete-- != 0;) {
for (Lines = Partial; Lines-- != 0; From += x1, To += x2) {
for (Count = y1 >> 3; Count-- != 0;) {
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
*To++ = ColorMap[*From++];
}
}
}
}
.s file:
#NO_APP
gcc_compiled.:
.text
.even
.globl _Update_Rect
_Update_Rect:
link a6,#0
moveml #0x3f3c,sp@-
movew a6@(10),a4
movew a6@(14),a3
movew a6@(18),d7
jra L2
L13:
movew a5,d4
clrl d5
jra L5
L12:
movew a3,d1
asrw #3,d1
clrl d3
clrl d2
jra L8
L11:
moveb a0@+,d3 # not fatal
moveb a2@(d3:l),a1@+
moveb a0@+,d2 # why not the same register?
moveb a2@(d2:l),a1@+
moveb a0@+,d5 # why not the same register?
moveb a2@(d5:l),a1@+
clrl d0 # why not the same register?
moveb a0@+,d0
moveb a2@(d0:l),a1@+
clrl d0 # d0 already has the top 3 bytes zeroed
moveb a0@+,d0
moveb a2@(d0:l),a1@+
clrl d0
moveb a0@+,d0
moveb a2@(d0:l),a1@+
clrl d0
moveb a0@+,d0
moveb a2@(d0:l),a1@+
clrl d0
moveb a0@+,d0
moveb a2@(d0:l),a1@+
L8:
dbra d1,L11
addw a4,a0
addw d7,a1
L5:
dbra d4,L12
L2:
dbra d6,L13
moveml a6@(-40),#0x3cfc
unlk a6
rts
Lawrence.Butcher@cs.cmu.edu
--
Technical Details
Message-ID:
<4694@pt.cs.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!rochester!pt.cs.cmu.edu!g.gp.cs.cmu.edu!butcherShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!rochester!pt.cs.cmu.edu!g.gp.cs.cmu.edu!butcher From: butcher@g.gp.cs.cmu.edu (Lawrence Butcher) Newsgroups: gnu.gcc.bug Subject: gcc 1.34 makes inefficient code Message-ID: <4694@pt.cs.cmu.edu> Date: 12 Apr 89 04:06:07 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 83 Description: Gnu gcc version 1.34 with -O -S produces correct but inefficient code. It uses lots more registers than it needs to, and clears the top of a register lots more than it needs to.