i965: Implement 16-wide math on G45 and Ironlake.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 30 Mar 2013 07:15:54 +0000 (00:15 -0700)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 15 Jun 2013 12:47:50 +0000 (00:47 +1200)
[chrisf:]
Improves performance in CS:S video stress test by about 2%.
No piglit regressions on Ironlake.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_emit.cpp

index 762e2508d22e97be46cd4775e2362058f9e9da36..bcda339f857fc46bd2e969465503cd9da3663022 100644 (file)
@@ -525,6 +525,9 @@ private:
    void generate_math_gen4(fs_inst *inst,
                           struct brw_reg dst,
                           struct brw_reg src);
+   void generate_math_g45(fs_inst *inst,
+                         struct brw_reg dst,
+                         struct brw_reg src);
    void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
    void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src,
                      bool negate_value);
index 9b7e68acb8f5f4d66a5ce60930351381b2a09a4a..9e1cf4a2b62fd86f005d3d8bda4975ef06bda618 100644 (file)
@@ -331,6 +331,29 @@ fs_generator::generate_math_gen4(fs_inst *inst,
    }
 }
 
+void
+fs_generator::generate_math_g45(fs_inst *inst,
+                                struct brw_reg dst,
+                                struct brw_reg src)
+{
+   if (inst->opcode == SHADER_OPCODE_POW ||
+       inst->opcode == SHADER_OPCODE_INT_QUOTIENT ||
+       inst->opcode == SHADER_OPCODE_INT_REMAINDER) {
+      generate_math_gen4(inst, dst, src);
+      return;
+   }
+
+   int op = brw_math_function(inst->opcode);
+
+   assert(inst->mlen >= 1);
+
+   brw_math(p, dst,
+            op,
+            inst->base_mrf, src,
+            BRW_MATH_DATA_VECTOR,
+            BRW_MATH_PRECISION_FULL);
+}
+
 void
 fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
 {
@@ -1307,6 +1330,8 @@ fs_generator::generate_code(exec_list *instructions)
            generate_math1_gen7(inst, dst, src[0]);
         } else if (intel->gen == 6) {
            generate_math1_gen6(inst, dst, src[0]);
+        } else if (intel->gen == 5 || intel->is_g4x) {
+           generate_math_g45(inst, dst, src[0]);
         } else {
            generate_math_gen4(inst, dst, src[0]);
         }