diff options
author | Anders Magnusson <ragge@cvs.openbsd.org> | 2007-12-16 19:27:34 +0000 |
---|---|---|
committer | Anders Magnusson <ragge@cvs.openbsd.org> | 2007-12-16 19:27:34 +0000 |
commit | f4e28a5b130c27ce8fced9f84bbd4aa5e1f11700 (patch) | |
tree | 56f167f1b73010e7f1bea8bd17c3ad3243a4de91 /usr.bin | |
parent | f25a2e590a20bbc951fa2c03d88fe89947229d43 (diff) |
Updates from master repo:
> Fix bug causing a cast from floats to integer types be rounded
> up as well as down instead just rounding them down.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pcc/i386/table.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/usr.bin/pcc/i386/table.c b/usr.bin/pcc/i386/table.c index 7f27036bb03..6991920b141 100644 --- a/usr.bin/pcc/i386/table.c +++ b/usr.bin/pcc/i386/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.3 2007/12/09 18:54:39 ragge Exp $ */ +/* $OpenBSD: table.c,v 1.4 2007/12/16 19:27:33 ragge Exp $ */ /* * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se). * All rights reserved. @@ -358,7 +358,19 @@ struct optab table[] = { SHFL, TLDOUBLE|TDOUBLE|TFLOAT, SAREG, TWORD, NAREG, RESC1, +#ifdef notdef /* Must round down and nothing else */ " subl $4,%esp\n fistpl (%esp)\n popl A1\n", }, +#else + " subl $12,%esp\n" + " fnstcw (%esp)\n" + " fnstcw 4(%esp)\n" + " movb $12,1(%esp)\n" + " fldcw (%esp)\n" + " fistpl 8(%esp)\n" + " movl 8(%esp),A1\n" + " fldcw 4(%esp)\n" + " addl $12,%esp\n", }, +#endif /* convert float/double (in register) to (unsigned) long long */ /* XXX - unsigned is not handled correct */ @@ -366,8 +378,21 @@ struct optab table[] = { SHFL, TLDOUBLE|TDOUBLE|TFLOAT, SHLL, TLONGLONG|TULONGLONG, NCREG, RESC1, +#ifdef notdef /* Must round down and nothing else */ " subl $8,%esp\n fistpq (%esp)\n" " popl A1\n popl U1\n", }, +#else + " subl $16,%esp\n" + " fnstcw (%esp)\n" + " fnstcw 4(%esp)\n" + " movb $12,1(%esp)\n" + " fldcw (%esp)\n" + " fistpq 8(%esp)\n" + " movl 8(%esp),A1\n" + " movl 12(%esp),U1\n" + " fldcw 4(%esp)\n" + " addl $16,%esp\n", }, +#endif /* slut sconv */ |