nir: add fp class analysis for flog2

Foz-DB Navi48:
Totals from 230 (0.28% of 82636) affected shaders:
Instrs: 599005 -> 598615 (-0.07%); split: -0.09%, +0.02%
CodeSize: 3110528 -> 3103136 (-0.24%); split: -0.24%, +0.00%
Latency: 3661526 -> 3663241 (+0.05%); split: -0.01%, +0.05%
InvThroughput: 526561 -> 526487 (-0.01%); split: -0.01%, +0.00%
Copies: 33735 -> 33820 (+0.25%); split: -0.06%, +0.31%
VALU: 378034 -> 377904 (-0.03%); split: -0.03%, +0.00%
SALU: 65156 -> 65045 (-0.17%); split: -0.19%, +0.02%

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39987>
This commit is contained in:
Georg Lehmann 2026-02-11 19:58:41 +01:00 committed by Marge Bot
parent 81e272aa1d
commit 73bce23f65

View file

@ -735,6 +735,7 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32
case nir_op_mov:
case nir_op_fabs:
case nir_op_fexp2:
case nir_op_flog2:
case nir_op_frcp:
case nir_op_fsqrt:
case nir_op_frsq:
@ -931,6 +932,29 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32
break;
}
case nir_op_flog2: {
r = 0;
if (src_res[0] & (FP_CLASS_ANY_NEG | FP_CLASS_NAN))
r |= FP_CLASS_NAN;
if (src_res[0] & FP_CLASS_ANY_ZERO)
r |= FP_CLASS_NEG_INF;
if (src_res[0] & FP_CLASS_GT_ZERO_LT_POS_ONE)
r |= FP_CLASS_ANY_NEG | FP_CLASS_NON_INTEGRAL;
if (src_res[0] & FP_CLASS_POS_ONE)
r |= FP_CLASS_POS_ZERO;
if (src_res[0] & FP_CLASS_GT_POS_ONE)
r |= FP_CLASS_GT_ZERO_LT_POS_ONE | FP_CLASS_POS_ONE | FP_CLASS_GT_POS_ONE | FP_CLASS_NON_INTEGRAL;
if (src_res[0] & FP_CLASS_POS_INF)
r |= FP_CLASS_POS_INF;
break;
}
case nir_op_fmax: {
fp_class_mask left = fneg_fp_class(src_res[0]);
fp_class_mask right = fneg_fp_class(src_res[1]);