[raspi-internals] Re: 2op vs 3op ALU operations

  • From: Volker Barthelmann <vb@xxxxxxxxxxxx>
  • To: raspi-internals@xxxxxxxxxxxxx
  • Date: Wed, 22 May 2013 18:57:15 +0200

On 22.05.2013 17:59, David Given wrote:
How are you handling the limited displacement and literal values in the
addcmpb instruction? Is this something the compiler knows about (so that
it can generate different code if the displacement is too large) or is
it done by the assembler?

The compiler usually only has a rough idea of the offsets. Therefore I usually have the assembler rewrite it if necessary (quite a number of targets only have limited offsets for conditional branches). In cases where it is not possible to do it in the assembler, it may be necessary to calculate an upper bound in the compiler. But I am not sure if any current vbcc target does actually have to do this.

One of the things on my list to ask about was whether comparing b and
addcmpb modify the condition flags; if so, I can have the assembler
replace addcmpb instructions that don't fit with sequences of cmp and
non-comparing b. Without that, it's probably not something that the
ACK's simple-minded code generator is capable of handling.

I just did a quick test with addcmpb and it does not seem to set the flags. However, looking at your example, addcmpb is probably not your top priority anyway.

Volker



Other related posts: