i was fooling around with SIMD instructions on my notebook today and found something with gcc inline assembly:
asm volatile("xor %%eax,%%eax\n");
it looks like a pretty reasonable statement, but unfortunately it will not compile. gas will tell you that %%eax is an invalid register. it was throwing me for a loop for a while until mpr pointed out to me that gcc did not strip the first parentheses from the register name for some reason. gas doesn't want "%%eax", it wants "%eax", so I was sitting there with my thumb up my butt for about 5 minutes until I started messing with my inline statement, then doing gcc -S to see what the assembler output looked like. I couldn't get gcc to strip the first parentheses until I changed it to this:
asm volatile("xor %%eax,%%eax\n" : );
no, that's not supposed to be a smiley face. If you at least put the output operand colon there gcc will strip the first parentheses, otherwise it will assemble it without touching it and gas will go kaput. does anyone know why this happens?