summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-07-16 15:57:11 -0400
committerZack Rusin <zackr@vmware.com>2013-07-19 16:29:17 -0400
commit13e2cd2f2ccb06cd6dc9acda0b6bbe268ee37879 (patch)
treec05af0756b62860ecda3a8b97ab9b7d33c072cba /src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
parent7b672c1503abffcc83a30a9731419539f52ac73f (diff)
downloadexternal_mesa3d-13e2cd2f2ccb06cd6dc9acda0b6bbe268ee37879.zip
external_mesa3d-13e2cd2f2ccb06cd6dc9acda0b6bbe268ee37879.tar.gz
external_mesa3d-13e2cd2f2ccb06cd6dc9acda0b6bbe268ee37879.tar.bz2
gallivm: add a version of log2 which handles edge cases
That means that if input is: * - less than zero (to and including -inf) then NaN will be returned * - equal to zero (-denorm, -0, +0 or +denorm), then -inf will be returned * - +infinity, then +infinity will be returned * - NaN, then NaN will be returned It's a separate function because the checks are a little bit costly and in most cases are likely unnecessary. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
index f23e08b..d16ccae 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -1236,8 +1236,8 @@ lg2_emit_cpu(
struct lp_build_tgsi_context * bld_base,
struct lp_build_emit_data * emit_data)
{
- emit_data->output[emit_data->chan] = lp_build_log2(&bld_base->base,
- emit_data->args[0]);
+ emit_data->output[emit_data->chan] = lp_build_log2_safe(&bld_base->base,
+ emit_data->args[0]);
}
/* TGSI_OPCODE_LOG (CPU Only) */
@@ -1253,7 +1253,7 @@ log_emit_cpu(
LLVMValueRef src0 = emit_data->args[0];
lp_build_log2_approx(&bld_base->base, src0,
- &p_exp, &p_floor_log2, &p_log2);
+ &p_exp, &p_floor_log2, &p_log2, FALSE);
emit_data->output[TGSI_CHAN_X] = p_floor_log2;