From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e0423f8984d47f76 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-08 20:36:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-server.caltech.edu!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!sccrnsc04.POSTED!not-for-mail From: "Jeff C," Newsgroups: comp.lang.ada References: Subject: Re: Problems converting Float to Integer efficiently X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 66.31.4.164 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc04 1065670611 66.31.4.164 (Thu, 09 Oct 2003 03:36:51 GMT) NNTP-Posting-Date: Thu, 09 Oct 2003 03:36:51 GMT Organization: Comcast Online Date: Thu, 09 Oct 2003 03:36:51 GMT Xref: archiver1.google.com comp.lang.ada:514 Date: 2003-10-09T03:36:51+00:00 List-Id: "Dr. Adrian Wrigley" wrote in message news:Ku4hb.8589$RU4.82535@newsfep4-glfd.server.ntli.net... > 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. > I don't really know what I am doing with assembly lang inserts with GNAT either. If I did I am sure it would be pretty simple to make a 6-7 instruction insertion for this that would work with 3.15. The big problem of course is not so much the compiler as the binutils needing to know this instruction...... What OS are you running on?