freedreno/ir3: don't create split/fo if only writing .x
authorRob Clark <robdclark@gmail.com>
Fri, 10 Nov 2017 17:54:49 +0000 (12:54 -0500)
committerRob Clark <robdclark@gmail.com>
Sun, 12 Nov 2017 17:28:59 +0000 (12:28 -0500)
In case an instruction only writes one register, and it is .x, we can
skip the extra level of fanout indirection.

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

index 3fd2e50d82f838f9c02415b38a07847b620126b1..1e8839263865956b30c4536266f4ecc8b1cf068f 100644 (file)
@@ -747,6 +747,12 @@ split_dest(struct ir3_block *block, struct ir3_instruction **dst,
                struct ir3_instruction *src, unsigned base, unsigned n)
 {
        struct ir3_instruction *prev = NULL;
+
+       if ((n == 1) && (src->regs[0]->wrmask == 0x1)) {
+               dst[0] = src;
+               return;
+       }
+
        for (int i = 0, j = 0; i < n; i++) {
                struct ir3_instruction *split = ir3_instr_create(block, OPC_META_FO);
                ir3_reg_create(split, 0, IR3_REG_SSA);