comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: Problems converting Float to Integer efficiently
Date: Thu, 09 Oct 2003 04:21:14 +0100
Date: 2003-10-09T04:21:14+01:00	[thread overview]
Message-ID: <Ku4hb.8589$RU4.82535@newsfep4-glfd.server.ntli.net> (raw)
In-Reply-To: <HQ3hb.526332$cF.190598@rwcrnsc53>

Jeff C, wrote:
...
> begin
>   Asm ("cvttss2si %1, %0",inputs  => float'asm_input("m", y),
>                           Outputs => integer'asm_output("=r",temp));
>   return temp;
> end truncate;
...

This looks like the kind of thing I was wanting the compiler to produce.
I'm not a whizz at Intel Assember (nor package Machine_Code), so it might have
taken a long time to for me to figure out exactly what I needed.

It's a bit disappointing that the compiler does not produce code like this for
some "obvious" source code.  I dislike Ada's default of rounding to nearest, and
it seems that a series of Float=>Integer attributes might help the compiler.

I have Athlons and GNAT 3.15, so I may have to experiment with this approach.
But it is now past my bedtime...

Thanks for a speedy response on this problem!
--
Adrian Wrigley, Cambridge, England.




  reply	other threads:[~2003-10-09  3:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-09  0:06 Problems converting Float to Integer efficiently Dr. Adrian Wrigley
2003-10-09  1:08 ` Jeffrey Carter
2003-10-09  2:36 ` Jeff C,
2003-10-09  3:21   ` Dr. Adrian Wrigley [this message]
2003-10-09  3:36     ` Jeff C,
2003-10-17 20:57     ` Randy Brukardt
2003-10-09 22:36   ` Dr. Adrian Wrigley
2003-10-10  2:05     ` Jeff C,
2003-10-10 17:15     ` Robert I. Eachus
2003-10-11  1:47     ` Waldek Hebisch
2003-10-09  7:10 ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox