[BUG REPORT OPTIMISER]

wrong address calculaction

  • 1
  • 2
  • Seite 2 von 2
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: [BUG REPORT OPTIMISER]

 · 
Gepostet: 25.01.2016 - 22:19 Uhr  ·  #9
@all

The problems are a little more subtle than it would at first appear. The particular implementation has some fairly obvious solutions, as you say with ADIW, but that would be a totally new optimisation. This is actually a manifestation of a deeper problem, which I need to think about first. My main concern is that fixing this problem may introduce new ones.

Once I have solved this problem to my satisfaction I will look at implementing the ADW/SBIW, probably as a separate release.
Harald_K
 
Avatar
 
Betreff:

Re: [BUG REPORT OPTIMISER]

 · 
Gepostet: 25.01.2016 - 22:35 Uhr  ·  #10
or you use
LDI _ACCA, xx
STS Z, _ACCA
LDI _ACCA, yy
STD Z+11, _ACCA
LDI _ACCA, ...
STD Z+22, ...

which will use only 2 cycles for adding and storing instead of 3 for adding separately and storing ... it also will use smaller amount of ROM,
but the displacement is only +/-63 and the Z-Register is not changed ... the flags are not changed too

all depends on the number and size of displacements to add ... so you must decide what to do ...
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 25
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: [BUG REPORT OPTIMISER]

 · 
Gepostet: 26.01.2016 - 15:01 Uhr  ·  #11
Hello Merlin,

an easy solution which the Opti should be able to handle is this:
original ASM
Code
  LDI       _ACCCLO, optimizerAddressBug.btnArray AND 0FFh
  LDI       _ACCCHI, optimizerAddressBug.btnArray SHRB 8
  ADIW      _ACCCLO, 0000Bh
  LDI       _ACCA, 002h
  ST        Z+, _ACCA 

Optimiser
Code
  LDI       _ACCCLO, optimizerAddressBug.btnArray+11 AND 0FFh
  LDI       _ACCCHI, optimizerAddressBug.btnArray+11 SHRB 8
  LDI       _ACCA, 002h
  ST        Z+, _ACCA

The offset, in this case 11/$0B, is directly added into the Z-pointer load

rolf
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: [BUG REPORT OPTIMISER]

 · 
Gepostet: 26.01.2016 - 22:20 Uhr  ·  #12
@All

I sincerely thank you all for your input, I truly do, but the problem is not the one that you imagine.

The problem is that the optimiser interprets addresses wrongly, and therefore incorrectly optimises. Sadly, the solutions that you propose only mask the problem, not solve it. Now the problem is correctly solved, the original optimisation is almost as efficient your proposed solutions, and so it is not worth adding a new optimisation, especially as it only solves a very limited problem that would not be used in practice (a for loop would be used instead typically).

Thomas, do you need me to e-mail you with the fix? If so, please let me know your e-mail by pm.

Thank you all again.

@Rolf: Your last suggestion is exactly what the optimiser does. The problem is that a later optimisation removes what it sees as superfluous lines, which are mostly correct, but not quite all.
Thomas.AC
Benutzer
Avatar
Geschlecht: keine Angabe
Alter: 44
Beiträge: 308
Dabei seit: 07 / 2013
Betreff:

Re: [BUG REPORT OPTIMISER]

 · 
Gepostet: 27.01.2016 - 11:59 Uhr  ·  #13
Hello again,

@all: Thanks for your Input, too.
@Merlin: Not neccessary, I am waiting for an official update.
  • 1
  • 2
  • Seite 2 von 2
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 14 · Cache Hits: 14   93   107 · Page-Gen-Time: 0.023012s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI