[LLVMdev] Odd PPC inline asm constraint
Peter Bergner
bergner at vnet.ibm.com
Fri Apr 27 17:33:58 PDT 2012
On Fri, 2012-04-27 at 14:54 -0500, Hal Finkel wrote:
> There is a comment in the file which reads:
>
> /* The weird 'i#*X' constraints on the following suppress a gcc
> warning when __excepts is not a constant. Otherwise, they mean the
> same as just plain 'i'. */
[sinp]
> ("mtfsb0 %s0" : : "i#*X"(__builtin_ffs (__excepts)));
[snip]
> Does anyone know what that "weird" asm constraint actually means?
The "i" and "X" constraints are documented here:
http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Simple-Constraints.html
`i'
An immediate integer operand (one with constant value) is allowed.
This includes symbolic constants whose values will be known only
at assembly time or later.
`X'
Any operand whatsoever is allowed.
The # and * constraint modifiers are documented here:
http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Modifiers.html
`#'
Says that all following characters, up to the next comma, are to
be ignored as a constraint. They are significant only for choosing
register preferences.
`*'
Says that the following character should be ignored when choosing
register preferences. `*' has no effect on the meaning of the constraint
as a constraint, and no effect on reloading.
For more info about PowerPC specific constraints, you'll want to look here:
http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Machine-Constraints.html
I'll note that the "s" in the %s0 means to only print the low 5 bits of
operand 0. I think that may only be documented in the src:
gcc/config/rs6000/rs6000.c:print_operand()
Peter
More information about the llvm-dev
mailing list