[Mesa-dev] [PATCH] r300/compiler: recursive look for RC_OPCODE_S**

Marek Olšák maraeo at gmail.com
Fri Aug 1 06:55:56 PDT 2014


From: David Heidelberger <david.heidelberger at ixit.cz>

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 <david.heidelberger at ixit.cz>
---

I'm sending this on behalf of David. I'll commit it soon if there is no review.

 .../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:
-- 
1.9.1



More information about the mesa-dev mailing list