Reviewers: golang-dev_googlegroups.com,
Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),
I'd like you to review this change to
https://go.googlecode.com/hg/
Description:
cmd/8l: fix data corruption for MULB SI,
The 8l linker automatically inserts XCHG instructions
to support otherwise impossible byte registers
(only available on AX, BX, CX, DX).
Sometimes AX or DX is needed (for MUL and DIV) so
we need to avoid clobbering them.
Please review this at http://codereview.appspot.com/6846057/
Affected files:
M src/cmd/8l/span.c
Index: src/cmd/8l/span.c
===================================================================
--- a/src/cmd/8l/span.c
+++ b/src/cmd/8l/span.c
@@ -1272,7 +1272,9 @@
pp = *p;
z = p->from.type;
if(z >= D_BP && z <= D_DI) {
- if(isax(&p->to)) {
+ if(isax(&p->to) || p->to.type == D_NONE) {
+ // We certainly don't want to exchange
+ // with AX if the op is MUL or DIV.
*andptr++ = 0x87; /* xchg lhs,bx */
asmand(&p->from, reg[D_BX]);
subreg(&pp, z, D_BX);