Mesa (10.3): i965: Disable try_emit_b2f_of_compare on Gen4-6.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Aug 22 18:42:09 UTC 2014


Module: Mesa
Branch: 10.3
Commit: f2a1b7d508d0daa71bd97843d67e43108405cff7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2a1b7d508d0daa71bd97843d67e43108405cff7

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Aug 16 15:18:21 2014 -0700

i965: Disable try_emit_b2f_of_compare on Gen4-6.

The optimization relies on CMP setting the destination to 0, which is
equivalent to 0.0f.  However, early platforms only set the least
significant byte, leaving the other bits undefined.  So, we must disable
the optimization on those platforms.

Oddly, Sandybridge wasn't reported as broken.  The PRM states that it
only sets the LSB, but the internal documentation says that it follows
the IVB behavior.  Since it wasn't reported as broken, we believe it
really does follow the IVB behavior.

v2: Allow the optimization on Sandybridge (requested by Matt).

+32 piglits on Ironlake.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?=79963
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
(cherry picked from commit 97d03b9366bfa55b27feb92aa5afacd9c5f6f421)

---

 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index eca5d0c..6e48be7 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1135,6 +1135,13 @@ vec4_visitor::try_emit_mad(ir_expression *ir)
 bool
 vec4_visitor::try_emit_b2f_of_compare(ir_expression *ir)
 {
+   /* This optimization relies on CMP setting the destination to 0 when
+    * false.  Early hardware only sets the least significant bit, and
+    * leaves the other bits undefined.  So we can't use it.
+    */
+   if (brw->gen < 6)
+      return false;
+
    ir_expression *const cmp = ir->operands[0]->as_expression();
 
    if (cmp == NULL)




More information about the mesa-commit mailing list