lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hallo,

On 4/18/06, David Given <dg@cowlark.com> wrote:
>
> Why? Not that I'm arguing, I'm just curious to know why such a primitive
> operation is so slow. If the eight or so instructions that gcc generates
> to do this (I just checked) can be replaced with the two FPU
> instructions described earlier, or a cunning integer arithmetic hack,
> then why doesn't gcc do this by default?
>

     Because of the C conversion rules, which specifies the cast must
be a truncation unlike normal arithmetic that uses rounding. To switch
between these modes the compiler generates the fldcw opcode that
flushes the floating-point pipeline. Modern CPUs rely on deep
pipelines.

--
-alex
http://www.ventonegro.org/