nv50/ir: Add convenience method for calculating the live sets of a function.
[mesa.git] / src / gallium / drivers / nv50 / nv50_pc_emit.c
index f37dc51e6aae0d30af9a6e562c3c9d5d400c7e7b..2b177c6cb2f4d66b5a25f64479d99060fb358876 100644 (file)
@@ -94,7 +94,7 @@ const ubyte nv50_inst_min_size_tab[NV_OP_COUNT] =
    0, 0, 0, 8, 8, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, /* 15 */
    8, 8, 8, 4, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 31 */
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 47 */
-   4, 8, 8, 8, 8, 8, 0, 0, 8
+   4, 8, 8, 8, 8, 8, 0, 0, 8, 8
 };
 
 unsigned
@@ -744,8 +744,8 @@ emit_add_a16(struct nv_pc *pc, struct nv_instruction *i)
 
    set_pred(pc, i);
 
-   if (i->src[1])
-      set_a16_bits(pc, SREG(i->src[1])->id + 1);
+   if (s && i->src[0])
+      set_a16_bits(pc, SREG(i->src[0])->id);
 }
 
 static void
@@ -762,7 +762,8 @@ emit_flow(struct nv_pc *pc, struct nv_instruction *i, ubyte flow_op)
       new_fixup(pc, NV50_FIXUP_CODE_RELOC, 0, pos, 0xffff << 11, 9);
       new_fixup(pc, NV50_FIXUP_CODE_RELOC, 1, pos, 0x3f << 14, -4);
 
-      pc->emit[0] |= (pos / 4) << 11;
+      pc->emit[0] |= ((pos >>  2) & 0xffff) << 11;
+      pc->emit[1] |= ((pos >> 18) & 0x003f) << 14;
    }
 }
 
@@ -1008,13 +1009,14 @@ emit_cvt(struct nv_pc *pc, struct nv_instruction *nvi)
    }
    if (pc->emit[1] == CVT_F32_F32 &&
        (nvi->opcode == NV_OP_CEIL || nvi->opcode == NV_OP_FLOOR ||
-       nvi->opcode == NV_OP_TRUNC))
+        nvi->opcode == NV_OP_TRUNC || nvi->opcode == NV_OP_ROUND))
        pc->emit[1] |= CVT_RI;
 
    switch (nvi->opcode) {
    case NV_OP_CEIL:  pc->emit[1] |= CVT_CEIL; break;
    case NV_OP_FLOOR: pc->emit[1] |= CVT_FLOOR; break;
    case NV_OP_TRUNC: pc->emit[1] |= CVT_TRUNC; break;
+   case NV_OP_ROUND: pc->emit[1] |= CVT_RN; break;
 
    case NV_OP_ABS: pc->emit[1] |= CVT_ABS; break;
    case NV_OP_SAT: pc->emit[1] |= CVT_SAT; break;
@@ -1162,6 +1164,7 @@ nv50_emit_instruction(struct nv_pc *pc, struct nv_instruction *i)
    case NV_OP_CEIL:
    case NV_OP_FLOOR:
    case NV_OP_TRUNC:
+   case NV_OP_ROUND:
       emit_cvt(pc, i);
       break;
    case NV_OP_DFDX: