[Mesa-dev] [PATCH] Add an accelerated version of F_TO_I for x86_64
Jason Ekstrand
jason at jlekstrand.net
Tue Jul 22 16:18:07 PDT 2014
On Mon, Jul 21, 2014 at 5:29 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Mon, Jul 21, 2014 at 5:16 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> > src/mesa/main/imports.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
> > index af780b2..5d6486b 100644
> > --- a/src/mesa/main/imports.h
> > +++ b/src/mesa/main/imports.h
> > @@ -285,6 +285,10 @@ static inline int F_TO_I(float f)
> > int r;
> > __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
> > return r;
> > +#elif defined(USE_X86_64_ASM) && defined(__GNUC__)
> > + int r;
> > + __asm__ ("cvtss2si %1, %0" : "=r" (r) : "xm" (f));
>
> "xm"? I think you just want "x"
>
No, this is needed because it uses an SSE register.
>
> Also "=&r" since it's written without ever being read.
>
Reading the GCC docs, I don't see how earlyclobber is appropreate. Would
you care to explain your reasoning further?
>
> > + return r;
> > #elif defined(USE_X86_ASM) && defined(_MSC_VER)
> > int r;
> > _asm {
> > --
>
> Remove the ' XXX We could use an x86-64/SSE2 version here.' comment
> above the function too.
>
Good catch
>
> I'd expect some data about this change. Performance data would be
> nice, but I'd take just the output of `size` on i965_dri.so.
>
Sure, I've got a little performance data if you'd like.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140722/4e2e06d2/attachment-0001.html>
More information about the mesa-dev
mailing list