Converting addc to adcx

Jeffrey Walton noloader@gmail.com
Fri May 31 11:30:00 GMT 2019


On Fri, May 31, 2019 at 7:19 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Fri, May 31, 2019 at 06:34:19AM -0400, Jeffrey Walton wrote:
> > We have this inline asm on x86_64. Notice adcq and the constant $0:
> >
> >     asm ("addq %2, %0; adcq $0, %1;" : "+r"(a0), "+r"(a1) : "r"(b) : "cc");
> >
> > I convert it to adcx. This conversion tests OK.
> >
> >     asm ("addq %2, %0; adcx %3, %1;" : "+r"(a0), "+r"(a1) : "r"(b),
> > "r"(0ULL) : "cc");
> >
> > Is this a valid conversion?
>
> Writing to %0 can clobber %3, the way you wrote it.  Use an earlyclobber?
>
> (Look at the generated code to see what is happening -- use -S instead of -c
> for example).

Man, it did not like that when using "&=r"(0ULL) (hundreds of them):

     error: lvalue required in asm statement

(I assume you wanted an early clobber on the input %3).

Jeff



More information about the Gcc-help mailing list