Floating Point problems with Linux on the EST SBC8260
Floating Point problems with Linux on the EST SBC8260:
Questions:
- What is the state of floating point support with Linux on the MPC8260?
- Does anybody have hard-float applications running on the MPC8260?
- I am looking for a floating point validation test suite written in C. The test suite should start with the fundamentals and work out from there.
Does anybody have any leads? This is what I have found so far:
1) TestFloat-2a
Package Overview for TestFloat Release 2a
John R. Hauser
1998 December 16
TestFloat is a program for testing that a floating-point implementation conforms to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. TestFloat is distributed in the form of C source code. The TestFloat package actually provides two related programs:
-- The `testfloat' program tests a system's floating-point for conformance
to the IEC/IEEE Standard. This program uses the SoftFloat software floating-point implementation as a basis for comparison.
-- The `testsoftfloat' program tests SoftFloat itself for conformance to
the IEC/IEEE Standard. These tests are performed by comparing against a separate, slower software floating-point that is included in the TestFloat package.
2) UCBTEST
UCBTEST is a suite of programs for testing certain difficult cases of
IEEE 754 floating-point arithmetic. Some of the difficult test cases are obtained from number-theoretic algorithms developed by Turing Award winner Prof. W. Kahan, Department of Electrical Engineering and Computer Science, University of California, Berkeley, as part of ongoing research into test methods for computer arithmetic.
Either TestFloat or UCBTEST will require some porting effort to run on the PPC. I would like to work smarter rather than harder. I can't even get the rights answers from printf, *, or /.
Environment:
Platform: EST SBC8260 w/ MPC8260 Rev A.1 running at 166 Mhz
Ethernet: 10 Mbs (SCC)
Linux kernel: 2.3.99-pre9
root filesystem (NFS mounted): MontaVista Hard Hat Linux version 1.1
Toolset: Denx Software CDK recompiled with gcc configured for
--with-cpu=603e and hard-float (i.e. no --nfp)
Application:
Note: The executable was statically linked to pull in the hard-float
C runtime libraries.
dell 403} cat z.c
#include "stdio.h"
double x, y, z;
main ()
{
x = 1234.33;
printf("x %lf (1234.33) 0x%08lX\n", x , x);
y = 4444.2;
printf("y %lf (4444.2) 0x%08lX\n", y , y);
z = x * y;
printf("z = x * y, %lf %lf %lf\n", x , y, z); z = x / y;
printf("z = x / y, %lf %lf %lf\n", x , y, z);
}
dell 404} cat z.s
.file "z.c" gcc2_compiled.: .section ".rodata" .align 2 .LC1: .string "x %lf (1234.33) 0x%08lX\n" .align 2 .LC3: .string "y %lf (4444.2) 0x%08lX\n" .align 2 .LC4: .string "z = x * y, %lf %lf %lf\n" .align 2 .LC5: .string "z = x / y, %lf %lf %lf\n" .align 3 .LC0: .long 0x40934951 .long 0xeb851eb8 .align 3 .LC2: .long 0x40b15c33 .long 0x33333333 .section ".text" .align 2 .globl main .type main,@function main: stwu 1,-16(1) mflr 0 stw 31,12(1) stw 0,20(1) mr 31,1 lis 9,x@ha lis 11,.LC0@ha lfd 0,.LC0@l(11) stfd 0,x@l(9) lis 9,x@ha lis 11,x@ha lis 10,.LC1@ha la 3,.LC1@l(10) lfd 1,x@l(9) lfd 2,x@l(11) creqv 6,6,6 bl printf lis 9,y@ha lis 11,.LC2@ha lfd 0,.LC2@l(11) stfd 0,y@l(9) lis 9,y@ha lis 11,y@ha lis 10,.LC3@ha la 3,.LC3@l(10) lfd 1,y@l(9) lfd 2,y@l(11) creqv 6,6,6 bl printf lis 9,z@ha lis 11,x@ha lis 10,y@ha lfd 0,x@l(11) lfd 13,y@l(10) fmul 0,0,13 stfd 0,z@l(9) lis 9,x@ha lis 11,y@ha lis 10,z@ha lis 8,.LC4@ha la 3,.LC4@l(8) lfd 1,x@l(9) lfd 2,y@l(11) lfd 3,z@l(10) creqv 6,6,6 bl printf lis 9,z@ha lis 11,x@ha lis 10,y@ha lfd 0,x@l(11) lfd 13,y@l(10) fdiv 0,0,13 stfd 0,z@l(9) lis 9,x@ha lis 11,y@ha lis 10,z@ha lis 8,.LC5@ha la 3,.LC5@l(8) lfd 1,x@l(9) lfd 2,y@l(11) lfd 3,z@l(10) creqv 6,6,6 bl printf .L2: lwz 11,0(1) lwz 0,4(11) mtlr 0 lwz 31,-4(11) mr 1,11 blr .Lfe1: .size main,.Lfe1-main .comm x,8,8 .comm y,8,8 .comm z,8,8 .ident "GCC: (GNU) 2.95.2 19991024 (release)"
On the target:
Quoted 1 line
./a.out
x nan (1234.33) 0x00000000
y 0.000000 (4444.2) 0x1003FBCC
z = x * y, 0.000000 0.000000 0.000000
z = x / y, 0.000000 0.000000 0.000000
The expected results should look something like:
dell 420} ./a.out
x 1234.330000 (1234.33) 0xEB851EB8
y 4444.200000 (4444.2) 0x33333333
z = x * y, 1234.330000 4444.200000 5485609.386000
z = x / y, 1234.330000 4444.200000 0.277740
We aren't even close to reasonable answers yet.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 3 lines · diekema_jon
- I am looking for a floating point validation test suite written in C. The test suite should start with the fundamentals and work out from there.
Try paranoia.c. A web search should turn up multiple copies, I found one at
http://www.enseeiht.fr/NetLib/paranoia/index.html
A while back I had the floating point emulator from kernel 2.3 patched into kernel 2.2.13 running on an MBX, and it did reasonably well on this test as I recall.
Quoted 1 line
From the comments in
paranoia.c:
A C version of Kahan's Floating Point Test "Paranoia"
Thos Sumner, UCSF, Feb. 1985
David Gay, BTL, Jan. 1986
This is a rewrite from the Pascal version by
B. A. Wichmann, 18 Jan. 1985
(and does NOT exhibit good C programming style).
.
.
.You may copy this program freely if you acknowledge its source.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 208 lines · diekema_jon
Floating Point problems with Linux on the EST SBC8260:
Questions:
- What is the state of floating point support with Linux on the MPC8260?
- Does anybody have hard-float applications running on the MPC8260?
- I am looking for a floating point validation test suite written in C. The test suite should start with the fundamentals and work out from there.
Does anybody have any leads? This is what I have found so far:
1) TestFloat-2a
Package Overview for TestFloat Release 2a
John R. Hauser
1998 December 16TestFloat is a program for testing that a floating-point implementation conforms to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. TestFloat is distributed in the form of C source code. The TestFloat package actually provides two related programs:
-- The `testfloat' program tests a system's floating-point for conformance
to the IEC/IEEE Standard. This program uses the SoftFloat software floating-point implementation as a basis for comparison.-- The `testsoftfloat' program tests SoftFloat itself for conformance to
the IEC/IEEE Standard. These tests are performed by comparing against a separate, slower software floating-point that is included in the TestFloat package.2) UCBTEST
UCBTEST is a suite of programs for testing certain difficult cases of
IEEE 754 floating-point arithmetic. Some of the difficult test cases are obtained from number-theoretic algorithms developed by Turing Award winner Prof. W. Kahan, Department of Electrical Engineering and Computer Science, University of California, Berkeley, as part of ongoing research into test methods for computer arithmetic.Either TestFloat or UCBTEST will require some porting effort to run on the PPC. I would like to work smarter rather than harder. I can't even get the rights answers from printf, *, or /.
Environment:
Platform: EST SBC8260 w/ MPC8260 Rev A.1 running at 166 Mhz
Ethernet: 10 Mbs (SCC)
Linux kernel: 2.3.99-pre9
root filesystem (NFS mounted): MontaVista Hard Hat Linux version 1.1
Toolset: Denx Software CDK recompiled with gcc configured for--with-cpu=603e and hard-float (i.e. no --nfp)Application:
Note: The executable was statically linked to pull in the hard-float
C runtime libraries.dell 403} cat
z.c
#include "stdio.h"double x, y, z;
main ()
{
x = 1234.33;
printf("x %lf (1234.33) 0x%08lX\n", x , x);y = 4444.2; printf("y %lf (4444.2) 0x%08lX\n", y , y); z = x * y; printf("z = x * y, %lf %lf %lf\n", x , y, z);z = x / y;
printf("z = x / y, %lf %lf %lf\n", x , y, z);
}dell 404} cat z.s
.file "z.c" gcc2_compiled.: .section ".rodata" .align 2 .LC1: .string "x %lf (1234.33) 0x%08lX\n" .align 2 .LC3: .string "y %lf (4444.2) 0x%08lX\n" .align 2 .LC4: .string "z = x * y, %lf %lf %lf\n" .align 2 .LC5: .string "z = x / y, %lf %lf %lf\n" .align 3 .LC0: .long 0x40934951 .long 0xeb851eb8 .align 3 .LC2: .long 0x40b15c33 .long 0x33333333 .section ".text" .align 2 .globl main .type main,@function main: stwu 1,-16(1) mflr 0 stw 31,12(1) stw 0,20(1) mr 31,1 lis 9,x@ha lis 11,.LC0@ha lfd 0,.LC0@l(11) stfd 0,x@l(9) lis 9,x@ha lis 11,x@ha lis 10,.LC1@ha la 3,.LC1@l(10) lfd 1,x@l(9) lfd 2,x@l(11) creqv 6,6,6 bl printf lis 9,y@ha lis 11,.LC2@ha lfd 0,.LC2@l(11) stfd 0,y@l(9) lis 9,y@ha lis 11,y@ha lis 10,.LC3@ha la 3,.LC3@l(10) lfd 1,y@l(9) lfd 2,y@l(11) creqv 6,6,6 bl printf lis 9,z@ha lis 11,x@ha lis 10,y@ha lfd 0,x@l(11) lfd 13,y@l(10) fmul 0,0,13 stfd 0,z@l(9) lis 9,x@ha lis 11,y@ha lis 10,z@ha lis 8,.LC4@ha la 3,.LC4@l(8) lfd 1,x@l(9) lfd 2,y@l(11) lfd 3,z@l(10) creqv 6,6,6 bl printf lis 9,z@ha lis 11,x@ha lis 10,y@ha lfd 0,x@l(11) lfd 13,y@l(10) fdiv 0,0,13 stfd 0,z@l(9) lis 9,x@ha lis 11,y@ha lis 10,z@ha lis 8,.LC5@ha la 3,.LC5@l(8) lfd 1,x@l(9) lfd 2,y@l(11) lfd 3,z@l(10) creqv 6,6,6 bl printf .L2: lwz 11,0(1) lwz 0,4(11) mtlr 0 lwz 31,-4(11) mr 1,11 blr .Lfe1: .size main,.Lfe1-main .comm x,8,8 .comm y,8,8 .comm z,8,8 .ident "GCC: (GNU) 2.95.2 19991024 (release)"On the target:
Quoted 1 line
./a.out
x nan (1234.33)
0x00000000
y 0.000000 (4444.2)0x1003FBCC
z = x * y, 0.000000 0.000000 0.000000
z = x / y, 0.000000 0.000000 0.000000The expected results should look something like:
Quoted 8 lines
dell 420} ./a.out
x 1234.330000 (1234.33)0xEB851EB8
y 4444.200000 (4444.2)0x33333333
z = x * y, 1234.330000 4444.200000 5485609.386000
z = x / y, 1234.330000 4444.200000 0.277740We aren't even close to reasonable answers yet.
--
Neil Russell <[email protected]>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Oops, let's try that again...
I tried this on my board. I'm running 2.2.14 the SBC8260 and some other hardware. I ran the code you posted and it produced exactly the results that it should have.
The word I have from Motorola is that rev A.1 8260's have a full FPU, whereas prior version do not. My experiences confirm this.
Also, I don't cross compile; I use a G3 MAC running linux. I wonder if this makes a difference?
Neil.
Quoted 7 lines · diekema_jon
Floating Point problems with Linux on the EST SBC8260:
The expected results should look something like:
Quoted 8 lines
dell 420} ./a.out
x 1234.330000 (1234.33)0xEB851EB8
y 4444.200000 (4444.2)0x33333333
z = x * y, 1234.330000 4444.200000 5485609.386000
z = x / y, 1234.330000 4444.200000 0.277740We aren't even close to reasonable answers yet.
--
Neil Russell <[email protected]>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 2 lines · diekema_jon
- What is the state of floating point support with Linux on the MPC8260?
Same as any 603 with FPU.
Quoted 6 lines
Platform: EST SBC8260 w/ MPC8260 Rev A.1 running at 166 Mhz
Ethernet: 10 Mbs (SCC)
Linux kernel: 2.3.99-pre9
root filesystem (NFS mounted): MontaVista Hard Hat Linux version 1.1
Toolset: Denx Software CDK recompiled with gcc configured for--with-cpu=603e and hard-float (i.e. no --nfp)
You can't be mixing stuff like this. If you would read the documentation provided with the MontaVista CDK, you would have discovered that you need to use the tools, libraries, applications, and file systems with the kit. Further, you would have discovered the 1.1 CDK is for an 8xx and the libraries are compiled for soft (in-line) floating point. You are mixing floating point instructions with library and compiler support that assumes otherwise.......The CDK 1.1 is an update to CDK 1.0. The documentation is found in the 1.0 directory.
-- Dan
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 7 lines
From Dan Malek:
Further, you would have discovered the 1.1 CDK is for an 8xx and the libraries are compiled for soft (in-line) floating point. You are mixing floating point instructions with library and compiler support that assumes otherwise.
My application was statically linked against the Denx CDK that was compiled for hard float. The static application already has all the libraries routines that it needs, hence it won't pull in the Hard Hat Linux 1.1 libraries (soft float) from the root filesystem.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 10 lines
Date: Wed, 24 May 2000 13:42:56 -0700
From: Bill Roman <[email protected]>Quoted 3 lines · diekema_jon
- I am looking for a floating point validation test suite written in C. The test suite should start with the fundamentals and work out from there.
Quoted 7 lines
Try
paranoia.c. A web search should turn up multiple copies, I found one athttp://www.enseeiht.fr/NetLib/paranoia/index.html
A while back I had the floating point emulator from kernel 2.3 patched into kernel 2.2.13 running on an MBX, and it did reasonably well on this test as I recall.
paranoia.c was quite helpful in verifying the floating point operation on the EST SBC8260 board with a MPC8260 Rev A.1. I statically compiled this program under Yellow Dog Linux champion server 1.2, and ran it on the SBC8260. paranoia.c didn't find anything to complain about. :)
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/