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

Author: Christian Gmeiner <[email protected]>
Date:   Sat Sep  3 23:40:53 2022 +0200

isaspec: Add bool_inv type to print inverted bools

Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20144>

---

 src/compiler/isaspec/isa.py                |  2 +-
 src/compiler/isaspec/isaspec_decode_decl.h |  1 +
 src/compiler/isaspec/isaspec_decode_impl.c | 10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/compiler/isaspec/isa.py b/src/compiler/isaspec/isa.py
index dda0b7c84b0..e208e776ecb 100644
--- a/src/compiler/isaspec/isa.py
+++ b/src/compiler/isaspec/isa.py
@@ -561,7 +561,7 @@ class ISA(object):
 
         # Validate that all bitset fields have valid types, and in
         # the case of bitset type, the sizes match:
-        builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 
'offset', 'uoffset', 'float', 'bool', 'enum', 'custom']
+        builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 
'offset', 'uoffset', 'float', 'bool', 'bool_inv', 'enum', 'custom']
         for bitset_name, bitset in self.bitsets.items():
             if bitset.extends is not None:
                 assert bitset.extends in self.bitsets, "{} extends invalid 
type: {}".format(
diff --git a/src/compiler/isaspec/isaspec_decode_decl.h 
b/src/compiler/isaspec/isaspec_decode_decl.h
index 1c6794c4d37..968163e7212 100644
--- a/src/compiler/isaspec/isaspec_decode_decl.h
+++ b/src/compiler/isaspec/isaspec_decode_decl.h
@@ -102,6 +102,7 @@ struct isa_field {
                TYPE_UOFFSET,  /* Like UINT but formated with + or omitted if 
==0 */
                TYPE_FLOAT,
                TYPE_BOOL,
+               TYPE_BOOL_INV, /* Like BOOL but inverted */
                TYPE_ENUM,
 
                /* For fields that must be printed via a user-provided callback 
*/
diff --git a/src/compiler/isaspec/isaspec_decode_impl.c 
b/src/compiler/isaspec/isaspec_decode_impl.c
index 61bbd971eb7..5a7afc94c90 100644
--- a/src/compiler/isaspec/isaspec_decode_impl.c
+++ b/src/compiler/isaspec/isaspec_decode_impl.c
@@ -686,6 +686,16 @@ display_field(struct decode_scope *scope, const char 
*field_name)
                        isa_print(print, "%u", (unsigned)val);
                }
                break;
+       case TYPE_BOOL_INV: {
+               if (field->display) {
+                       if (!val) {
+                               isa_print(print, "%s", field->display);
+                       }
+               } else {
+                       isa_print(print, "%u", (unsigned)!val);
+               }
+               break;
+       }
        case TYPE_ENUM:
                display_enum_field(scope, field, v);
                break;

Reply via email to