https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65640
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |segher at gcc dot gnu.org
--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(Please don't quote from previous messages when not replying to those lines).
This only fails with -O0.
IRA assigns the following:
int f(int out, int in) {
asm("foo %1,%0;" : "=&a" (out) : "b" (in)); // a a
asm("foo %1,%0;" : "=&b" (out) : "b" (in)); // a b
asm("foo %1,%0;" : "=&a" (out) : "a" (in)); // a b
asm("foo %1,%0;" : "=&a,&b" (out) : "b,b" (in)); // a b
asm("foo %1,%0;" : "=&a,&b" (out) : "a,a" (in)); // a b
asm("foo %1,%0;" : "=&b,&a" (out) : "b,b" (in)); // a b
asm("foo %1,%0;" : "=&b,&a" (out) : "a,a" (in)); // a b
return out;
}
The LRA is left to clean up after it, and it comes up with
int f(int out, int in) {
asm("foo %1,%0;" : "=&a" (out) : "b" (in)); // a b
asm("foo %1,%0;" : "=&b" (out) : "b" (in)); // - -
asm("foo %1,%0;" : "=&a" (out) : "a" (in)); // - -
asm("foo %1,%0;" : "=&a,&b" (out) : "b,b" (in)); // a b
asm("foo %1,%0;" : "=&a,&b" (out) : "a,a" (in)); // - -
asm("foo %1,%0;" : "=&b,&a" (out) : "b,b" (in)); // a b
asm("foo %1,%0;" : "=&b,&a" (out) : "a,a" (in)); // b a
return out;
}
(The "- -" are when LRA couldn't come up with something that works).