i965: Don't consider gen6 math instructions to write to MRFs.
authorEric Anholt <eric@anholt.net>
Mon, 11 Oct 2010 20:19:47 +0000 (13:19 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 11 Oct 2010 22:26:58 +0000 (15:26 -0700)
This was leftover from the pre-gen6 cleanups.  One tests regresses
where compute-to-MRF now occurs.

src/mesa/drivers/dri/i965/brw_fs.cpp

index 645145d3afc8b3f90463374e34f78c2c3828d1d5..0f1f4fa26ef88d4902673e95b1a9fcaf92eba2d2 100644 (file)
@@ -532,8 +532,10 @@ fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src)
    }
    fs_inst *inst = emit(fs_inst(opcode, dst, src));
 
-   inst->base_mrf = 2;
-   inst->mlen = 1;
+   if (intel->gen < 6) {
+      inst->base_mrf = 2;
+      inst->mlen = 1;
+   }
 
    return inst;
 }
@@ -541,13 +543,20 @@ fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src)
 fs_inst *
 fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src0, fs_reg src1)
 {
-   assert(opcode == FS_OPCODE_POW);
+   int base_mrf = 2;
+   fs_inst *inst;
 
-   fs_inst *inst = emit(fs_inst(opcode, dst, src0, src1));
+   assert(opcode == FS_OPCODE_POW);
 
-   inst->base_mrf = 2;
-   inst->mlen = 2;
+   if (intel->gen >= 6) {
+      inst = emit(fs_inst(opcode, dst, src0, src1));
+   } else {
+      emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + 1), src1));
+      inst = emit(fs_inst(opcode, dst, src0, reg_null));
 
+      inst->base_mrf = base_mrf;
+      inst->mlen = 2;
+   }
    return inst;
 }
 
@@ -1757,19 +1766,31 @@ fs_visitor::generate_math(fs_inst *inst,
       break;
    }
 
-   assert(inst->mlen >= 1);
+   if (intel->gen >= 6) {
+      assert(inst->mlen == 0);
 
-   if (inst->opcode == FS_OPCODE_POW) {
-      brw_MOV(p, brw_message_reg(inst->base_mrf + 1), src[1]);
-   }
+      if (inst->opcode == FS_OPCODE_POW) {
+        brw_math2(p, dst, op, src[0], src[1]);
+      } else {
+        brw_math(p, dst,
+                 op,
+                 inst->saturate ? BRW_MATH_SATURATE_SATURATE :
+                 BRW_MATH_SATURATE_NONE,
+                 0, src[0],
+                 BRW_MATH_DATA_VECTOR,
+                 BRW_MATH_PRECISION_FULL);
+      }
+   } else {
+      assert(inst->mlen >= 1);
 
-   brw_math(p, dst,
-           op,
-           inst->saturate ? BRW_MATH_SATURATE_SATURATE :
-           BRW_MATH_SATURATE_NONE,
-           inst->base_mrf, src[0],
-           BRW_MATH_DATA_VECTOR,
-           BRW_MATH_PRECISION_FULL);
+      brw_math(p, dst,
+              op,
+              inst->saturate ? BRW_MATH_SATURATE_SATURATE :
+              BRW_MATH_SATURATE_NONE,
+              inst->base_mrf, src[0],
+              BRW_MATH_DATA_VECTOR,
+              BRW_MATH_PRECISION_FULL);
+   }
 }
 
 void