public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Joe Murray <jmurray@dsrnet.com>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: RE: c/2582: implicit cast assignment from int to float problem with x86
Date: Mon, 23 Apr 2001 09:36:00 -0000	[thread overview]
Message-ID: <20010423163601.15246.qmail@sourceware.cygnus.com> (raw)

The following reply was made to PR c/2582; it has been noted by GNATS.

From: Joe Murray <jmurray@dsrnet.com>
To: "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: RE: c/2582: implicit cast assignment from int to float problem wi
	th x86
Date: Mon, 23 Apr 2001 12:42:43 -0400

 All,
 
 Intel has provided the following explanation. Is there a flag in GCC that
 may do something similar? Is there a mechanism that supports forcing a
 register assignment when an exectuable is run?
 
 Intel response:
 
 Hi  Joseph,
 
 Here's what we've found.
 
 When running C language on Intel processors, the most popular compilers
 including Microsoft* Visual C++, Borland C, Turbo C and GNU would encounter
 rounding errors when doing floating point calculations. 
 
 The floating point unit located within the processor has 4 rounding modes
 (round to nearest, round down, round up and truncate) and 3 precision modes
 (24-bit, 53-bit and 64-bit). The default mode for Intel processors is round
 to nearest. Unfortunately, the rounding mode would get changed to truncate,
 resulting in a round-off error.
 
 The easiest solution would be to add a few lines of inline assembly that
 would change the round mode to round to nearest.
 
 short example;
 
 //Loads the FPU Control register to X. 
 _asm
 {
   fstsw ax
   mov x,ax
 }
 
 //Perform a bitwise OR to change rounding mode (bit 10-11) to "To nearest
 (00). //48D=0000001100000000B
 //For more information on the FPU control reference refer to the Software
 Developer's Manual
 x=x|48;
 
 //Takes X back to the FPU Control Register
 _asm
 {
  fldcw x;
 }
 
 Randy S.
 Intel(R) Technical Support Engineer
 *Other names and brands may be claimed as the property of others.
 
 
 -----Original Message-----
 From: gcc-gnats@gcc.gnu.org [ mailto:gcc-gnats@gcc.gnu.org ]
 Sent: Wednesday, April 18, 2001 5:36 PM
 To: jmurray@dsrnet.com
 Subject: Re: c/2582: implicit cast assignment from int to float problem
 with x86
 
 
 Thank you very much for your problem report.
 It has the internal identification `c/2582'.
 The individual assigned to look at your
 report is: unassigned. 
 
 >Category:       c
 >Responsible:    unassigned
 >Synopsis:       implicit cast assignment from int to float problem with x86
 >Arrival-Date:   Wed Apr 18 14:36:01 PDT 2001


             reply	other threads:[~2001-04-23  9:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-23  9:36 Joe Murray [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-10 11:46 hubicka
2001-04-18 15:46 Joe Murray
2001-04-18 14:36 jmurray

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=20010423163601.15246.qmail@sourceware.cygnus.com \
    --to=jmurray@dsrnet.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).