[macstl-dev] not all rosey in the gcc-4.0.0 land
Glen Low
glen.low at pixelglow.com
Sat Jul 2 16:56:30 WST 2005
On 02/07/2005, at 12:32 PM, Ilya Lipovsky wrote:
>>
>> That is strange indeed. On Apple gcc 4.0 (as of Xcode 2.1), the
>> following:
>>
>> using namespace stdext;
>> valarray <float> v1 (10.f, 100);
>> valarray <float> v2 (20.f, 100);
>> std::cout << (v1 * v2).sum ();
>>
>> produces 20000 as expected. Do you not get this result with Yellow
>> Dog Linux?
>>
>> You may have to check carefully where the problem occurs in YDL,
>> since this is explicitly one of the expressions optimized to use
>> vmaddfp through valarray_altivec.h:154.
>>
>>
>
> Could you please try that with valarray<stdext::complex <float> > ?
> Because this is where my code fails.
>
> -Ilya
Sure thing.
using namespace stdext;
valarray <complex <float> > v1 (complex <float> (1.0f,2.0f),
100);
valarray <complex <float> > v2 (complex <float> (3.0f,4.0f),
100);
std::cout << (v1 * v2).sum ();
produces
(-500,1000)
benchmark has exited with status 0.
on my Mac as expected.
Perhaps the error is with particular values of v1, v2 etc.? (BTW, the
complex multiply then sum is also optimized to use some combination
of vectorized fma, from recollection, so any error would start at
valarray_altivec.h:154 -- test that is involved by inserting a
std::cout << "x" in the static "call" function.) You can do a random
search of the problem space by looking at exhaustive.cpp and
configuring it with the right functor template, stdext::accumulator
<stdext::plus>.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20050702/4cd4fcb4/attachment.html
More information about the macstl-dev
mailing list