[LLVMdev] Odd PPC inline asm constraint

Hal Finkel hfinkel at anl.gov
Fri Apr 27 12:54:52 PDT 2012


Hello,

I am not sure whether this is a clang issue, an LLVM issue, or both;
but clang chokes when parsing expanded macros from the
glibc /usr/include/bits/fenvinline.h with an error like:

./boost/math/tools/config.hpp:279:10: error: invalid input constraint
'i#*X' in asm feclearexcept(FE_ALL_EXCEPT);
         ^
/usr/include/bits/fenvinline.h:56:11: note: expanded from macro
'feclearexcept' : : "i#*X"(__builtin_ffs (__excepts)));            \
                               ^
1 error generated.

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'.  */

For example, one of the full macros is:

/* Inline definition for feclearexcept.  */
# define feclearexcept(__excepts) \
  ((__builtin_constant_p
(__excepts)                                          \ && ((__excepts)
& ((__excepts)-1)) == 0                                   \ &&
(__excepts) != FE_INVALID)
\ ? ((__excepts) !=
0                                                        \ ?
(__extension__ ({ __asm__ __volatile__                                \
("mtfsb0 %s0"                                       \ : :
"i#*X"(__builtin_ffs (__excepts)));            \
0; }))                                              \ :
0)
\ : (feclearexcept) (__excepts))

Does anyone know what that "weird" asm constraint actually means? (and
where I should add support for it?)

Thanks again,
Hal

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



More information about the llvm-dev mailing list