extended asm and input parameters

dw limegreensocks@yahoo.com
Thu Jul 4 10:28:00 GMT 2013


Hey Andrew, thanks for the response.

 > main:
 > .LFB1:
 >     leaq    -32(%rsp), %rdi
 >     movl    $32, %ecx
 >     xorl    %eax, %eax
 > #APP
 > # 2 "z.c" 1
 >     rep stosb
 > # 0 "" 2
 > # 2 "z.c" 1
 >     rep stosb
 > # 0 "" 2
 > #NO_APP
 >     xorl    %eax, %eax
 >     ret

Interesting.  So, you are getting the duplicate zeroing of eax, but not 
the duplicate loading of rdi.  That's certainly an improvement.

I'm using 4.8.0.  You?  If this is something that was improved in 4.8.1, 
perhaps it's time for me to upgrade.

Any special compile switches other than -Os?

 > By the way, your asm is wrong: stosb modifies its registers, and you
 > must tell GCC that.

I'll assume this was intended to be humorous.  Having just 
discovered/concluded that the compiler must be informed if I change the 
contents of input-only parameters, you may safely assume I made the 
appropriate change.  However, the optimization issues I observed while 
experimenting with this are still of some interest.

Thanks,
dw



More information about the Gcc-help mailing list