From 0f18fa63b52d781c6c88634003ef13d76505ec26 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 5 Mar 2024 17:16:17 -0600 Subject: [PATCH] Optimize some additional cases of a branch to a branch. This covers patterns like bCC lab ??? ??? lab: bra/brl ... These can come up in the new code for 32-bit ||, but also in cases like "if (i > 0) ...". --- Native.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Native.pas b/Native.pas index 96427f3..483c408 100644 --- a/Native.pas +++ b/Native.pas @@ -1637,7 +1637,7 @@ var end; {if} m_bcs,m_beq,m_bne,m_bmi,m_bpl,m_bcc: - if npeep[ns+2].opcode = d_lab then + if npeep[ns+2].opcode = d_lab then begin if npeep[ns+2].operand = operand then if npeep[ns+1].opcode = m_brl then begin if Short(ns,npeep[ns+1].operand) then begin @@ -1676,6 +1676,12 @@ var else if npeep[ns+3].opcode in [m_bra,m_brl] then if Short(ns,npeep[ns+3].operand) then operand := npeep[ns+3].operand; + end {if} + else if npeep[ns+3].opcode = d_lab then + if npeep[ns+3].operand = operand then + if npeep[ns+4].opcode in [m_bra,m_brl] then + if Short(ns,npeep[ns+4].operand) then + operand := npeep[ns+4].operand; m_brl: if Short(ns,operand) then begin