diff options
author | Connor Abbott <cwabbott0@gmail.com> | 2021-02-22 15:00:55 +0100 |
---|---|---|
committer | Emma Anholt <emma@anholt.net> | 2021-06-10 12:20:38 -0700 |
commit | 890de1a43603c98b5788f9867ff0793f117b5f4b (patch) | |
tree | 80275bf923b1a57dc84f320f0313adce3850fbb2 /src/freedreno | |
parent | 9ad83f51eb3c089aad0640c2ee6ad6d9477fc2b6 (diff) |
ir3/delay: Fix full->half and half->full delay
The current compiler never does this, but the new compiler will start to
in mergeregs mode. There is an extra penalty for this.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/ir3/ir3_delay.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/freedreno/ir3/ir3_delay.c b/src/freedreno/ir3/ir3_delay.c index 73adfaedef6..8a76601e536 100644 --- a/src/freedreno/ir3/ir3_delay.c +++ b/src/freedreno/ir3/ir3_delay.c @@ -88,12 +88,25 @@ ir3_delayslots(struct ir3_instruction *assigner, if (is_flow(consumer) || is_sfu(consumer) || is_tex(consumer) || is_mem(consumer)) { return 6; - } else if ((is_mad(consumer->opc) || is_madsh(consumer->opc)) && - (n == 3)) { - /* special case, 3rd src to cat3 not required on first cycle */ - return 1; } else { - return 3; + /* assigner and consumer are both alu */ + assert(n > 0); + + /* In mergedregs mode, there is an extra 2-cycle penalty when half of + * a full-reg is read as a half-reg or when a half-reg is read as a + * full-reg. + */ + bool mismatched_half = + (assigner->regs[0]->flags & IR3_REG_HALF) != + (consumer->regs[n - 1]->flags & IR3_REG_HALF); + unsigned penalty = mismatched_half ? 2 : 0; + if ((is_mad(consumer->opc) || is_madsh(consumer->opc)) && + (n == 3)) { + /* special case, 3rd src to cat3 not required on first cycle */ + return 1 + penalty; + } else { + return 3 + penalty; + } } } |