A little warning in GMP.h

Brian Gladman brg at gladman.plus.com
Mon Sep 27 17:41:43 CEST 2004


Brian Hurt wrote:

[snip]

>>All the x86 compilers that I use regularly have no problem producing 
>>branchless code in this situation.  I don't use GCC but can I assume 
>>that it is now good enough on the X86 to do the same?
> 
> 
> Yes, it is (at least for GCC 3.2.2), if it feels that it's an advantage.
> 
> Note that there can be an advantage to branching: branching doesn't load 
> __gmp_l if it doesn't need to.

Indeed, deciding which code is best is often impossible for a compiler 
that has no runtime profiling data.

But the fact that the main compilers around now, when given branching 
code, are all capable of producing branchless code when they consider 
this worthwhile tends to suggest that tricks to 'force' or 'encourage' 
this are probably past their 'sell by' dates.

    Brian Gladman



More information about the gmp-discuss mailing list