From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 26 Dec 2013 22:41:00 -0500 Message-ID: From: cherry To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=089e0149cac2e251d404ee7bdc78 Subject: Re: [9fans] MIPS LE fp register ordering in MOVD Topicbox-Message-UUID: a915a826-ead8-11e9-9d60-3106f5b1d025 --089e0149cac2e251d404ee7bdc78 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Dec 26, 2013 at 6:46 PM, cherry wrote: > Another issue is 0l/vl seems to output wrong bits for single precision > floats in little endian mode, due to a similar reason: it used bytes 4-7 > instead of 0-3. This seems to fix it: > > % diff /sys/src/cmd/vl/asm.c asm.c > 672c672,675 > < buf.dbuf[l] = cast[fnuxi8[i+4]]; > --- > > if(little) > > buf.dbuf[l] = cast[fnuxi8[i]]; > > else > > buf.dbuf[l] = cast[fnuxi8[i+4]]; > > An alternative fix would be simply use fnuxi4 instead of fnuxi8, so that > both BE and LE would work (I guess, don't have BE machine to test). > Indeed I can test it, simply diff the output of vl before and after. Using, fnuxi4 does NOT work for BE, as fnuxi4 is only set for LE (obj.c:1385,1404), probably due to (the same or another) historical reason. - cherry --089e0149cac2e251d404ee7bdc78 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Thu, Dec 26, 2013 at 6:46 PM, cherry <lunaria21@gmail.com= > wrote:
Another issue is 0l/vl seem= s to output wrong bits for single precision floats in little endian mode, d= ue to a similar reason: it used bytes 4-7 instead of 0-3. This seems to fix= it:

% diff /sys/src/cmd/vl/asm.c asm.c
672c672,675
< =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 buf.d= buf[l] =3D cast[fnuxi8[i+4]];
---
> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 = =A0=A0=A0 =A0=A0=A0 if(little)
> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0= =A0 =A0=A0=A0 =A0=A0=A0 buf.dbuf[l] =3D cast[fnuxi8[i]];
> =A0=A0=A0 = =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 else
> =A0=A0=A0 =A0=A0=A0 = =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 buf.dbuf[l] =3D cast[fnuxi8[i+4]];<= br>
An alternative fix would be simply use fnuxi4 instead of fnuxi8, so tha= t both BE and LE would work (I guess, don't have BE machine to test).

Indeed I can test it, simply diff the output of v= l before and after. Using, fnuxi4 does NOT work for BE, as fnuxi4 is only s= et for LE (obj.c:1385,1404), probably due to (the same or another) historic= al reason.

- cherry

--089e0149cac2e251d404ee7bdc78--