r600/sb: Avoid causing an exception when getting the reciprocal of 0u.

I'm not sure what the hardware would return in this circumstance, so just
don't fold it.  Avoids regressions on transition to NIR.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14319>
This commit is contained in:
Emma Anholt 2022-02-11 13:06:47 -08:00 committed by Marge Bot
parent 25836895f3
commit 0879c15666

View file

@ -459,8 +459,13 @@ bool expr_handler::fold_alu_op1(alu_node& n) {
case ALU_OP1_RECIP_FF:
case ALU_OP1_RECIP_IEEE: dv = 1.0f / cv.f; break;
// case ALU_OP1_RECIP_INT:
case ALU_OP1_RECIP_UINT: dv.u = (1ull << 32) / cv.u; break;
// case ALU_OP1_RNDNE: dv = floor(cv.f + 0.5f); break;
case ALU_OP1_RECIP_UINT: {
if (!cv.u)
return false;
dv.u = (1ull << 32) / cv.u;
break;
}
// case ALU_OP1_RNDNE: dv = floor(cv.f + 0.5f); break;
case ALU_OP1_SIN: dv = sin(cv.f * 2.0f * M_PI); break;
case ALU_OP1_SQRT_IEEE: dv = sqrtf(cv.f); break;
case ALU_OP1_TRUNC: dv = truncf(cv.f); break;