summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-08-31 19:03:35 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-01 18:02:50 +0200
commit917c79b384af9da95d2fe3ad86d488478d0d7718 (patch)
treea5085e4d8013c2da0682be033bd7842b190ec5bf /src/gallium
parente02c63bc10fd935537441917a10fef63fb3f9bfa (diff)
nv50: SSG
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_emit.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_optimize.c13
-rw-r--r--src/gallium/drivers/nv50/nv50_tgsi_to_nc.c11
3 files changed, 18 insertions, 10 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c b/src/gallium/drivers/nv50/nv50_pc_emit.c
index 7808335e50..e1d7bc6459 100644
--- a/src/gallium/drivers/nv50/nv50_pc_emit.c
+++ b/src/gallium/drivers/nv50/nv50_pc_emit.c
@@ -729,7 +729,7 @@ emit_bitop2(struct nv_pc *pc, struct nv_instruction *i)
{
pc->emit[0] = 0xd0000000;
- if (SFILE(i, 0) == NV_FILE_IMM) {
+ if (SFILE(i, 1) == NV_FILE_IMM) {
emit_form_IMM(pc, i, 0);
if (i->opcode == NV_OP_OR)
@@ -761,7 +761,7 @@ emit_arl(struct nv_pc *pc, struct nv_instruction *i)
pc->emit[0] = 0x00000001;
pc->emit[1] = 0xc0000000;
- set_dst(pc, i->def[0]);
+ pc->emit[0] |= (i->def[0]->reg.id + 1) << 2;
set_pred(pc, i);
set_src_0(pc, i->src[0]);
pc->emit[0] |= (get_immd_u32(i->src[1]) & 0x3f) << 16;
diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index 1d2710a8ac..4a3a51512e 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -264,11 +264,8 @@ check_swap_src_0_1(struct nv_instruction *nvi)
return;
assert(src0 && src1);
- if (src1->value->reg.file == NV_FILE_IMM) {
- /* should only be present from folding a constant MUL part of a MAD */
- assert(nvi->opcode == NV_OP_ADD);
+ if (src1->value->reg.file == NV_FILE_IMM)
return;
- }
if (is_cmem_load(src0->value->insn)) {
if (!is_cmem_load(src1->value->insn)) {
@@ -305,7 +302,7 @@ nv_pass_fold_stores(struct nv_pass *ctx, struct nv_basic_block *b)
continue;
nvi = sti->src[0]->value->insn;
- if (!nvi || nvi->opcode == NV_OP_PHI)
+ if (!nvi || nvi->opcode == NV_OP_PHI || nv_is_vector_op(nvi->opcode))
continue;
assert(nvi->def[0] == sti->src[0]->value);
@@ -536,9 +533,9 @@ constant_expression(struct nv_pc *pc, struct nv_instruction *nvi,
break;
case NV_OP_SUB:
switch (type) {
- case NV_TYPE_F32: u.f32 = u0.f32 - u1.f32;
- case NV_TYPE_U32: u.u32 = u0.u32 - u1.u32;
- case NV_TYPE_S32: u.s32 = u0.s32 - u1.s32;
+ case NV_TYPE_F32: u.f32 = u0.f32 - u1.f32; break;
+ case NV_TYPE_U32: u.u32 = u0.u32 - u1.u32; break;
+ case NV_TYPE_S32: u.s32 = u0.s32 - u1.s32; break;
default:
assert(0);
break;
diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 5ac61f108e..0a4c88c817 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -1595,6 +1595,17 @@ bld_instruction(struct bld_context *bld,
if (insn->Dst[0].Register.WriteMask & 0x8)
dst0[3] = bld_imm_f32(bld, 1.0f);
break;
+ case TGSI_OPCODE_SSG:
+ FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+ src0 = emit_fetch(bld, insn, 0, c);
+ src1 = bld_predicate(bld, src0, FALSE);
+ temp = bld_insn_2(bld, NV_OP_AND, src0, bld_imm_u32(bld, 0x80000000));
+ temp = bld_insn_2(bld, NV_OP_OR, temp, bld_imm_f32(bld, 1.0f));
+ dst0[c] = bld_insn_2(bld, NV_OP_XOR, temp, temp);
+ dst0[c]->insn->cc = NV_CC_EQ;
+ nv_reference(bld->pc, &dst0[c]->insn->flags_src, src1);
+ }
+ break;
case TGSI_OPCODE_SUB:
FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
src0 = emit_fetch(bld, insn, 0, c);