3 ms·
> Long chains of instructions (ie. Where the output of one instruction is required as the input to another) are slow on modern hardware. It might well be faster
by woodruffw 6y ago
> Long chains of instructions (ie. Where the output of one instruction is required as the input to another) are slow on modern hardware. It might well be faster to calculate the high side clamp and the low side clamp independently, and then to decide which result to return.
Probably not, at least not on Intel: the CPU could conceivably schedule both sides simultaneously on different execution ports, but they'd still be serialized internally on the floating point unit. That port is better used by other in-flight (u)ops. You're right that data dependencies are important to be aware of, but the generated code here is probably pretty close to optimal for recent Intel and AMU CPUs.
- gpderetta 6y agoDepends a lot on the specific instructions, but in general there isn't a single FP unit.