nv50: do conversion of last insn to 64 bit format first
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 27 Nov 2009 20:29:38 +0000 (21:29 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 27 Nov 2009 20:29:38 +0000 (21:29 +0100)
Simplifies things since the second to last one will then
be converted in the subsequent pass that ensures alignment
automatically.

src/gallium/drivers/nv50/nv50_program.c

index bf50982dd162c3278fcddf3105e537965f47a863..855079f2939cbb0c32797da1839ed914050ae059 100644 (file)
@@ -2914,7 +2914,7 @@ nv50_fp_move_results(struct nv50_pc *pc)
 static void
 nv50_program_fixup_insns(struct nv50_pc *pc)
 {
-       struct nv50_program_exec *e, *prev = NULL, **bra_list;
+       struct nv50_program_exec *e, **bra_list;
        unsigned i, n, pos;
 
        bra_list = CALLOC(pc->p->exec_size, sizeof(struct nv50_program_exec *));
@@ -2926,6 +2926,16 @@ nv50_program_fixup_insns(struct nv50_pc *pc)
                if (e->param.index >= 0 && !e->param.mask)
                        bra_list[n++] = e;
 
+       /* last instruction must be long so it can have the exit bit set */
+       if (!is_long(pc->p->exec_tail))
+               convert_to_long(pc, pc->p->exec_tail);
+       /* set exit bit */
+       pc->p->exec_tail->inst[1] |= 1;
+
+       /* !immd on exit insn simultaneously means !join */
+       assert(!is_immd(pc->p->exec_head));
+       assert(!is_immd(pc->p->exec_tail));
+
        /* Make sure we don't have any single 32 bit instructions. */
        for (e = pc->p->exec_head, pos = 0; e; e = e->next) {
                pos += is_long(e) ? 2 : 1;
@@ -2937,23 +2947,8 @@ nv50_program_fixup_insns(struct nv50_pc *pc)
                        convert_to_long(pc, e);
                        ++pos;
                }
-               if (e->next)
-                       prev = e;
        }
 
-       assert(!is_immd(pc->p->exec_head));
-       assert(!is_immd(pc->p->exec_tail));
-
-       /* last instruction must be long so it can have the end bit set */
-       if (!is_long(pc->p->exec_tail)) {
-               convert_to_long(pc, pc->p->exec_tail);
-               if (prev)
-                       convert_to_long(pc, prev);
-       }
-       assert(!(pc->p->exec_tail->inst[1] & 2));
-       /* set the end-bit */
-       pc->p->exec_tail->inst[1] |= 1;
-
        FREE(bra_list);
 }