summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-07-01 12:36:29 -0700
committerRuss Cox <rsc@golang.org>2010-07-01 12:36:29 -0700
commite120ae7eb4a28861fb50a6534acefc5352f39865 (patch)
tree7a112c63fe7aaa41e1cc8d49a5938468ac2ee4d5
parent67daf5190382a49a4be780eb18613a8e1535532d (diff)
downloadgolang-e120ae7eb4a28861fb50a6534acefc5352f39865.tar.gz
6a: assemble CMPPD as 6l expects
libmach: disassemble CMPPD as 6a expects R=ken2 CC=Charlie Dorian, golang-dev http://codereview.appspot.com/1704046
-rw-r--r--src/cmd/6a/a.y2
-rw-r--r--src/libmach/8db.c13
2 files changed, 11 insertions, 4 deletions
diff --git a/src/cmd/6a/a.y b/src/cmd/6a/a.y
index c48246072..804f638a0 100644
--- a/src/cmd/6a/a.y
+++ b/src/cmd/6a/a.y
@@ -260,7 +260,7 @@ spec8: /* CMPPS/CMPPD */
{
$$.from = $1;
$$.to = $3;
- $$.from.offset = $5;
+ $$.to.offset = $5;
}
spec9: /* shufl */
diff --git a/src/libmach/8db.c b/src/libmach/8db.c
index ba14dfc3c..92e4c7694 100644
--- a/src/libmach/8db.c
+++ b/src/libmach/8db.c
@@ -695,7 +695,7 @@ static Optable optab0F[256]=
[0xB1] RM,0, "CMPXCHG%S %r,%e",
[0xC0] RMB,0, "XADDB %r,%e",
[0xC1] RM,0, "XADD%S %r,%e",
-[0xC2] RM,Ib, "CMP%s %i,%x,%X",
+[0xC2] RM,Ib, "CMP%s %x,%X,%#i",
[0xC3] RM,0, "MOVNTI%S %r,%e",
[0xC6] RM,Ib, "SHUF%s %i,%x,%X",
[0xC8] 0,0, "BSWAP AX",
@@ -2074,6 +2074,7 @@ pea(Instr *ip)
static void
prinstr(Instr *ip, char *fmt)
{
+ int sharp;
vlong v;
if (ip->prefix)
@@ -2083,7 +2084,12 @@ prinstr(Instr *ip, char *fmt)
*ip->curr++ = *fmt;
continue;
}
- switch(*++fmt){
+ sharp = 0;
+ if(*++fmt == '#') {
+ sharp = 1;
+ ++fmt;
+ }
+ switch(*fmt){
case '%':
*ip->curr++ = '%';
break;
@@ -2107,7 +2113,8 @@ prinstr(Instr *ip, char *fmt)
bprint(ip,"%s", ONAME(ip));
break;
case 'i':
- bprint(ip, "$");
+ if(!sharp)
+ bprint(ip, "$");
v = ip->imm;
if(ip->rex & REXW)
v = ip->imm64;