🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #14265

Floating point to integer (inline assembly)

#14265
From: Peter Kuterna
Date: Fri, 29 Jan 1999 00:00
25 lines
1522 bytes
We have in program in C that performs a test of the floating point
hardware.

Because of the C standard, the conversion from floating point to
integer is truncated. But we need to test this in the four available
rounding modes. For the i386-version of the program, I was able to
find some code with inline assembly that online performs the
conversion, and doesn't set the rounding mode to zero. The code is as
follows:

static inline int RoundToInt(double d) {
  int i;

  asm ("fistpl %0" : "=m" (i) : "t" (d) : "%st");

  return i;
}

But I'm not able to generate assembly code for the Sparc-version of
the program. Is there someone who can help me out with this?

We use gcc 2.8.1 on our system.

Thanks in advance,
Peter.
Technical Details
Message-ID: <36b27a8d.58161062@news>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,2e93b1aa5a230b4a,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: 103ab4,2e93b1aa5a230b4a,start
X-Google-Attributes: gid103ab4,public
From: kuterna@uia.ua.ac.be (Peter Kuterna)
Subject: Floating point to integer (inline assembly)
Date: 1999/01/29
Message-ID: <36b27a8d.58161062@news>
X-Deja-AN: 438273151
X-NNTP-Posting-Host: pcinf11.uia.ac.be
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@belnet.be
X-Trace: naxos.belnet.be 917601378 7251 143.169.254.1 (29 Jan 1999 09:16:18 GMT)
Organization: University of Antwerp - UIA
Mime-Version: 1.0
NNTP-Posting-Date: 29 Jan 1999 09:16:18 GMT
Newsgroups: comp.sys.sun,gnu.gcc.help