logoalt Hacker News

Tuna-Fishyesterday at 8:46 PM2 repliesview on HN

FP Division by constant is optimized by a compiler into a multiply. Graphics processing typically happens on the GPU these days, and on all recent GPUs FPMUL belongs to the class of lowest-latency operations. That is, there are no other instructions that complete faster.


Replies

pixelesqueyesterday at 9:17 PM

Only with things like -ffast-math enabled will compilers do the reciprocal. It can make a fair difference in some cases, but it's often better to selectively use it in code locations you know are acceptable by doing it manually in the code.

mgaunardyesterday at 9:03 PM

That's only valid to do if the reciprocal is representable exactly.

show 1 reply