From: Shenghou Ma Date: Wed, 13 Aug 2014 00:58:05 +0000 (-0400) Subject: [dev.power64] cmd/9c: fix endian issue in integer to floating point conversion X-Git-Tag: go1.5beta1~2684^2~25^2~64 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=860f941e7fdcb22c6b4956f187cb47fd06833c12;p=gostls13.git [dev.power64] cmd/9c: fix endian issue in integer to floating point conversion LGTM=rsc R=rsc, iant CC=golang-codereviews https://golang.org/cl/129850043 --- diff --git a/src/cmd/9c/txt.c b/src/cmd/9c/txt.c index 345976cf20..84aeb4d8a9 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 */