From c1d8e32eaedd102759c3b5132228aaf493026b8d Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 2 Oct 2021 16:07:00 +0200 Subject: [PATCH] + Aarch64: LdrMov2Ldr optimization --- compiler/aarch64/aoptcpu.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/aarch64/aoptcpu.pas b/compiler/aarch64/aoptcpu.pas index 5cb055d8e0..13a95c1876 100644 --- a/compiler/aarch64/aoptcpu.pas +++ b/compiler/aarch64/aoptcpu.pas @@ -297,11 +297,17 @@ Implementation function TCpuAsmOptimizer.OptPass1LDR(var p: tai): Boolean; + var + hp1: tai; begin Result := False; if inherited OptPass1LDR(p) or LookForPostindexedPattern(p) then - Exit(True); + Exit(True) + else if (taicpu(p).oppostfix in [PF_B,PF_SB,PF_H,PF_SH,PF_None]) and + GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and + RemoveSuperfluousMove(p, hp1, 'LdrMov2Ldr') then + Exit(true); end;