From 61624934f6916e1c2381a998097e0dd03fcdbe78 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 28 Apr 2021 15:34:13 -0700 Subject: [PATCH] gallivm: Use GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN for norm clamping Since the second source is always a constant that is known to be a number, this should have the same performance as GALLIVM_NAN_BEHAVIOR_UNDEFINED. A lofty goal is to eventually remove GALLIVM_NAN_BEHAVIOR_UNDEFINED. There's still a lot of (mostly implicit) users, and I don't feel like tackling that right now. :) Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index cdbe52c8603..a3152c242a4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -524,7 +524,7 @@ lp_build_add(struct lp_build_context *bld, /* clamp to ceiling of 1.0 */ if(bld->type.norm && (bld->type.floating || bld->type.fixed)) - res = lp_build_min_simple(bld, res, bld->one, GALLIVM_NAN_BEHAVIOR_UNDEFINED); + res = lp_build_min_simple(bld, res, bld->one, GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN); if (type.norm && !type.floating && !type.fixed) { if (!type.sign) { @@ -859,7 +859,7 @@ lp_build_sub(struct lp_build_context *bld, res = LLVMBuildSub(builder, a, b, ""); if(bld->type.norm && (bld->type.floating || bld->type.fixed)) - res = lp_build_max_simple(bld, res, bld->zero, GALLIVM_NAN_BEHAVIOR_UNDEFINED); + res = lp_build_max_simple(bld, res, bld->zero, GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN); return res; }