summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2014-08-12 20:58:05 -0400
committerShenghou Ma <minux@golang.org>2014-08-12 20:58:05 -0400
commitaa440488c960620581115b2a708fb41105e596c2 (patch)
treef901fa8b3c1c6b7a84c346d85d914f050206268f /src/cmd
parent7bdf31242ed0e8125e3896669da76ed0d52589df (diff)
downloadgo-aa440488c960620581115b2a708fb41105e596c2.tar.gz
[dev.power64] cmd/9c: fix endian issue in integer to floating point conversion
LGTM=rsc R=rsc, iant CC=golang-codereviews https://codereview.appspot.com/129850043
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/9c/txt.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/cmd/9c/txt.c b/src/cmd/9c/txt.c
index 345976cf2..84aeb4d8a 100644
--- a/src/cmd/9c/txt.c
+++ b/src/cmd/9c/txt.c
@@ -962,13 +962,22 @@ gmove(Node *f, Node *t)
regsalloc(&fxrat, t); /* should be type float */
gins(AMOVW, nodconst(0x43300000L), &fxc0);
gins(AMOVW, f, &fxc2);
- gins(AMOVW, &fxc0, &fxrat);
gins(AXOR, nodconst(0x80000000L), &fxc2);
- fxc1 = fxrat;
- fxc1.type = nodrat->type;
- fxc1.etype = nodrat->etype;
- fxc1.xoffset += SZ_LONG;
- gins(AMOVW, &fxc2, &fxc1);
+ if(ctxt->arch->endian == BigEndian) {
+ gins(AMOVW, &fxc0, &fxrat);
+ fxc1 = fxrat;
+ fxc1.type = nodrat->type;
+ fxc1.etype = nodrat->etype;
+ fxc1.xoffset += SZ_LONG;
+ gins(AMOVW, &fxc2, &fxc1);
+ } else {
+ gins(AMOVW, &fxc2, &fxrat);
+ fxc1 = fxrat;
+ fxc1.type = nodrat->type;
+ fxc1.etype = nodrat->etype;
+ fxc1.xoffset += SZ_LONG;
+ gins(AMOVW, &fxc0, &fxc1);
+ }
regfree(&fxc2);
regfree(&fxc0);
regalloc(&nod, t, t); /* should be type float */