This is the mail archive of the
mailing list for the GCC project.
Re: inline asm and multi-alternative constraints
- From: Richard Henderson <rth at redhat dot com>
- To: Jeff Law <law at redhat dot com>, David Wohlferd <dw at LimeGreenSocks dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: pinskia at gcc dot gnu dot org, rearnsha at gcc dot gnu dot org, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Thu, 29 Oct 2015 13:47:20 -0700
- Subject: Re: inline asm and multi-alternative constraints
- Authentication-results: sourceware.org; auth=none
- References: <562DA0E2 dot 1040405 at LimeGreenSocks dot com> <562FE71E dot 7010309 at redhat dot com>
On 10/27/2015 02:05 PM, Jeff Law wrote:
> On 10/25/2015 09:41 PM, David Wohlferd wrote:
>> Does gcc's inline asm support multi-alternative constraints? Or are
>> they only supported for md?
>> The fact that it is doc'ed with the other constraints
>> (https://gcc.gnu.org/onlinedocs/gcc/Constraints.html) says it works for
>> inline. But https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396#c17 says
>> it only works for md.
>> I've got a patch ready to remove this section from the non-md docs
>> (attached). But there probably needs to be more support than a 11 year
>> old comment to approve it.
>> Dropping a supported feature is always controversial. But if it doesn't
>> work, perhaps less so. After all, doc'ing something that doesn't work
>> is just as bad.
>> PS If it *is* supported, then the docs need some work.
> I think Richard corrected me last I spoke on this topic :-) They *are*
> supported. ie, something like this should work on a ciscy target.
> asm("add %0,%1" : "=r,m"(x) : "rim,ri"(y))
They are supported, so long as the assembly can use the same text for all
alternatives. Thus multiple alternatives in inline asm is basically useless
for RISC targets, but occasionally useful for CISC targets.