Compiler optimizations
Craig Black
cblack at ara.com
Sun Apr 30 05:41:15 PDT 2006
So I've been playing around with the pi program. I ported it to C++ and
I've been doing some benchmarks with MSVC. It seems that MSVC is a little
faster when SSE2 instructions are enabled. It is slower when they are
disabled. Which leads me to a question. Does the D backend make use of SSE
2 intstructions? I think the answer is yes but perhaps the optimizer is not
quite as sophisticated as MSVC yet.
Another question for someone who knows a lot about backend optimizations.
I've noticed that integer division is faster when the the divisor is a
constant. How does the compiler optimize this?
Another thing. I know that integer division is essentially a floating point
operation because there is no integer division instruction. I also read
some on the internet and learned that Intel has a library that provides
fixed-point math routines, which provides a division operation that
outperforms floating-point division. Then I thought to myself, "Why don't
compilers just use fixed-point division for dividing integers since it's
faster?"
I know some of you out there know way more than me so please all you smart
people give me some input.
-Craig
More information about the Digitalmars-d
mailing list