Mesa (master): i965: Make opt_vector_float() only handle non-type-conversion MOVs.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Apr 20 22:08:34 UTC 2016


Module: Mesa
Branch: master
Commit: 1aa28f3509b033e0f86510a6d4c7993fca650b3b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1aa28f3509b033e0f86510a6d4c7993fca650b3b

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Apr 13 16:39:54 2016 -0700

i965: Make opt_vector_float() only handle non-type-conversion MOVs.

We don't handle this properly - we'd have to perform the type conversion
before trying to convert the value to a VF.

While we could do that, it doesn't seem particularly useful - most
vector loads should be consistently typed (all float or all integer).

As a special case, we do allow type-converting MOVs of integer 0, as
it's represented the same regardless of the type.  I believe this case
does actually come up.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_vec4.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 4557a65..32f4ef0 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -366,12 +366,15 @@ vec4_visitor::opt_vector_float()
       int vf = -1;
 
       /* Look for unconditional MOVs from an immediate with a partial
-       * writemask.  See if the immediate can be represented as a VF.
+       * writemask.  Skip type-conversion MOVs other than integer 0,
+       * where the type doesn't matter.  See if the immediate can be
+       * represented as a VF.
        */
       if (inst->opcode == BRW_OPCODE_MOV &&
           inst->src[0].file == IMM &&
           inst->predicate == BRW_PREDICATE_NONE &&
-          inst->dst.writemask != WRITEMASK_XYZW) {
+          inst->dst.writemask != WRITEMASK_XYZW &&
+          (inst->src[0].type == inst->dst.type || inst->src[0].d == 0)) {
          vf = brw_float_to_vf(inst->src[0].f);
       } else {
          last_reg = -1;




More information about the mesa-commit mailing list