Re: [PATCH 2/5] atomic: introduce atomic_inc_not_zero

From: Russell King
Date: Sat Sep 17 2005 - 02:28:46 EST


On Sat, Sep 17, 2005 at 12:18:22AM -0700, David S. Miller wrote:
> > My biggest problem here is the lack of gcc support to get the
> > condition code out of an asm.
>
> I agree, this is the biggest deficiency in gcc inline assembly and I
> run into it all the time.

gcc did have some support to pass condition codes into assembly.
On ARM, you used to be able to do things like:

if (foo)
asm("blah%? whatever");

and gcc would replace %? with whatever condition was appropriate
for the current block of code. You can still write it as the
above.

However, this optimisation was disabled on ARM apparantly because
it was very hard to for people to get correct - if you forgot the
%?, you need to add a "cc" clobber, and if you forget that as well
you might get unconditional behaviour.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/