Phillip Helbig writes:
>Right; if a specific form is better, then one should write it
>explicitly
Yes, we have 3 possibilities:
A*(B+C) is better, write that
(A*B)+(B*C) is better, write that
you don't care ***AND IT IS IN AN INNER LOOP***, write A*B+A*C
Honestly, IMO the optimisation differences are
(1) in anything less than the major inner loop of the code, unimportant
(2) generally lost in the noise anyway [as it still requires an add and a
multiply unless both A*B and A*C are available for free]
(3) available by hand-tuning as above
(which hardly looks more difficult to decide to use than strange parens)
(4) available on many compilers on a program-unit basis with a compiler flag
not to mention that
A*(B+C) has generally better numerical qualities and so should be the default
I take your points but for any change we need a gain, and the magnitude of
the gain is as far as I can see unproven. The efficiency effects of doing
things like -OPT:fold_reassociate:NO are almost always tiny, in my limited
experience (the correctness effects are sometimes large!). Perhaps someone
with a large amount of cpu time on their hands could post the differences in
the SPEC95 ratings that result solely from changing this option?
As others have mentioned, I don't think "[]" would fly anyway.
And I find "{}" rather ugly, and others find "{}" virtually
indistinguishable by sight from "()"; so I think you really want some hard
data here to convince us all that it is worth it.
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|