projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The situation with unsigned char/short comparisons and constants was worse
[unix-history]
/
usr
/
src
/
old
/
pcc
/
ccom.tahoe
/
table.c
diff --git
a/usr/src/old/pcc/ccom.tahoe/table.c
b/usr/src/old/pcc/ccom.tahoe/table.c
index
dcb0b81
..
9e18185
100644
(file)
--- a/
usr/src/old/pcc/ccom.tahoe/table.c
+++ b/
usr/src/old/pcc/ccom.tahoe/table.c
@@
-1,5
+1,5
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)table.c 1.
17
(Berkeley) %G%";
+static char sccsid[] = "@(#)table.c 1.
20
(Berkeley) %G%";
#endif
# include "pass2.h"
#endif
# include "pass2.h"
@@
-171,22
+171,35
@@
OPLOG, FORCC,
0, RESCC,
" cmpl AL,AR\nZP",
0, RESCC,
" cmpl AL,AR\nZP",
-/* tahoe won't handle uns char/short equality/inequality with mem and const */
-EQ, FORCC,
- AWD, TUCHAR|TUSHORT,
+/* more grot: constants in unsigned char/short comparisons sign-extend */
+/* optim2() ensures that SCCON/SSCON iff high bit is not set */
+OPLOG, FORCC,
+ SAREG|AWD, TUCHAR,
+ SCCON, TANY,
+ 0, RESCC,
+ " cmpZL AL,AR\nZP",
+
+OPLOG, FORCC,
+ AWD, TUCHAR,
SCON, TANY,
NAREG, RESCC,
SCON, TANY,
NAREG, RESCC,
- " movzZLl AL,A1\n cmpZL A1,AR\nZP",
+ " movzZLl AL,A1\n cmpl A1,AR\nZP",
+
+OPLOG, FORCC,
+ SAREG|AWD, TUSHORT,
+ SSCON, TANY,
+ 0, RESCC,
+ " cmpZL AL,AR\nZP",
-
NE,
FORCC,
- AWD, TU
CHAR|TU
SHORT,
+
OPLOG,
FORCC,
+ AWD, TUSHORT,
SCON, TANY,
NAREG, RESCC,
SCON, TANY,
NAREG, RESCC,
- " movzZLl AL,A1\n cmp
ZL
A1,AR\nZP",
+ " movzZLl AL,A1\n cmp
l
A1,AR\nZP",
/* optim2() handles degenerate comparisons with constants */
OPLOG, FORCC,
/* optim2() handles degenerate comparisons with constants */
OPLOG, FORCC,
- SAREG|AWD, TCHAR|T
UCHAR|TSHORT|TU
SHORT,
+ SAREG|AWD, TCHAR|TSHORT,
SCON, TANY,
0, RESCC,
" cmpZL AL,AR\nZP",
SCON, TANY,
0, RESCC,
" cmpZL AL,AR\nZP",
@@
-322,13
+335,13
@@
OPSHFT, INAREG|INTAREG|FORCC,
" ZB AR,A1\n ZH A1,AL,A1\n",
INCR, FOREFF,
" ZB AR,A1\n ZH A1,AL,A1\n",
INCR, FOREFF,
- SAREG|AWD, T
WORD
,
+ SAREG|AWD, T
ANY
,
SCON|SNAME, TANY,
0, RLEFT,
" ZE\n",
DECR, FOREFF,
SCON|SNAME, TANY,
0, RLEFT,
" ZE\n",
DECR, FOREFF,
- SAREG|AWD, T
WORD
,
+ SAREG|AWD, T
ANY
,
SCON|SNAME, TANY,
0, RLEFT,
" ZE\n",
SCON|SNAME, TANY,
0, RLEFT,
" ZE\n",
@@
-738,11
+751,12
@@
MOD, INAREG|FOREFF,
" movl AL,U1\n clrl A1\n ediv AR,A1,U1,A1\n",
/* should only see UNSIGNED lhs here if converted from UCHAR/USHORT lhs */
" movl AL,U1\n clrl A1\n ediv AR,A1,U1,A1\n",
/* should only see UNSIGNED lhs here if converted from UCHAR/USHORT lhs */
+/* beware -- the ediv remainder operand must be a register */
ASG MOD, INAREG|FOREFF,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
SAREG|AWD, TINT|TLONG,
NAREG|NEVEN, RLEFT|RESCC,
ASG MOD, INAREG|FOREFF,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
SAREG|AWD, TINT|TLONG,
NAREG|NEVEN, RLEFT|RESCC,
- " ZM ediv AR,A1,A1,AL\n",
+ " ZM ediv AR,A1,
U1,A1\n movl
A1,AL\n",
ASG MOD, INAREG|FOREFF,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
ASG MOD, INAREG|FOREFF,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
@@
-754,7
+768,7
@@
ASG MOD, INAREG|FOREFF,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
SCON, ANYUSIGNED,
NAREG|NEVEN, RLEFT,
SAREG|AWD, TINT|TLONG|TUNSIGNED|TULONG,
SCON, ANYUSIGNED,
NAREG|NEVEN, RLEFT,
- " movl AL,U1\n clrl A1\n ediv AR,A1,A1,AL\n",
+ " movl AL,U1\n clrl A1\n ediv AR,A1,
U1,A1\n movl
A1,AL\n",
/* XXX is this supposed to help on overflow? */
ASG MUL, INAREG|FOREFF|FORCC,
/* XXX is this supposed to help on overflow? */
ASG MUL, INAREG|FOREFF|FORCC,