[Coco] Drivewire mixed results...
Chuck Youse
cyouse at serialtechnologies.com
Mon Sep 29 12:33:26 EDT 2008
On Mon, 2008-09-29 at 10:47 -0500, David Gacke wrote:
> Hi Chuck,
>
> This isn't quite accurate.
> While in this particular case it really doesn't apply, Alex is correct.
>
> Especially with SSE(SIMD) enabled processors, you should pass and return
> what you need.
>
> This lets the compiler make the most of its optimization possibilities. If
> the compiler wants to promote the variable, so be it.
> If you force a variable promotion by returning something larger than what
> you need, the compiler won't be able to take advantage of knowing the true
> variable size, and might not be able to make an optimization where one was
> available.
>
> Also, you are assuming in the above statement that the compiler didn't
> inline the function on you. Bad assumption on certain compilers with certain
> optimizations set.
Alright, conceded. Compilers are explicitly allowed by standard to skip
the promotions if they can guarantee the results will not differ. In
conventional architectures and with conventional compilers, promotions
are almost always performed because there's nothing to be gained by
using shorter integers - in fact, it's often less efficient.
But then you had to go and bring up SIMD and compilers with aggressive
global optimizations, and I'll grant that theoretically you have some
ground there - but aside from the most obvious cases (the use of
constants, etc.) I don't see how an optimizer could make use of any of
this information while still guaranteeing standard behavior.
Maybe you could provide me with some more concrete (non-trivial)
examples to put me in my place! As many people on the list probably
think (frequently), I could use a slice of humble pie once in a
while ... I gladly eat when it's deserved ..
C.
More information about the Coco
mailing list