From 0773359c5a2461ce120d3a85b7f38bb120e94c50 Mon Sep 17 00:00:00 2001 From: David Heidelberger Date: Wed, 4 Jun 2014 20:49:10 +0200 Subject: [PATCH] r300/compiler: recursive look for RC_OPCODE_S** Get rid of error "Failed to build loop info" by fixing failure in cases like 4: SGE temp[2].x, temp[0].xxxx, const[0].wwww; 5: CMP temp[1].x, -temp[2].xxxx, const[0].zzzz, temp[1].xxxx; 6: IF temp[1].xxxx; On RS690 - fixes piglit glean "do-loop with continue and break" - changes error from Failed to build loop info -> Not a native swizzle: 00000e89 r300_fragprog_emit.c::begin_tex(): Too many texture indirections for "discard statement in for loop" - hide Failed to build loop info for "precision log2", "while-loop with continue", "for-loop with continue" and return "1 1 1 1" insted of "0 0 0 1" Signed-off-by: David Heidelberger --- .../drivers/r300/compiler/radeon_emulate_loops.c | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_emulate_loops.c b/src/gallium/drivers/r300/compiler/radeon_emulate_loops.c index 91ed9d2..d1fae9a 100644 --- a/src/gallium/drivers/r300/compiler/radeon_emulate_loops.c +++ b/src/gallium/drivers/r300/compiler/radeon_emulate_loops.c @@ -376,18 +376,23 @@ static int build_loop_info(struct radeon_compiler * c, struct loop_info * loop, loop->Brk = ptr; loop->If = ptr->Prev; loop->EndIf = ptr->Next; - switch(loop->If->Prev->U.I.Opcode){ - case RC_OPCODE_SLT: - case RC_OPCODE_SGE: - case RC_OPCODE_SGT: - case RC_OPCODE_SLE: - case RC_OPCODE_SEQ: - case RC_OPCODE_SNE: - break; - default: - return 0; - } + loop->Cond = loop->If->Prev; + while (loop->Cond->U.I.Opcode != RC_OPCODE_BGNLOOP) { + switch(loop->Cond->U.I.Opcode){ + case RC_OPCODE_SLT: + case RC_OPCODE_SGE: + case RC_OPCODE_SGT: + case RC_OPCODE_SLE: + case RC_OPCODE_SEQ: + case RC_OPCODE_SNE: + goto found; + default: + loop->Cond = loop->Cond->Prev; + break; + } + } + found: break; case RC_OPCODE_ENDLOOP: -- 2.0.0