gcc using clobbered register as input with inline assembly

Timur Tabi ttabi@interactivesi.com
Mon Mar 26 11:56:00 GMT 2001


** Reply to message from "Zack Weinberg" <zackw@stanford.edu> on Mon, 26 Mar
2001 11:39:11 -0800


> There is a thing called an early clobber which could help here, but
> when you can explain to the compiler what rdtsc *really* does,
> i.e. "write 64-bit value into eax and edx considered as a low/high
> pair", why not do that instead?  With inline assembly, you're almost
> always better off writing just one machine instruction per asm() and
> describing as accurately as possible what that instruction does with
> the constraints.

The reason I ask is because I have another, much larger function.  I won't
paste the code, but here is the parameter info:

: "=m" (BestMatch.Count), "=m" (BestMatch.Index), "=m" (Count)
: "m" (pInput), "2" (Count), "0" (BestMatch.Count), "m" (cbInput), "m"
(cbWindow), "m" (cbIn4095)
: "eax", "ebx", "ecx", "edx", "esi", "edi"

As you can see, I have 9 inputs and outputs, which is gcc's max.  I don't have
any more registers available, so I had to use explicit registers for all my code.

Are you saying that this won't work?  Currently, all my inputs/outputs are
specified as memory, not register, so I think that I'm safe.


-- 
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please direct the reply to the mailing list only.  Don't send another copy to me.



More information about the Gcc-bugs mailing list