float *immd_buf;
int immd_nr;
- struct nv50_reg *temp_temp[4];
+ struct nv50_reg *temp_temp[8];
unsigned temp_temp_nr;
};
static struct nv50_reg *
temp_temp(struct nv50_pc *pc)
{
- if (pc->temp_temp_nr >= 4)
+ if (pc->temp_temp_nr >= 8)
assert(0);
pc->temp_temp[pc->temp_temp_nr] = alloc_temp(pc, NULL);
p->insns = realloc(p->insns, sizeof(unsigned) * p->insns_nr);
memcpy(p->insns + (p->insns_nr - 1), inst, sizeof(unsigned));
}
-
- kill_temp_temp(pc);
}
static INLINE void set_long(struct nv50_pc *, unsigned *);
}
static void
-emit_add(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0,
- struct nv50_reg *src1)
+emit_add(struct nv50_pc *pc, struct nv50_reg *dst,
+ struct nv50_reg *src0, struct nv50_reg *src1)
{
unsigned inst[2] = { 0, 0 };
check_swap_src_0_1(pc, &src0, &src1);
set_dst(pc, dst, inst);
set_src_0(pc, src0, inst);
- set_src_2(pc, src1, inst);
+ if (is_long(inst))
+ set_src_2(pc, src1, inst);
+ else
+ set_src_1(pc, src1, inst);
+
+ emit(pc, inst);
+}
+
+static void
+emit_minmax(struct nv50_pc *pc, unsigned sub, struct nv50_reg *dst,
+ struct nv50_reg *src0, struct nv50_reg *src1)
+{
+ unsigned inst[2] = { 0, 0 };
+
+ set_long(pc, inst);
+ inst[0] |= 0xb0000000;
+ inst[1] |= (sub << 29);
+
+ check_swap_src_0_1(pc, &src0, &src1);
+ set_dst(pc, dst, inst);
+ set_src_0(pc, src0, inst);
+ set_src_1(pc, src1, inst);
emit(pc, inst);
}
{
unsigned inst[2] = { 0, 0 };
- set_long(pc, inst);
inst[0] |= 0x90000000;
- inst[1] |= (sub << 29);
+ if (sub) {
+ set_long(pc, inst);
+ inst[1] |= (sub << 29);
+ }
set_dst(pc, dst, inst);
set_src_0(pc, src, inst);
for (c = 0; c < 4; c++)
emit_mad(pc, dst[c], src[0][c], src[1][c], src[2][c]);
break;
+ case TGSI_OPCODE_MAX:
+ for (c = 0; c < 4; c++)
+ emit_minmax(pc, 4, dst[c], src[0][c], src[1][c]);
+ break;
+ case TGSI_OPCODE_MIN:
+ for (c = 0; c < 4; c++)
+ emit_minmax(pc, 5, dst[c], src[0][c], src[1][c]);
+ break;
case TGSI_OPCODE_MOV:
for (c = 0; c < 4; c++)
emit_mov(pc, dst[c], src[0][c]);
return FALSE;
}
+ kill_temp_temp(pc);
return TRUE;
}