[DOC Patch] Add sample for @cc constraint

David Wohlferd dw@LimeGreenSocks.com
Mon Apr 11 22:49:00 GMT 2016


Ping?

dw

On 4/1/2016 4:39 PM, David Wohlferd wrote:
> > I would like executable code that verifies that this feature is 
> indeed working as intended.
>
> First draft is attached.  It tests all 28 (14 conditions plus 14 
> inverted).  I wasn't sure what to set for optimization (O2? O3? O0?), 
> so I left the default.
>
> It looks like even at O3 there are some missed optimizations here, but 
> that's an issue for another day.
>
> > Is there any _actual_ problem here? Like, if you combine the output 
> and the clobber you run into problems? Looks to me like an explicit 
> "cc" clobber is just ignored on x86. We just need to make sure this 
> stays working (testcases).
>
> Today?  No.  You can clobber or not clobber and both will produce the 
> exact same output.
>
> But letting people program this two different ways guarantees that 
> people *will* program it both ways.  And just because there isn't any 
> definable reason to limit this today doesn't mean that there won't 
> ever be.  But by then it will be 'too late' to change it because it 
> "breaks existing code."
>
> >> 1) Leave this text in.
> >> 2) Remove the text and add the compiler check to v6.
> >> 3) Remove the text and add the compiler check to v7.
> >> 4) Leave the text in v6, then in v7: remove the text and add the 
> compiler check.
> >> 5) (Reluctantly) remove the text and hope this never becomes a 
> problem.
>
> So, I've made my pitch, but it sounds like you want #5?
>
> > My question would be, can this information ever be relevant to 
> users? They may notice that their code still works if they omit the 
> "cc", but that's not really a habit we want to encourage.
>
> People do this now without understanding how or why it works.
>
> > I think this is an internal implementation detail that doesn't 
> necessarily even have to be documented.
>
> One time it would matter is if people want to move from basic asm 
> (which doesn't clobber "cc") to any type of extended asm (which always 
> does).  It /probably/ won't matter in that case (and may even make 
> things better).  But it shouldn't be a secret.
>
> dw



More information about the Gcc-patches mailing list