Sławomir Kawa schreef op 2020-06-13 21:08:
Hi,
I have a question/advice request.

Lately I have builded easy-pdk programmer and started playing with padauk
uc and SDCC. I'm using PFS154 as it's MTP . When i wan't to check some
register bit for example PIN state or interrupt flag for PA i'm using:

if( INTRQ & INTRQ_PA0 ) { __nop(); }

which would produce asm like that:

mov a, __intrq
and a, #0x01
cneqsn a, #0x00
goto 00188$
nop
00188$:

but pdk has instruction t0sn / t1sn (Check IO bit and skip next instruction if it’s low/high) and code like below works much faster (two instruction
less):

__asm__ ( "t1sn __intrq, #1;\n" "goto 00099$;\n" );
{
__nop();
}
__asm__("00099$:\n");

Is there a way to make the SDCC use tXsn in bitwise operations like that ?
Or write it more elegantly/better ?

This sounds like an excellent job for the peephole optimizer.
Are there restrictions on the operand that should be checked?

Maarten


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to