Predefined Version expansion

Walter Bright newshound1 at digitalmars.com
Mon Apr 2 13:24:32 PDT 2007


Dan wrote:
> Following the discussion on D's hashtables, and my current understanding that D doesn't implement any of the x86 CPU features beyond Pentium Pro (same as C and most other things for that matter) I took another quick peek at D's predefined Versions.
> 
> Currently, when I want to use asm {} I have to use:
> 
> version(D_InlineAsm_X86)
> 
> Unfortunately, this doesn't cover anything to do with most of the later instruction extensions D claims to support in the spec, such as the SSE, SSE2, SSE3, SSSE3, MMX, 3DNow! instruction sets, let alone x86_64.  Ultimately, one would want to have a cascading support mechanism, such that if I want to use SSSE3, I'm obviating that the processor must support everything before it:
> 
> version(D_InlineAsm_x86)
> version(D_InlineAsm_x86_3DNow)
> version(D_InlineAsm_x86_MMX)
> version(D_InlineAsm_x86_SSE)
> version(D_InlineAsm_x86_SSE2)
> version(D_InlineAsm_x86_SSE3)
> version(D_InlineAsm_x86_SSSE3)
> version(D_InlineAsm_x86_SSE4)
> version(D_InlineAsm_x86_64)
> 
> Predefining those so that compiler writers can raise errors if they don't yet support SSE3 instructions, but they do support x86 and MMX, would be a smart thing to do.  It would also allow implementors to write code that WON'T compile and try to run if the user's CPU doesn't support it - preventing what could be a devastating crash.

The inline assembler does support all the SSE3 instructions, etc.



More information about the Digitalmars-d mailing list