freedreno: Fix printing of unused src in disasm of cat6 RESINFO.
authorEric Anholt <eric@anholt.net>
Wed, 20 May 2020 20:16:41 +0000 (13:16 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 26 May 2020 18:17:46 +0000 (18:17 +0000)
Compare to QC's disasm right next to ours, and we clearly had an extra src
that wouldn't make sense.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3501>

src/freedreno/ir3/disasm-a3xx.c
src/freedreno/ir3/tests/disasm.c

index 82ecb7c4e494947b9caf5767fdfa0c6c8b2a76be..3db422f0d6fcf4675438a0a0ff5ec9a7d35d1e34 100644 (file)
@@ -987,7 +987,8 @@ static void print_instr_cat6_a6xx(struct disasm_ctx *ctx, instr_t *instr)
 {
        instr_cat6_a6xx_t *cat6 = &instr->cat6_a6xx;
        struct reginfo src1, src2, ssbo;
-       bool uses_type = _OPC(6, cat6->opc) != OPC_LDC;
+       uint32_t opc = _OPC(6, cat6->opc);
+       bool uses_type = opc != OPC_LDC;
 
        static const struct {
                bool indirect;
@@ -1049,10 +1050,13 @@ static void print_instr_cat6_a6xx(struct disasm_ctx *ctx, instr_t *instr)
        print_src(ctx, &src2);
        fprintf(ctx->out, ", ");
 
-       src1.reg = (reg_t)(cat6->src1);
-       src1.full = true; // XXX
-       print_src(ctx, &src1);
-       fprintf(ctx->out, ", ");
+       if (opc != OPC_RESINFO) {
+               src1.reg = (reg_t)(cat6->src1);
+               src1.full = true; // XXX
+               print_src(ctx, &src1);
+               fprintf(ctx->out, ", ");
+       }
+
        ssbo.reg = (reg_t)(cat6->ssbo);
        ssbo.im = !indirect_ssbo;
        ssbo.full = true;
index 3ab1e392cc602bbfe368024e437cd69ce7d99a9f..ef43ac3673cf28cde0cd226b895ab0196e2000f1 100644 (file)
@@ -76,8 +76,8 @@ static const struct test {
        /* cat6 */
        INSTR_6XX(c0c00000_00000000, "stg.f16 g[hr0.x], hr0.x, hr0.x"),
        INSTR_6XX(c1100000_c1000000, "stl.f16 l[0], hr0.x, hr48.y"),
-       INSTR_6XX(c0260000_0063c200, "resinfo.untyped.2d.u32.1.imm r0.x, r0.x, 0"), /* resinfo.u32.2d.mode0.base0 r0.x, 0 */
-       INSTR_6XX(c0260000_0063c000, "resinfo.untyped.1d.u32.1.imm r0.x, r0.x, 0"), /* resinfo.u32.1d.mode0.base0 r0.x, 0 */
+       INSTR_6XX(c0260000_0063c200, "resinfo.untyped.2d.u32.1.imm r0.x, 0"), /* resinfo.u32.2d.mode0.base0 r0.x, 0 */
+       INSTR_6XX(c0260000_0063c000, "resinfo.untyped.1d.u32.1.imm r0.x, 0"), /* resinfo.u32.1d.mode0.base0 r0.x, 0 */
 
        /* discard stuff */
        INSTR_6XX(42b400f8_20010004, "cmps.s.eq p0.x, r1.x, 1"),