I have been looking at code generated and I see a lot of inefficient code
generated. When testing parts of bit fields I get the following code:
if (!elemofbitfield) {
bit.b const,rX
clr.b r15
adc.b r15
and.b #-1,r15
cmp #lo(0),r15
jne .Lxxx
This could be accomplished by:
bit.b const,rX
jc .Lxxx
It seems silly to waist all this.
I also see a lot of instances of this:
mov rX,rY
mov rY,rX
when the following has the same result and side effects:
mov rX,rY
I have also seen something similar with long int moves.
I've been looking into writing something for the peephole2 optimizer but I
can't figure out the syntax. Is there any help on this topic past 'info
gccint'?
-Chris Takahashi