http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55721
--- Comment #14 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org>
2013-01-10 21:32:24 UTC ---
(In reply to comment #12)
> Here is another testcase that looks different then the others, it is cutdown
> from newlib/libm/math/k_rem_pio2.c.
>
> % cat bug3.c
> static const int init_jk[] = {2,3,4,6};
> double twon24 = 5.96046447753906250000e-08;
> int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec)
> {
> int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
> double z,fw,f[20],fq[20],q[20];
> jk = init_jk[prec];
> jz = jk;
> for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
> fw = (double)((int)(twon24* z));
> }
> switch(prec) {
> case 0:
> y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
> }
> }
>
> % gcc -mips64r2 -mabi=64 -c -O2 -g bug3.c
>
> bug3.c: In function '__kernel_rem_pio2':
> bug3.c:3:5: note: non-delegitimized UNSPEC unknown (230) found in variable
> location
> int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec)
> ^
> bug3.c:3:5: note: non-delegitimized UNSPEC unknown (230) found in variable
> location
I've extended the patch to cope with the case in comment 10/comment 11
by adding an optional negation to each "piece" of the address.
But I'm not sure what to do about the case in comment 12. The problem
there is that vartracking is creating notes for the temporary (incomplete)
results in an lea64 expansion, I wondered at first whether that was
because we were reusing the register rtx that holds the final (full)
address to store intermediate results, but changing that didn't seem
to make any difference.
I suppose we could get rid of the unspecs by turning things like
SYMBOL_64_HIGH into ((x + 0x800080008000) >> 48) & 0xffff. But although
that's possible, is it actually _useful_? I think in practice only
the complete address will be of interest for debugging, and any attempt
to output partial addresses will bloat the output for no benefit.
And it doesn't really seem worth adding a target hook to test for
these cases because AIUI the lack of delegitimisation already causes
us to drop the values (albeit noisily for --enable-checking).