From 7fe4b132480e183d87483c8c58367e7c61e20507 Mon Sep 17 00:00:00 2001 From: Jeppe Johansen Date: Mon, 30 Mar 2015 11:17:38 +0000 Subject: [PATCH] Fix broken peephole optimization that was testing the wrong register for modifications. Fix tests on unsigned values. The flags were swapped. git-svn-id: trunk@30392 - --- compiler/avr/aoptcpu.pas | 2 +- compiler/avr/navradd.pas | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/avr/aoptcpu.pas b/compiler/avr/aoptcpu.pas index 7da1465a43..3b4d21586b 100644 --- a/compiler/avr/aoptcpu.pas +++ b/compiler/avr/aoptcpu.pas @@ -238,7 +238,7 @@ Implementation (taicpu(p).oper[0]^.typ = top_reg) and (taicpu(p).oper[1]^.typ = top_reg) and GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and - (not RegModifiedBetween(taicpu(p).oper[0]^.reg, p, hp1)) and + (not RegModifiedBetween(taicpu(p).oper[1]^.reg, p, hp1)) and (hp1.typ = ait_instruction) and (taicpu(hp1).opcode in [A_PUSH,A_MOV,A_CP,A_CPC,A_ADD,A_SUB,A_EOR,A_AND,A_OR]) and RegInInstruction(taicpu(p).oper[0]^.reg, hp1) and diff --git a/compiler/avr/navradd.pas b/compiler/avr/navradd.pas index 8a54171cab..8388328498 100644 --- a/compiler/avr/navradd.pas +++ b/compiler/avr/navradd.pas @@ -101,9 +101,9 @@ interface ltn: GetResFlags:=F_NotPossible; lten: - GetResFlags:=F_CS; + GetResFlags:=F_SH; gtn: - GetResFlags:=F_CC; + GetResFlags:=F_LO; gten: GetResFlags:=F_NotPossible; else @@ -112,13 +112,13 @@ interface else case NodeType of ltn: - GetResFlags:=F_CC; + GetResFlags:=F_LO; lten: GetResFlags:=F_NotPossible; gtn: GetResFlags:=F_NotPossible; gten: - GetResFlags:=F_CS; + GetResFlags:=F_SH; else internalerror(2014082023); end;