Array Operations

Jonathan Crapuchettes jcrapuchettes at
Fri Aug 20 09:59:04 PDT 2010

Jonathan Crapuchettes wrote:
> Michael Parrott wrote:
>> Jonathan Crapuchettes Wrote:
>>> I followed the example in issue #30:
>>> DFLAGS='-O2 -g -frelease -march=pentium3' ../configure --enable-languages=d
>>> --disable-multilib --disable-shared
>>> Is this wrong?
>>> JC
>>> Michael Parrott wrote:
>>>> Jonathan Crapuchettes Wrote:
>>>>> I have been trying to add the SSE2 array operation code to the compilation,
>>>>> but
>>>>> it seems like the DFLAGS variable isn't being used. Can you offer any
>>>>> suggestions?
>>>>> Thank you,
>>>>> JC
>>>> Did you set DFLAGS before running configure? If you didn't, that might be why.
>>>> Example:
>>>> DFLAGS="-g"
>>>> export DFLAGS
>>>> ../configure --enable-languages=d .....
>>>> make
>>>> sudo make install
>>>> Something like that should work.
>> No, that should be fine.
>> What is wrong when you do that? Are there errors when you build? Does Phobos
>> not seem to be taking advantage of the SSE operations?
>> In phobos/internal/array{byte, double, float, int, short}.d, you need to
>> uncomment the sections labelled "version (D_InlineAsm_X86)" to enable the ASM
>> code.
> I did uncommented the version sections, but thank you for the reminder.
> I can tell that the SSE code is not being used because I compared two pieces of
> code:
> for (int i = 0; i < a.length; i++)
> c[i] = a[i] / 1000;
> and
> c[] = a[] / 1000;
> They should produce the same result and they do, but the array operation code
> should be much faster. I base this assumption off of the same speed test using
> DMD. The execution time for the two code segments, produced by GDC, are about
> the same. I also compared the assembly for the objects created by GDC and DMD.
> The GDC code is not using the SSE code as specified in the arrayDouble.d file,
> but the DMD code is.
> If you have suggestions, I am all ears.
> Thank you for taking the time to help me,
> JC

Michael and Iain,
Thank you for your input. I just realized what my mistake was and now feel like 
I have wasted you time. The issue was that I was compiling the compiler as 
x86_64, which I need, and the version tag for the SSE2 is D_InlineAsm_X86 not 

I'm thinking that I might play with converting the code in arrayDouble.d to 
x86_64, but I wouldn't hold my breath.

Thank you again for your help,

More information about the D.gnu mailing list