gallivm: consolidate code for float-to-half and float-to-packed conversion.
authorRoland Scheidegger <sroland@vmware.com>
Tue, 2 Apr 2013 15:41:44 +0000 (17:41 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 2 Apr 2013 16:24:31 +0000 (18:24 +0200)
commit3febc4a1cdcfc3151195300e3f4ab10e8d46bedf
tree5d33368f840f22e9f2f5f2e725f376ec0cc7c01e
parent9be624b3ef32ae6311010cf05531e12051b647dc
gallivm: consolidate code for float-to-half and float-to-packed conversion.

This replaces the existing float-to-half implementation.
There are definitely a couple of differences - the old implementation
had unspecified(?) rounding behavior, and could at least in theory
construct Inf values out of NaNs. NaNs and Infs should now always be
properly propagated, and rounding behavior is now towards zero
(note this means too large but non-Infinity values get propagated to max
representable value, not Infinity).
The implementation will definitely not match util code, however (which
does nearest rounding, which also means too large values will get
propagated to Infinity).

Also fix a bogus round mask probably leading to rounding bugs...
v2: fix a logic bug in handling infs/nans.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_conv.c
src/gallium/auxiliary/gallivm/lp_bld_format.h
src/gallium/auxiliary/gallivm/lp_bld_format_float.c