[MIPS] Fix asm constraints for 'ins' instructions.
commit4ddf3769838f3ba48dc164913a38605acc14dbb5
authorDavid Daney <ddaney@avtrex.com>
Wed, 11 Jun 2008 17:04:25 +0000 (11 10:04 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 15 Jul 2008 08:05:39 +0000 (15 09:05 +0100)
tree6da01a65eb7688ad6c5f69b72bd028df9868bc00
parent11ef46ad4c5e8126bb4e4ac96554bae0c89d386f
[MIPS] Fix asm constraints for 'ins' instructions.

The third operand to 'ins' must be a constant int, not a register.

[Ralf: The bug was actually intensional.  Some versions used to throw an
error under certain circumstances for code like:

static inline void f(unsigned nr, unsigned *p)
{
unsigned short bit = nr & 5;

if (__builtin_constant_p(bit)) {
__asm__ __volatile__ ("  foo %0, %1" : "=m" (*p) : "i" (bit));
   } else {
/* Do something else. */
}
}

because gcc was not able to figure out that the "i" constraint was possibly
at the early stage when the constraint are getting verified.  The solution
was using "ri" instead of "i".  The "ri" would keep gcc happy but in the
end for code generation always the "i" constraint would be satisfied.  The
problem afair originally appeared in the i386 io.h and also hit it's mips
equivalent.  From there the workaround spread to many of the inline
assembler functions.]

Signed-off-by: David Daney <ddaney@avtrex.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
include/asm-mips/bitops.h