From 3429c83f87ef310e9cef953fbc4066b5ec04eede Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 1 Mar 2021 12:19:48 -0800 Subject: [PATCH] tgsi_exec: Roll the loops for condmask handling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to hand-unroll this, the compiler will do it. Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 30 ++++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index e2ed18d6049..6c4c0f2d17d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -5489,18 +5489,9 @@ exec_instruction( assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING); mach->CondStack[mach->CondStackTop++] = mach->CondMask; FETCH( &r[0], 0, TGSI_CHAN_X ); - /* update CondMask */ - if( ! r[0].f[0] ) { - mach->CondMask &= ~0x1; - } - if( ! r[0].f[1] ) { - mach->CondMask &= ~0x2; - } - if( ! r[0].f[2] ) { - mach->CondMask &= ~0x4; - } - if( ! r[0].f[3] ) { - mach->CondMask &= ~0x8; + for (int i = 0; i < TGSI_QUAD_SIZE; i++) { + if (!r[0].f[i]) + mach->CondMask &= ~(1 << i); } UPDATE_EXEC_MASK(mach); /* Todo: If CondMask==0, jump to ELSE */ @@ -5511,18 +5502,9 @@ exec_instruction( assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING); mach->CondStack[mach->CondStackTop++] = mach->CondMask; IFETCH( &r[0], 0, TGSI_CHAN_X ); - /* update CondMask */ - if( ! r[0].u[0] ) { - mach->CondMask &= ~0x1; - } - if( ! r[0].u[1] ) { - mach->CondMask &= ~0x2; - } - if( ! r[0].u[2] ) { - mach->CondMask &= ~0x4; - } - if( ! r[0].u[3] ) { - mach->CondMask &= ~0x8; + for (int i = 0; i < TGSI_QUAD_SIZE; i++) { + if (!r[0].u[i]) + mach->CondMask &= ~(1 << i); } UPDATE_EXEC_MASK(mach); /* Todo: If CondMask==0, jump to ELSE */