Starting with GCC6 on x86 you can actually use "=@ccCOND"
as output (where COND
is any valid x86 condition code).
Example originally from here, cleaned up by David’s suggestions:
int variable_test_bit(long n, volatile const unsigned long *addr)
{
int oldbit;
asm volatile("bt %[value],%[bit]"
: "=@ccc" (oldbit)
: [value] "m" (*addr), [bit] "Jr" (n));
return oldbit;
}
Before using this, you should test if __GCC_ASM_FLAG_OUTPUTS__
is defined.