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 <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10532>
This commit is contained in:
Ian Romanick
2021-04-28 15:34:13 -07:00
committed by Marge Bot
parent aaeff52bbe
commit 61624934f6
+2 -2
View File
@@ -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;
}