Array Operations

Jonathan Crapuchettes jcrapuchettes at gmail.com
Thu Aug 19 16:47:57 PDT 2010


Michael Parrott wrote:
> Jonathan Crapuchettes Wrote:
>
>> I followed the example in issue #30:
>> http://bitbucket.org/goshawk/gdc/issue/30/d_inlineasm-updates
>>
>> 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


More information about the D.gnu mailing list