[Mesa-dev] [PATCH 1/2] glsl: Disallow vectorization of vector_insert/extract.

Kenneth Graunke kenneth at whitecape.org
Tue Jan 5 05:34:24 PST 2016


vector_insert takes a vector, a scalar location, and a scalar value,
and produces a new vector with that component updated.  As such, it
can't be vectorized properly.

vector_extract takes a vector and a scalar location, and returns
that scalar component of the vector.  Vectorization doesn't really
make any sense.

Treating both as horizontal operations makes sure the vectorizer
won't try to touch these.

Found by inspection.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Matt Turner <mattst88 at gmail.com>
---
 src/glsl/ir.h | 2 ++
 1 file changed, 2 insertions(+)

I think this is necessary?  I haven't actually encountered any bugs
because of this - I was just in the area.  Should we Cc stable?

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index c56c959..a728c03 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1724,6 +1724,8 @@ public:
       return operation == ir_binop_all_equal ||
              operation == ir_binop_any_nequal ||
              operation == ir_binop_dot ||
+             operation == ir_binop_vector_extract ||
+             operation == ir_triop_vector_insert ||
              operation == ir_quadop_vector;
    }
 
-- 
2.6.4



More information about the mesa-dev mailing list