Compared to the slow idivl, abs could be negligible, right. However, abs
does introduce new data dependence which might add a noticeable cost.

   Is there an abs instruction in the i386 instruction set?

No, the closest thing (input in eax, output in edx) is

cltq
addl %edx, %eax
xorl %eax, %edx

But the register allocations constraints are pretty heavy considering that idivl already puts strain on the RA.

Paolo

Reply via email to