Compiler optimizations (I'm baffled)

Thomas Kuehne thomas-dloop at kuehne.cn
Wed May 3 12:23:31 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruno Medeiros schrieb am 2006-05-03:
> Walter Bright wrote:
>> Craig Black wrote:
>>>  This is
>>> because integer division is essentially floating point division under the
>>> hood.
>
> I ran these tests and I got basicly the same results (the int division 
> is slower). I am very intrigued and confused. Can you (or someone else) 
> explain briefly why this is so?
> One would think it would be the other way around (float being slower) or 
> at least the same speed.


The code doesn't necessarily show that int division is slower than float
multiplication.

What CPU are we talking about?

A naive interpretation of the "benchmark" assumes a single execution
pipe that does floating point and integer operations in sequence ...

Even assuming a single pipe: Why is the SSE version faster?

Does the benchmark measure the speed of int division against float
multiplication? 

Does the benchmark measure the throughput of int division against float
multiplication? 

Does the benchmark measure the throughput of int division of a set of
numbers through a constant factor against float multiplication of the
same set through (1 / constant factor)?

Thomas



-----BEGIN PGP SIGNATURE-----

iD8DBQFEWRDO3w+/yD4P9tIRAs8lAJ9q62J8zf8U0HWzxtxQmMWasuU4ngCgwA21
4M5nb9Z8ZXHevJiwylY/wGM=
=QSyS
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list