nv50: implement KIL enough for progs/fp/kil to work
authorBen Skeggs <skeggsb@gmail.com>
Mon, 12 Jan 2009 23:56:40 +0000 (09:56 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Tue, 13 Jan 2009 03:57:22 +0000 (13:57 +1000)
src/gallium/drivers/nv50/nv50_program.c

index bc85ede92e98ecc207c23e699051ebca3f3080eb..5537a47902ba7d5728707238f83dbb0919bd4ba6 100644 (file)
@@ -841,6 +841,28 @@ emit_neg(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
        emit(pc, e);
 }
 
+static void
+emit_kil(struct nv50_pc *pc, struct nv50_reg *src)
+{
+       struct nv50_program_exec *e;
+       const int r_pred = 1;
+
+       /* Sets predicate reg ? */
+       e = exec(pc);
+       e->inst[0] = 0xa00001fd;
+       e->inst[1] = 0xc4014788;
+       set_src_0(pc, src, e);
+       set_pred_wr(pc, 1, r_pred, e);
+       emit(pc, e);
+
+       /* This is probably KILP */
+       e = exec(pc);
+       e->inst[0] = 0x000001fe;
+       set_long(pc, e);
+       set_pred(pc, 1 /* LT? */, r_pred, e);
+       emit(pc, e);
+}
+
 static struct nv50_reg *
 tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst)
 {
@@ -1069,6 +1091,12 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)
                }
                free_temp(pc, temp);
                break;
+       case TGSI_OPCODE_KIL:
+               emit_kil(pc, src[0][0]);
+               emit_kil(pc, src[0][1]);
+               emit_kil(pc, src[0][2]);
+               emit_kil(pc, src[0][3]);
+               break;
        case TGSI_OPCODE_LIT:
                emit_lit(pc, &dst[0], mask, &src[0][0]);
                break;