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

Author: Gert Wollny <gert.wol...@collabora.com>
Date:   Fri Aug 10 15:04:17 2018 +0200

Gallium/tgsi: Correct signdness of return value of bit operations

The GLSL operations findLSB, findMSB, and countBits always return
a signed integer type. Let TGSI reflect this.

v2: Properly set values in infer_(src|dst)_type   (Thanks Roland
    Schneidegger for pointing out problems with my 1st approach)
v2: Set values in the common infer_type code path, and only add
    the correct source type for UMSB (Roland Schneidegger)

Signed-off-by: Gert Wollny <gert.wol...@collabora.com>
Reviewed-by: Roland Scheidegger <srol...@vmware.com>

---

 src/gallium/auxiliary/tgsi/tgsi_info.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index bbe1a21e43..d249b956ed 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -150,9 +150,6 @@ tgsi_opcode_infer_type(enum tgsi_opcode opcode)
    case TGSI_OPCODE_UBFE:
    case TGSI_OPCODE_BFI:
    case TGSI_OPCODE_BREV:
-   case TGSI_OPCODE_POPC:
-   case TGSI_OPCODE_LSB:
-   case TGSI_OPCODE_UMSB:
    case TGSI_OPCODE_IMG2HND:
    case TGSI_OPCODE_SAMP2HND:
       return TGSI_TYPE_UNSIGNED;
@@ -188,6 +185,9 @@ tgsi_opcode_infer_type(enum tgsi_opcode opcode)
    case TGSI_OPCODE_U64SGE:
    case TGSI_OPCODE_I64SLT:
    case TGSI_OPCODE_I64SGE:
+   case TGSI_OPCODE_LSB:
+   case TGSI_OPCODE_POPC:
+   case TGSI_OPCODE_UMSB:
       return TGSI_TYPE_SIGNED;
    case TGSI_OPCODE_DADD:
    case TGSI_OPCODE_DABS:
@@ -269,6 +269,7 @@ tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint 
src_idx)
    case TGSI_OPCODE_UP2H:
    case TGSI_OPCODE_U2I64:
    case TGSI_OPCODE_MEMBAR:
+   case TGSI_OPCODE_UMSB:
       return TGSI_TYPE_UNSIGNED;
    case TGSI_OPCODE_IMUL_HI:
    case TGSI_OPCODE_I2F:

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to