gallivm: fix F2U opcode
authorRoland Scheidegger <sroland@vmware.com>
Tue, 4 Feb 2014 18:53:53 +0000 (19:53 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 5 Feb 2014 16:45:31 +0000 (17:45 +0100)
commit4a7da3bec5961bd82c520e1f5e363cbd2fa8fb77
tree56072b856a0ecf3d5fdaf415c6fa46f98825e820
parent5c975966dcaaa4e781f3baba0fc1e3b7ad4a18a6
gallivm: fix F2U opcode

Previously, we were really doing F2I. And also move it to generic section.
(Note that for llvmpipe the code generated is definitely bad, due to lack
of unsigned conversions with sse. I think though what llvm does (using scalar
conversions to 64bit signed either with x87 fpu (32bit) or sse (64bit)
including lots of domain changes is quite suboptimal, could do something like
is_large = arg >= 2^31
half_arg = 0.5 * arg
small_c = fptoint(arg)
large_c = fptoint(half_arg) << 1
res = select(is_large, large_c, small_c)
which should be much less instructions but that's something llvm should do
itself.)

This fixes piglit fs/vs-float-uint-conversion.shader_test (maybe more, needs
GL 3.0 version override to run.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c