Predefined Version expansion

Don Clugston dac at nospam.com.au
Tue Apr 3 08:30:22 PDT 2007


Dan wrote:
> Walter Bright Wrote:
>> I think what you need is a runtime check, which is provided in std.cpuid.
> 
> So what you're saying is, we can't optimize the compiler for a specific variation of the x86, and are therefore stuck with writing generic programs that branch off for each cpu kind during runtime?

Dan,
I think that there are two seperate issues. The D_InlineAsm_X86 seems to 
mean "this compiler supports inline asm" rather than "this compiler is 
targetting X86". I think it's reasonable to require that any compiler 
which supports X86 inline asm should support *all* X86 opcodes.

However...
I think we do need to work out a way of specifying the CPU target -- but 
that should be accessible even if inline asm is not supported. (For 
example, you may want to call a library function which uses SSE3, even 
if you're not using it yourself).
Yes, it's possible to detect the CPU type at runtime, but the 
performance penalty is appalling for very short functions. I think the 
ideal would be a install-time linker -- link in the appropriate code 
during installation! The CPU type will always be the same, every time 
it's run. But version names would be a great first step.

Standard names for the CPU targets needs to happen. Otherwise everyone 
will make up their own.




More information about the Digitalmars-d mailing list