A little warning in GMP.h
brg at gladman.plus.com
Mon Sep 27 16:51:55 CEST 2004
Torbjorn Granlund wrote:
> Brian Gladman <brg at gladman.plus.com> writes:
> Designing GMP to work well with poor compilers at the expense of good ones
> is fine if you really think that this makes sense. But in my view this is a
> design philosophy that is from a bygone age.
> You would know more about those datk age than me, but it baffles
> me that people ever behaved that irrationally. :-)
> And, of course, you can always trust someone on this list to turn a serious
> point into a cheap jibe at the Microsoft compiler.
> Oh, I misunerstood you. I thought you were showing a horror
> example of the poor optimizer of the Microsoft compiler, when you,
> in fact, where making a serious point.
Ok, now that we have got that misunderstanding out of the way, I think
it is worth asking Brian Hurt's question but 'in reverse'.
That is, are there still compilers around that: (a) are important for
GMP, and (b) cannot produce branchless code from:
return (__gmp_n != 0) ? __gmp_l : 0;
on those architectures where this matters?
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?
If modern C compilers don't need such tricks it would surely be better
to abandon them since they only serve to make the code more obscure
without producing benefits.
More information about the gmp-discuss