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.
Documentation at https://gcc.gnu.org.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…