tgsi_exec: Fix inf/nan handling for divide by zero.

For RCP and for DDIV, we do division without any src1 != 0 checks, and we
should do the same here so that we get infs or nans as appropriate instead
of undefined.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>
This commit is contained in:
Emma Anholt 2022-06-01 12:49:59 -07:00 committed by Marge Bot
parent 0fbd1b1f4c
commit 594d3982f7

View file

@ -1288,18 +1288,10 @@ micro_div(
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1 )
{
if (src1->f[0] != 0) {
dst->f[0] = src0->f[0] / src1->f[0];
}
if (src1->f[1] != 0) {
dst->f[1] = src0->f[1] / src1->f[1];
}
if (src1->f[2] != 0) {
dst->f[2] = src0->f[2] / src1->f[2];
}
if (src1->f[3] != 0) {
dst->f[3] = src0->f[3] / src1->f[3];
}
}
static void