This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inline assembly constraints question


Jeroen Demeyer <jdemeyer@cage.ugent.be> writes:

> This is the full asm statement:
> asm("# number_t& number_t::operator>>=(unsigned char s)\n"
>     "   shrdl %6, %4, %3\n"
>     "   movl %3, %0\n"
>     "   movl %5, %2\n"
>     "   shrdl %6, %2, %1\n"
>     "   shrl %6, %2\n"
>     : "=&rm" (n0), "=&r" (n1), "=&r" (n2)
>     : "2" (n0), "1" (n1), "g" (n2), "cI" (s)
> );
>
> The code generated is the following:
>     shrdl %cl, %esi, %eax
>     movl %eax, -4384(%ebp)
>     movl -4384(%ebp), %eax
>     shrdl %cl, %eax, %esi
>     shrl %cl, %eax
>
> As you can see, %0 and %5 both become -4384(%ebp).
> See attachment for the output from -dg.

Thanks for the details.  Unfortunately, I am no wiser.  As far as I
can tell, this should work correctly.  Either you've found a bug, or
I'm missing something.

If you like, and you want to help others avoid this problem, please
file a bug report with the preprocessed source code and command line
at http://gcc.gnu.org/bugzilla/ .  For more information about filing
bug reports see http://gcc.gnu.org/bugs.html .

If you just want to fix it for yourself change constraint 0 to "=&r"
or change constraint 5 to "r".

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]