Inline assembly and CTFE

David Nadlinger code at klickverbot.at
Thu Oct 3 17:18:08 PDT 2013


On Thursday, 3 October 2013 at 23:21:56 UTC, bearophile wrote:
> Static CPU introspection could be handy sometimes, if you want 
> to run the code in the same system you have used to compile the 
> code, and avoid run-time CPU tests.

The reason why this wouldn't be particularly useful with DMD 
right now is that its backend doesn't make use of any 
"non-generic" instructions by default, and as such it is lacking 
the command line flags, …  to control what CPU to target.

And the cases where just optimizing for the host CPU by default 
is a good idea are rather rare – we LDC guys learned that the 
hard way when we accidentally had the equivalent of 
"-march=native" for GCC enabled by default without anybody 
knowing.

David


More information about the Digitalmars-d mailing list