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