On Fri, Mar 6, 2009 at 12:27 PM, Bernd Roesch <nospamn...@web.de> wrote: > Hi, > > I see in compiler source there is in builtin.c lrint lrintf.so the gcc need > no extern linker lib when i understand right. > > But get linker error when use them.I test compiler 3.4.0 4.3.2 and 4.4.0 > > I also link with libgcc.but does not help > > also my includes-fixed/math.h > > contain a declaration but it is long int. > extern long int lrint _PARAMS((double)); > > This mean 64 bit int ? > > But i use 32 bit 68k compiler and as far i see lrint return a long in docu. > > only solution i find short is add in library. > > long lrintf(float x) > { > return (long)x; > } > > But when do this code, then there should be used current rounding.68k for > example support a simple fmove.l fp0,d0 and use current rounding to convert > from float. > > But gcc (test with 4.3.2)output this code in -m68020 -m68881 -03. > > FMOVE.S #+1.2344999E+4,FP0 > FADD.L D4,FP0 > FINTRZ.X FP0 > FMOVE.L FP0,-(A7) > > But i think there is no fintrz need and this code do the same job and use > the correct rounding setting. > > FMOVE.S #+1.2344999E+4,FP0 > FADD.L D4,FP0 > FMOVE.L FP0,-(A7) > > Or i am wrong ?.Or is "return (long)x;" specified to always round to zero ? > > How can i then implement lrint func without asm Code ?
If the backend does not support inlining lrint then you need to link against a C99 math library (-lm). You can add lrint<srcmode><destmode> patterns to m68k.md to provide inline expansions. Richard. > please help > >