optimization/420: 68k dbCC peephole fails in simple test case
tz@execpc.com
tz@execpc.com
Mon Jul 17 21:46:00 GMT 2000
>Number: 420
>Category: optimization
>Synopsis: 68k dbCC peephole fails in simple test case
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Mon Jul 17 21:46:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Tom Zerucha
>Release: gcc-2.9.5 (palmos/prc-tools-2.0, m68k-coff embedded, probably any m68k)
>Organization:
>Environment:
Linux 2.4.0-test1.
>Description:
testcase.c:
void test(register void *dst, register void *src, register int num) {
while ((*((char *) dst)++ == *((char *) src)++) && num--); }
compile:
m68k-palmos-gcc -O5 -S testcase.c
testcase.s: (excerpt)
.L5:
cmpm.b (%a0)+,(%a1)+
jbne .L4
dbra %d0,.L5
.L4:
In gcc/config/m68k/m68k.md, it says under ";; dbCC peepholes" it
should optimize this to:
cmpm.b ...
dbne %d0,.L5
jbne .L4
.L4
Of course it should simply drop the jbne .L4 altogether.
A more elaborate version to force the jbne target not to be the next instruction also fails:
void test(register char *dst, register char *src, register int num) {
volatile *port = 0x1235;
for(;;) {
*port=1;
if (*((char *) dst)++ == *((char *) src)++)
continue;
if( !num--)
break;
*port=2;
}
}
>How-To-Repeat:
See description. I can't get it to do the peephole described in m68k.mk
>Fix:
Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list