SUBREG GIVs - Suggestion for a quick hack.
Richard Henderson
rth@cygnus.com
Tue Sep 30 16:45:00 GMT 1997
> Please comment on this, before I start out to try it (I would
> especially be interested in how to change the second of the two
> set's, i.e. how to `CONS' <some construct> into it ;-).
I've been trying to reproduce this in C, and I can't. Correct me
if I'm wrong about this C translation:
void daxpy(int *_n, double dx[], double dy[], double *_da)
{
double da = *_da;
int i, n = *_n, in;
for (i = 1, in = n-1; in >= 0; ++i, --in)
dy[i-1] = dy[i-1] + da*dx[i-1];
}
because with this, I get
ldt $f1,0($17)
mult $f11,$f1,$f1
ldt $f10,0($18)
addt $f10,$f1,$f10
subl $1,1,$1
addq $17,8,$17
stt $f10,0($18)
addq $18,8,$18
bge $1,$37
which, other than scheduling, is perfect. The difference I see in
the initial RTL is this:
C Fortran
----------- --------------
r81 = i r89 = i - 1
r82 = r81 * 8 r90 = sign_extend(r89)
r83 = r82 + dy r91 = r90
r84 = r83 - 8 r92 = r91 * 8
r93 = r92 + dy
I.e: a = (dy + i*8) - 8 a = (i - 1) * 8 + y
I wonder how much effort it would be to get Fortran to emit its
accesses in this way. If the answer is not too much, it would be
a quick way to determine if this form is generally more recognizable
by the backend.
r~
More information about the Gcc
mailing list