freedreno/ir3: fix printing of relative branch offsets
authorRob Clark <robdclark@gmail.com>
Mon, 29 Jan 2018 20:24:17 +0000 (15:24 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 10 Feb 2018 19:54:58 +0000 (14:54 -0500)
The number of bits depends on generation.  But printing negative values
with a5xx encoding (largest size) but compiling for a3xx or a4xx, would
result in negative values printed as large positive values.

I guess in practice huge negative branch offsets aren't likely (and if
that is the case, the shader is probably too big to grok by reading the
assembly).  So just print using smallest bitfield size.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/ir3/disasm-a3xx.c
src/gallium/drivers/freedreno/ir3/instr-a3xx.h

index 4cb174cb2a447b40eeffaf9a2db2f93f6f1593d4..1c81c3871271a963253bb21e3a9964383548afac 100644 (file)
@@ -159,11 +159,11 @@ static void print_instr_cat0(instr_t *instr)
                break;
        case OPC_BR:
                printf(" %sp0.%c, #%d", cat0->inv ? "!" : "",
-                               component[cat0->comp], cat0->a5xx.immed);
+                               component[cat0->comp], cat0->a3xx.immed);
                break;
        case OPC_JUMP:
        case OPC_CALL:
-               printf(" #%d", cat0->a5xx.immed);
+               printf(" #%d", cat0->a3xx.immed);
                break;
        }
 
index 55198cc053e715e8ca7e181dc1c8d61121f7fb82..65fc212c1c2796bef154dad0440fc66a71e8b6e3 100644 (file)
@@ -301,7 +301,7 @@ typedef struct PACKED {
                        uint32_t dummy1   : 12;
                } a4xx;
                struct PACKED {
-                       uint32_t immed    : 32;
+                       int32_t immed     : 32;
                } a5xx;
        };