r600g/sb: fix a bug in constants folding optimisation
 pass:

    ADD     R6.y.1,    R5.w.1, ~1|3f800000
    ADD     R6.y.2,    |R6.y.1|, -0.0001|b8d1b717

was wrongly being converted to

    ADD     R6.y.1,    R5.w.1, ~1|3f800000
    ADD     R6.y.2,    R5.w.1, -1.0001|bf800347

because abs() modifier was ignored.

Signed-off-by: Xavier Bouchoux <xavi...@gmail.com>
From 90481a39aaf10a46fd18254c8ecd3e42d1bc0499 Mon Sep 17 00:00:00 2001
From: xavier <xavi...@gmail.com>
Date: Wed, 28 Jan 2015 02:31:58 +0100
Subject: [PATCH 2/2] r600g/sb: fix a bug in constants folding optimisation
 pass:

    ADD     R6.y.1,    R5.w.1, ~1|3f800000
    ADD     R6.y.2,    |R6.y.1|, -0.0001|b8d1b717

was wrongly being converted to

    ADD     R6.y.1,    R5.w.1, ~1|3f800000
    ADD     R6.y.2,    R5.w.1, -1.0001|bf800347

because abs() modifier was ignored.

Signed-off-by: Xavier Bouchoux <xavi...@gmail.com>
---
 src/gallium/drivers/r600/sb/sb_expr.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/r600/sb/sb_expr.cpp b/src/gallium/drivers/r600/sb/sb_expr.cpp
index 52c0c17..9c2274e 100644
--- a/src/gallium/drivers/r600/sb/sb_expr.cpp
+++ b/src/gallium/drivers/r600/sb/sb_expr.cpp
@@ -645,6 +645,7 @@ bool expr_handler::fold_assoc(alu_node *n) {
 						(op == ALU_OP2_MUL_IEEE &&
 								d0->is_alu_op(ALU_OP2_MUL))) &&
 						!d0->bc.omod && !d0->bc.clamp &&
+						!a->bc.src[0].abs &&
 						(!a->bc.src[0].neg || allow_neg)) {
 					cur_neg ^= a->bc.src[0].neg;
 					a = d0;
@@ -678,6 +679,7 @@ bool expr_handler::fold_assoc(alu_node *n) {
 						(op == ALU_OP2_MUL_IEEE &&
 								d1->is_alu_op(ALU_OP2_MUL))) &&
 						!d1->bc.omod && !d1->bc.clamp &&
+						!a->bc.src[1].abs &&
 						(!a->bc.src[1].neg || allow_neg)) {
 					cur_neg ^= a->bc.src[1].neg;
 					a = d1;
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to