IonMonkey: Division by Constant Double




8 years ago
5 years ago


(Reporter: evilpie, Unassigned)


Windows XP

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [ion:t])



8 years ago
After Division by Constant for NanoJit didnt work out yet, i tried out my approach for double division.

Double division can be rewritten to 2x multiplications and 1x add, if the divisor is in some parameters. See and

I didn't implement the check yet, but did try out rewriting the expression.

a = 2;
b = 3.2;

for (i = 0; i <= 1000000; i++) {
  c = a / b;

This goes down from about 13~15 to about ~5, without losing precision.
Pastebin of approach:

Comment 1

8 years ago
Interesting. I wonder how frequently this happens in real code.

Comment 2

8 years ago
I went through the benchmark, but there seems to be no! use of division by constant with double. I will try to check modulo next, this should bring definite win!
Is this a dup of bug 600459?
Is this bug useful for JM too?

Comment 5

7 years ago
Maybe it's useful for IM, not sure yet.
Summary: TM: Division by Constant Double → IonMonkey: Division by Constant Double
Whiteboard: [ion:t]
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.