Mesa (8.0): i965: Fix brw_swap_cmod() for LE/GE comparisons.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Jun 18 22:51:44 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Jun 16 02:08:13 2012 -0700

i965: Fix brw_swap_cmod() for LE/GE comparisons.

The idea here is to rewrite comparisons like 2 >= x with x <= 2; we want
to simply exchange arguments, not negate the condition.  If equality was
part of the original comparison, it should remain part of the swapped
version.

This is the true cause of bug #50298.  It didn't manifest itself on
Sandybridge because we embed the conditional modifier in the IF
instruction rather than emitting a CMP.  All other platforms use CMP.

It also didn't manifest itself on the master branch because commit
be5f27a84d ("glsl: Refine the loop instruction counting.") papered over
the problem.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50298
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit 5b83bdc154ec8d607a4c4d96171d0128e51abaec)

---

 src/mesa/drivers/dri/i965/brw_eu.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 2b0593a..75a4205 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -47,13 +47,13 @@ brw_swap_cmod(uint32_t cmod)
    case BRW_CONDITIONAL_NZ:
       return cmod;
    case BRW_CONDITIONAL_G:
-      return BRW_CONDITIONAL_LE;
-   case BRW_CONDITIONAL_GE:
       return BRW_CONDITIONAL_L;
+   case BRW_CONDITIONAL_GE:
+      return BRW_CONDITIONAL_LE;
    case BRW_CONDITIONAL_L:
-      return BRW_CONDITIONAL_GE;
-   case BRW_CONDITIONAL_LE:
       return BRW_CONDITIONAL_G;
+   case BRW_CONDITIONAL_LE:
+      return BRW_CONDITIONAL_GE;
    default:
       return ~0;
    }




More information about the mesa-commit mailing list