nv50: don't produce MOV immediate to output reg in store opt
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 24 Jul 2010 19:17:21 +0000 (21:17 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 24 Jul 2010 19:20:40 +0000 (21:20 +0200)
src/gallium/drivers/nv50/nv50_pc_emit.c
src/gallium/drivers/nv50/nv50_pc_optimize.c

index b917d23232000deca38a257fb6f35b7321c011a2..51304670a1e7dc0bf972a9528f55628e673c29cb 100644 (file)
@@ -539,26 +539,26 @@ emit_mov(struct nv_pc *pc, struct nv_instruction *i)
       pc->emit[1] |= DREG(i->def[0])->id << 4;
    } else
    if (SFILE(i, 0) == NV_FILE_IMM) {
-      if (i->opcode == NV_OP_LDA)
+      if (i->opcode == NV_OP_LDA) {
          emit_ld(pc, i);
-      else {
+      else {
          pc->emit[0] = 0x10008001;
          pc->emit[1] = 0x00000003;
 
-        emit_form_IMM(pc, i, 0);
+         emit_form_IMM(pc, i, 0);
       }
    } else {
       pc->emit[0] = 0x10000000;
       pc->emit[0] |= DREG(i->def[0])->id << 2;
       pc->emit[0] |= SREG(i->src[0])->id << 9;
 
-      if (!i->is_long)
+      if (!i->is_long) {
          pc->emit[0] |= 0x8000;
-      else {
+      else {
          pc->emit[0] |= 0x00000001;
          pc->emit[1] = 0x0403c000;
 
-        set_pred(pc, i);
+         set_pred(pc, i);
       }
    }
 
index 0811420e4258f11ef6c3c24b1e15fc872e619365..f81384f00dbd9600650f89cf7fc3d4ce485eae92 100644 (file)
@@ -266,11 +266,10 @@ nv_pass_fold_stores(struct nv_pass *ctx, struct nv_basic_block *b)
    int j;
 
    for (sti = b->entry; sti; sti = sti->next) {
-      if (!sti->def[0])
+      if (!sti->def[0] || sti->def[0]->reg.file != NV_FILE_OUT)
          continue;
 
-      if (sti->def[0]->reg.file != NV_FILE_OUT)
-         continue;
+      /* only handling MOV to $oX here */
       if (sti->opcode != NV_OP_MOV && sti->opcode != NV_OP_STA)
          continue;
 
@@ -282,8 +281,13 @@ nv_pass_fold_stores(struct nv_pass *ctx, struct nv_basic_block *b)
       if (nvi->def[0]->refc > 1)
          continue;
 
+      /* cannot MOV immediate to $oX */
+      if (nvi->src[0]->value->reg.file == NV_FILE_IMM)
+         continue;
+
       nvi->def[0] = sti->def[0];
-      nvi->fixed = 1;
+      sti->def[0] = NULL;
+      nvi->fixed = sti->fixed;
       sti->fixed = 0;
    }
    DESCEND_ARBITRARY(j, nv_pass_fold_stores);