[cfe-dev] [LLVMdev] Odd PPC inline asm constraint

Hal Finkel hfinkel at anl.gov
Fri Apr 27 18:30:24 PDT 2012


Peter,

Thanks! Do you happen to know where this needs to be changed in clang
or LLVM. The code that actually interprets the constraints,
generically, is in CodeGen/SelectionDAG/TargetLowering.cpp, is clang
relying on that code, or is there some frontend code in clang itself
that is failing to initially interpret the string? If it is the code in
TargetLowering, then I don't see any support there for '*' or '#'.

 -Hal

On Fri, 27 Apr 2012 19:33:58 -0500
Peter Bergner <bergner at vnet.ibm.com> wrote:

> 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
> 
> 
> 



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-dev mailing list