From: Finn Thain <fthain@telegraphics.com.au>
To: "Mattias Engdegård" <mattiase@bredband.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
linux-m68k@vger.kernel.org, zippel@linux-m68k.org
Subject: Re: FPU emulation incorrect for 68LC040?
Date: Fri, 23 Jul 2010 14:12:25 +1000 (EST) [thread overview]
Message-ID: <alpine.OSX.2.00.1007231358580.393@localhost> (raw)
In-Reply-To: <1CC1901B-7E56-4FAF-96A4-8F2F2F5C38A9@bredband.net>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3385 bytes --]
On Thu, 22 Jul 2010, Mattias Engdegård wrote:
> 22 jul 2010 kl. 03.05 skrev Finn Thain:
>
> > But if you send me some inline asm, I'll patch it into busybox and test a
> > 2.6.34 initramfs for you.
>
> Thanks! Try this:
>
> void test_postinc(void)
> {
> double x = 0.0;
> double a[2] = {3.5, 0.0};
> double *p = a;
> __asm__ volatile ("fneg.d (%0)+,%1" : "+a"(p), "+f"(x));
> printf("postinc: result %f (expected %f), address %p (expected %p)\n",
> x, -3.5, p, a + 1);
> }
>
> void test_predec(void)
> {
> double x = 0.0;
> double a[2] = {-1.75, 0.0};
> double *p = a + 1;
> __asm__ volatile ("fneg.d -(%0),%1" : "+a"(p), "+f"(x));
> printf("predec: result %f (expected %f), address %p (expected %p)\n",
> x, 1.75, p, a);
> }
>
I ran this on a PowerBook 190cs:
postinc: result -3.500000 (expected -3.500000), address 0xef8ddcf8 (expected 0xef8ddcf8)
predec: result 1.750000 (expected 1.750000), address 0xef8ddcf0 (expected 0xef8ddcf0)
It is probably not relevant, but I believe that this CPU is free from the
68LC040 erratum that affects page faults and FPU ops as I've tested for
that before.
# cat /proc/cpuinfo
CPU: 68040
MMU: 68040
FPU: none
Clocking: 32.9MHz
BogoMips: 21.96
Calibration: 109824 loops
# cat /proc/version
Linux version 2.6.34-mac (fthain@nippy) (gcc version 4.4.4 (GCC) ) #5 Fri Jul 23 13:32:53 EST 2010
Here's the disassembly:
8007da96 <test_predec>:
8007da96: 4e56 fff0 linkw %fp,#-16
8007da9a: 2d7c bffc 0000 movel #-1074003968,%fp@(-16)
8007daa0: fff0
8007daa2: 42ae fff4 clrl %fp@(-12)
8007daa6: 42ae fff8 clrl %fp@(-8)
8007daaa: 42ae fffc clrl %fp@(-4)
8007daae: 41ee fff8 lea %fp@(-8),%a0
8007dab2: f200 5c0f fmovecrx #15,%fp0
8007dab6: f220 541a fnegd %a0@-,%fp0
8007daba: 486e fff0 pea %fp@(-16)
8007dabe: 2f08 movel %a0,%sp@-
8007dac0: 42a7 clrl %sp@-
8007dac2: 2f3c 3ffc 0000 movel #1073479680,%sp@-
8007dac8: f227 7400 fmoved %fp0,%sp@-
8007dacc: 4879 8009 b25a pea 8009b25a <isoformats.7051+0x29>
8007dad2: 2f39 800a 8e04 movel 800a8e04 <_IO_stderr>,%sp@-
8007dad8: 4eb9 8000 e564 jsr 8000e564 <__fprintf>
8007dade: 4fef 0020 lea %sp@(32),%sp
8007dae2: 4e5e unlk %fp
8007dae4: 4e75 rts
8007dae6 <test_postinc>:
8007dae6: 4e56 fff0 linkw %fp,#-16
8007daea: 2d7c 400c 0000 movel #1074528256,%fp@(-16)
8007daf0: fff0
8007daf2: 42ae fff4 clrl %fp@(-12)
8007daf6: 42ae fff8 clrl %fp@(-8)
8007dafa: 42ae fffc clrl %fp@(-4)
8007dafe: 41ee fff0 lea %fp@(-16),%a0
8007db02: f200 5c0f fmovecrx #15,%fp0
8007db06: f218 541a fnegd %a0@+,%fp0
8007db0a: 486e fff8 pea %fp@(-8)
8007db0e: 2f08 movel %a0,%sp@-
8007db10: 42a7 clrl %sp@-
8007db12: 2f3c c00c 0000 movel #-1072955392,%sp@-
8007db18: f227 7400 fmoved %fp0,%sp@-
8007db1c: 4879 8009 b295 pea 8009b295 <isoformats.7051+0x64>
8007db22: 2f39 800a 8e04 movel 800a8e04 <_IO_stderr>,%sp@-
8007db28: 4eb9 8000 e564 jsr 8000e564 <__fprintf>
8007db2e: 4fef 0020 lea %sp@(32),%sp
8007db32: 4e5e unlk %fp
8007db34: 4e75 rts
HTH
Finn
next prev parent reply other threads:[~2010-07-23 4:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 20:22 FPU emulation incorrect for 68LC040? Mattias Engdegård
2010-07-21 20:32 ` Geert Uytterhoeven
2010-07-21 20:53 ` Mattias Engdegård
2010-07-22 1:05 ` Finn Thain
2010-07-22 19:55 ` Mattias Engdegård
2010-07-23 4:12 ` Finn Thain [this message]
2010-07-23 8:39 ` Mattias Engdegård
2010-07-24 0:31 ` Michael Schmitz
2010-07-24 18:33 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.OSX.2.00.1007231358580.393@localhost \
--to=fthain@telegraphics.com.au \
--cc=geert@linux-m68k.org \
--cc=linux-m68k@vger.kernel.org \
--cc=mattiase@bredband.net \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox