Assembly with -O2:
.file "t1.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC2:
.string "1/h == 5.0\n"
.LC3:
.string "1/h < 5.0\n"
.LC4:
.string "%llx %llx\n"
.align 8
.LC1:
.long 0x0,0x40140000
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
addl $-12,%esp
pushl $.LC2
call printf
addl $16,%esp
addl $-12,%esp
pushl .LC1+4
pushl .LC1
pushl .LC1+4
pushl .LC1
pushl $.LC4
call printf
xorl %eax,%eax
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.95.3 20010315 (release)"
Assembly with a plain compile:
.file "t1.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC2:
.string "1/h == 5.0\n"
.LC3:
.string "1/h < 5.0\n"
.LC4:
.string "%llx %llx\n"
.align 8
.LC0:
.long 0x9999999a,0x3fc99999
.align 8
.LC1:
.long 0x0,0x40140000
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $24,%esp
fldl .LC0
fstpl -8(%ebp)
fld1
fdivl -8(%ebp)
fldl .LC1
fucompp
fnstsw %ax
andb $68,%ah
xorb $64,%ah
jne .L3
addl $-12,%esp
pushl $.LC2
call printf
addl $16,%esp
.L3:
fld1
fdivl -8(%ebp)
fldl .LC1
fcompp
fnstsw %ax
andb $69,%ah
jne .L4
addl $-12,%esp
pushl $.LC3
call printf
addl $16,%esp
.L4:
addl $-12,%esp
fldl .LC1
subl $8,%esp
fstpl (%esp)
fld1
fdivl -8(%ebp)
subl $8,%esp
fstpl (%esp)
pushl $.LC4
call printf
addl $32,%esp
xorl %eax,%eax
jmp .L2
.p2align 4,,7
.L2:
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.95.3 20010315 (release)"
________________________________________
Michael D. Black Principal Engineer
mblack@csihq.com 321-676-2923,x203
http://www.csihq.com Computer Science Innovations
http://www.csihq.com/~mike My home page
FAX 321-676-2355
----- Original Message -----
From: "Andrey Ulanov" <drey@rt.mipt.ru>
To: <linux-kernel@vger.kernel.org>
Sent: Wednesday, April 17, 2002 10:05 AM
Subject: FPU, i386
Look at this:
$ cat test.c
#include <stdio.h>
main()
{
double h = 0.2;
if(1/h == 5.0)
printf("1/h == 5.0\n");
if(1/h < 5.0)
printf("1/h < 5.0\n");
return 0;
}
$ gcc test.c
$ ./a.out
1/h < 5.0
$
I also ran same a.out under FreeBSD. It says "1/h == 5.0".
It seems there is difference somewhere in FPU
initialization code. And I think it should be fixed.
ps. cc to me
-- with best regards, Andrey Ulanov. drey@rt.mipt.ru - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/