This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_constant_p and inline assembly constraints
>
> But that __builtin_constant_p problem was because you put the call to
> it in a function, not because of any other issues. Why not put the
> *whole lot* in a macro? There's no need to break it into separate
> functions. Why was the function you had before not something like
Sorry, I meant in a single asm. I just noticed this example has three asms.
>
> #define puts(string)
> ({ \
> register unsigned long __v0 asm ("$2"); \
> __asm__ volatile (".set push\n.set noreorder\n"); \
> if (__builtin_constant_p (string)) \
> { \
> __asm__ volatile (".long 0xfffd0000\n" ".long %0\n"::"i,!r" (string)); \
> } \
> else \
> { \
> __asm__ volatile (".short 0xfffe\n" ".short %0\n"::"r" (string)); \
> }; \
> __asm__ volatile (".short 0xffff\t#" "puts" "\n\t" \
> ".short %1\n":"=&r" (__v0):"i" (1)); \
> __asm__ volatile (".set\tpop\n"); \
> (int) __v0; \
> })