IonMonkey: Division by Constant Double

NEW
Unassigned

Status

()

Core
JavaScript Engine
7 years ago
3 years ago

People

(Reporter: evilpie, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [ion:t])

(Reporter)

Description

7 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 http://hal.inria.fr/docs/00/08/74/65/PDF/DivIEEETC-aug04.pdf and http://lara.inist.fr/bitstream/2332/801/1/LIP-RR2002-30.pdf.

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: http://pastebin.mozilla.org/822613

Comment 1

7 years ago
Interesting. I wonder how frequently this happens in real code.
(Reporter)

Comment 2

7 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?
(Reporter)

Comment 5

6 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)

Updated

3 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.