glsl: Don't vectorize horizontal expressions.
authorMatt Turner <mattst88@gmail.com>
Sun, 23 Feb 2014 00:35:15 +0000 (16:35 -0800)
committerMatt Turner <mattst88@gmail.com>
Fri, 28 Feb 2014 18:37:52 +0000 (10:37 -0800)
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75224

src/glsl/opt_vectorize.cpp

index dba303d31311cd3ced960cee094b8cfaf136faff..13faac05ef1c30116bd50980b816f8849e9e986b 100644 (file)
@@ -83,6 +83,7 @@ public:
    virtual ir_visitor_status visit_enter(ir_assignment *);
    virtual ir_visitor_status visit_enter(ir_swizzle *);
    virtual ir_visitor_status visit_enter(ir_dereference_array *);
+   virtual ir_visitor_status visit_enter(ir_expression *);
    virtual ir_visitor_status visit_enter(ir_if *);
    virtual ir_visitor_status visit_enter(ir_loop *);
 
@@ -303,6 +304,20 @@ ir_vectorize_visitor::visit_enter(ir_dereference_array *ir)
    return visit_continue_with_parent;
 }
 
+/**
+ * Upon entering an ir_expression, remove the current assignment from further
+ * consideration if the expression operates horizontally on vectors.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_expression *ir)
+{
+   if (ir->is_horizontal()) {
+      this->current_assignment = NULL;
+      return visit_continue_with_parent;
+   }
+   return visit_continue;
+}
+
 /* Since there is no statement to visit between the "then" and "else"
  * instructions try to vectorize before, in between, and after them to avoid
  * combining statements from different basic blocks.