Closed Bug 587549 Opened 15 years ago Closed 15 years ago

TM/JM: recognize rotate-left operation

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(1 file)

crypto-md5 has this function which is called 31744 times: function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } crypto-sha1 has the same function, but called "rol", which is called 35392 times. It might be worthwhile detecting this pattern and generating a rotate instruction, but I don't know how many ms it would save. In TM this could be done entirely within Nanojit -- it would be easy to add LIR_rol and recognize the above sequence in ExprFilter. I don't know enough about JM to know how easy it would be to do there. An alternative would be to have a JSOP for it but that doesn't feel right since it's not a JS primitive operation.
Summary: TM/JM: recognised rotate-left operation → TM/JM: recognize rotate-left operation
This patch adds LIR_lroti to Nanojit and recognizes the pattern. Instruction count improvements for the two benchmarks: --------------------------------------------------------------- | millions of instructions executed | | total | on-trace (may overestimate) | --------------------------------------------------------------- | 46.812 46.694 (1.003x) | 5.660 5.597 (1.011x) | crypto-md5 | 31.224 31.111 (1.004x) | 7.109 7.001 (1.015x) | crypto-sha1 which is not enough to be worthwhile.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: