[cfe-dev] [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'.  */
>  ("mtfsb0 %s0"  : : "i#*X"(__builtin_ffs (__excepts)));
> Does anyone know what that "weird" asm constraint actually means?

The "i" and "X" constraints are documented here:


    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.

    Any operand whatsoever is allowed.

The # and * constraint modifiers are documented here:


    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:


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:



More information about the cfe-dev mailing list