DMD Backend: Deciding instructions to use/avoid?

Don nospam at nospam.com
Fri Jun 10 04:46:28 PDT 2011


Nick Sabalausky wrote:
> "Nick Sabalausky" <a at a.a> wrote in message 
> news:isoltk$1ehd$1 at digitalmars.com...
>> "Don" <nospam at nospam.com> wrote in message 
>> news:isoh6c$15jb$1 at digitalmars.com...
>>> Nick Sabalausky wrote:
>>>> So my main question: Does DMD do anything like, say, detecting the CPU 
>>>> at compile time and then enabling instructions only available on that 
>>>> CPU and up? Or does it do anything like always assuming the target CPU 
>>>> has SSE2? Anything like that that could cause differences between our 
>>>> CPUs to result in object code that will work on one of the CPUs, but not 
>>>> the other? FWIW, the CPU on my linux box is i686, so it's not like I'm 
>>>> on some super-ultra-old i586, or anything like that.
>>> DMD itself doesn't, but the array operations do. The DMD backend is 
>>> ancient, and generates code for original Pentiums (+ 64 bit equivalents 
>>> of the same instructions).
>> Is there any way to force the array operations down to a certain level? Or 
>> even better yet, have them detect the CPU at startup and then use the 
>> appropriate version?

The runtime detects the CPU type at startup, and uses SSE/SSE2 if 
available, otherwise falls back to x87.
The 64-bit DMD doesn't use SSE2 at all, yet.

> It would be a bad thing if we can't use an SSE2 CPU to compile a binary 
> that'll work on a non-SSE2 machine.
Indeed.


More information about the Digitalmars-d-learn mailing list