All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mike Black" <mblack@csihq.com>
To: "Andrey Ulanov" <drey@rt.mipt.ru>, <linux-kernel@vger.kernel.org>
Subject: Re: FPU, i386
Date: Wed, 17 Apr 2002 10:20:18 -0400	[thread overview]
Message-ID: <044301c1e61b$00738240$e1de11cc@csihq.com> (raw)
In-Reply-To: <20020417140510.GB9930@gleam.rt.mipt.ru>

When you use -O2 it works.

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/



  reply	other threads:[~2002-04-17 14:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-17 14:05 FPU, i386 Andrey Ulanov
2002-04-17 14:20 ` Mike Black [this message]
2002-04-17 14:26 ` Richard B. Johnson
2002-04-17 14:29 ` Nikita Danilov
2002-04-17 15:20 ` Gunther Mayer
  -- strict thread matches above, loose matches on Subject: below --
2002-04-17 14:40 Jesse Pollard
2002-04-17 14:49 ` John Alvord
2002-04-18  8:31 ` Jakob Østergaard
2002-04-25 13:09 ` rpm
2002-04-25 13:22   ` Andreas Schwab
2002-04-25 14:22   ` Richard B. Johnson
2002-04-25 15:24     ` Mark Mielke
2002-04-25 16:08       ` Richard B. Johnson
2002-04-25 14:38 Nicholas Berry
     [not found] <scc7dcc8.053@mail-02.med.umich.edu>
2002-04-25 14:52 ` Richard B. Johnson
2002-04-26 22:10 Kerl, John
2002-04-29 12:33 ` Richard B. Johnson
2002-04-29 16:19 Kerl, John

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='044301c1e61b$00738240$e1de11cc@csihq.com' \
    --to=mblack@csihq.com \
    --cc=drey@rt.mipt.ru \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.