About
About Larry Bank:
I live in sunny South Florida with my wife and four children. I work mostly in arcade game emulation on handheld and embedded systems, but occasionally venture into other areas.
This blog is to keep a journal of my tech activities, jot down ideas and have a central place to keep news/photos about the family. If you have some ideas or comments, write me at bitbank@pobox.com.
Hi Larry,
I really enjoyed your nice articles here. I am doing some ARM optimizations myself (writing C(++) code and checking the assembly generated by gcc). Code has to run on multiple platforms so I am not writing assembly directly. And I have a question that you maybe could answer:
C-code:
unsigned char* ptr;
int compareValue = 2;
do
{
}
while( compareValue == ( *(–ptr) >> 6 ) );
Assembly:
mov r3, #2
L1:
ldrb r1, [r0, #-1]!
and r2, r1, #255
cmp r3, r2, lsl #6
bne L1
Very nice loop but do you have an idea why gcc adds the line ‘and r2, r1, #255′. I have no clue in other places it does not seem to happen.
Thanks in advance, and keep up the nice weblog.
William
Hi William,
I’m glad you like the articles I’ve written - that’s the whole point of doing them
I believe you’re seeing the “AND r2,r1,#255″ because ptr is defined as a “char *” and the compiler author didn’t realize that ldrb will take care of truncating the value to the size of a char.
L.B.
Larry,
I heard from an informed source that in your code-crazy youth you and friend created a debugger for the old Atari 68K systems. R.A.I.D — Really Awesome Incredible Debugger — is what I heard it was called. What happened to that awesome debugger? Did the burgeoning Atari market make you enough money to retire? My sources tell me that your friend had to go and get a day job after the experience…
Regards,
Adam “Sherilog” Sherer
Marketing Director, Chief SystemVerilog Promoter, and former Atari 68K coder
Cadence Design Systems
P.S. That informed source told me you once did 33 “dips” in a row(grab two parallel bars with your feet off the ground, “dip” from locked elbows until your upper arms are parallel with the ground, push up to elbows locked, then repeat). Is that urban legend true?