#ifndef lint
-static char sccsid[] = "@(#)local2.c 1.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)local2.c 1.32 (Berkeley) 2/29/88";
#endif
# include "pass2.h"
}
case 'D': /* INCR and DECR */
- zzzcode(p->in.left, 'U');
+ if (p->in.left->in.type == FLOAT)
+ expand(p, INAREG, "movl\tAL,A1");
+ else if (p->in.left->in.type == DOUBLE)
+ expand(p, INAREG, "ldd\tAL\n\tstd\tA1");
+ else
+ zzzcode(p->in.left, 'U');
putstr("\n ");
case 'E': /* INCR and DECR, FOREFF */
- if (p->in.right->tn.lval == 1)
+ if (p->in.right->in.op == ICON && p->in.right->tn.lval == 1)
{
putstr(p->in.op == INCR ? "inc" : "dec");
prtype(p->in.left);
adrput(p->in.left);
return;
}
+ else if (p->in.left->in.type == FLOAT || p->in.left->in.type == DOUBLE) {
+ if (c == 'E' || p->in.left->in.type == FLOAT)
+ expand(p, INAREG, "ldZL\tAL\n\t");
+ if (p->in.op == INCR)
+ expand(p, INAREG, "addZL\tAR\n\tstZL\tAL");
+ else /* DECR */
+ expand(p, INAREG, "subZL\tAR\n\tstZL\tAL");
+ return;
+ }
putstr(p->in.op == INCR ? "add" : "sub");
prtype(p->in.left);
putstr("2 ");
* ignored and the high bits of the source are copied. (Note
* that zero-extension is not a problem for immediate
* constants.)
+ * Another problem -- condition codes for a conversion with a
+ * register source reflect the source rather than the destination.
*/
sconv(p, forcc)
NODE *p;
adrput(dst);
putstr("\n\tmovab\t4(sp),sp");
if (forcc) {
- /* inverted test */
- putstr("\n\tcmpl\t$0,");
+ putstr("\n\ttstl\t");
adrput(dst);
}
return;
}
genconv(ISUNSIGNED(srctype),
srclen, dst->in.op == REG ? SZINT/SZCHAR : dstlen,
- src, dst);
+ src, dst, forcc);
return;
}
adrput(dst);
putstr("\n\tmovab\t4(sp),sp");
if (forcc) {
- /* inverted test */
- putstr("\n\tcmpl\t$0,");
+ putstr("\n\ttstl\t");
adrput(dst);
}
return;
tmp->tn.op = OREG;
tmp->tn.lval = srclen - dstlen;
}
- genconv(ISUNSIGNED(dsttype), dstlen, SZINT/SZCHAR, tmp, dst);
+ genconv(ISUNSIGNED(dsttype), dstlen, SZINT/SZCHAR, tmp, dst, forcc);
tmp->in.op = FREE;
return;
}
genconv(neg ? -1 : ISUNSIGNED(dsttype),
srclen, dst->in.op == REG ? SZINT/SZCHAR : dstlen,
- src, dst);
+ src, dst, forcc);
}
-genconv(srcflag, srclen, dstlen, src, dst)
+genconv(srcflag, srclen, dstlen, src, dst, forcc)
int srcflag;
register int srclen, dstlen;
NODE *src, *dst;
+ int forcc;
{
if (srclen != dstlen) {
if (srcflag > 0 && srclen < dstlen)
adrput(src);
putchar(',');
adrput(dst);
+
+ /*
+ * This hack is made necessary by architecture problems
+ * described above
+ */
+ if (forcc && src->in.op == REG && srclen > dstlen) {
+ putstr("\n\ttst");
+ prlen(dstlen);
+ putchar('\t');
+ adrput(dst);
+ }
}
rmove( rt, rs, t ) TWORD t; {