[PATCH 1/6] ARM: prefetch: remove redundant "cc" clobber

Will Deacon will.deacon at arm.com
Wed Jul 24 12:35:31 EDT 2013


On Wed, Jul 24, 2013 at 05:16:59PM +0100, Nicolas Pitre wrote:
> On Wed, 24 Jul 2013, Will Deacon wrote:
> > On Tue, Jul 23, 2013 at 08:48:11PM +0100, Nicolas Pitre wrote:
> > > You know the legacy reason why the cc clobber was there, right?
> > > It certainly doesn't apply anymore.
> > 
> > I was under the impression that it was due to ancient GCC behaviour and the "cc"
> > was there to prevent re-ordering. For interest, what are the specifics?
> 
> In the old days, you had to take care of the predicate for conditional 
> instructions in your inline asm code.  So for example, if you had:
> 
> 	if (foo)
> 		inline asm ("mov %0, #1" : "=r" (bar));
> 
> That wouldn't work most of the time because even if the if condition was 
> false, gcc would not branch over the inline asm code but expect you to 
> take care of the condition code.  That means the above needed to be 
> written as:
> 
> 	if (foo)
> 		inline asm ("mov%? %0, #1" : "=r" (bar));
> 
> Because having %? added all over the place was cumbersome, the 
> alternative was to add "cc" to the clobber list so gcc would then branch 
> across the inline asm when the condition is false.
> 
> But of course many people forgot about those subtle details quite often, 
> and then gcc was changed so inline asm was made non predicated.

Holy sh*t....

Next time I complain to the tools guys about inline asm, I'll count my
blessings so they don't try and resurrect anything as horrendous as what
you've just described.

Thanks for the insight!

Will



More information about the linux-arm-kernel mailing list