[Mesa-dev] [PATCH 6/7] gallium: Add TGSI_OPCODE_F2U to gallivm backend.
Roland Scheidegger
sroland at vmware.com
Thu Jun 14 10:44:26 PDT 2012
Am 14.06.2012 18:55, schrieb Paul Berry:
> On 14 June 2012 09:02, Roland Scheidegger <sroland at vmware.com
> <mailto:sroland at vmware.com>> wrote:
>
> Am 14.06.2012 15:07, schrieb Paul Berry:
> > On 14 June 2012 05:10, Jose Fonseca <jfonseca at vmware.com
> <mailto:jfonseca at vmware.com>
> > <mailto:jfonseca at vmware.com <mailto:jfonseca at vmware.com>>> wrote:
> >
> > lp_build_utrunc() doesn't exists yet. For now, please use
> > lp_build_itrunc() and add a /* FIXME: implement and use
> > lp_build_utrunc() */ comment. It's not perfect, but it's no worse
> > what's there now.
> >
> > Jose
> >
> >
> > Ok, will do. Thank you.
> btw I'm wondering how you'd actually do that in some semi-efficient
> manner?
> llvm has LLVMBuildFPToUI but x86 has no such conversion instructions
> they are all signed. I guess multiply by 0.5, convert to signed int,
> cast to unsigned and multiply by 2 isn't really the solution :-).
>
>
> Playing around with gcc, it looks like it generally achieves
> float->unsigned conversions by first converting to a 64-bit integer
> (using the "fistpq" instruction on x86, or "cvttss2siq" on x86-64), then
> truncating the upper 32 bits.
I guess that's a reasonable option (unless you'd need 64bit uints...).
For vectorized llvm code though that option looks pretty bad.
Roland
More information about the mesa-dev
mailing list