Closed Bug 1633386 Opened 4 years ago Closed 4 years ago

Simplify flexible-shift functions

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

flexibleLshift32 (and the right shift alternatives) can be simplified using xchg, which also leads to shorter assembly. (JSC does something similar.)

x << y was previously generating the following assembly (for CacheIR):

[Codegen] emitInt32LeftShiftResult
[Codegen] push       %rcx
[Codegen] push       %rbp
[Codegen] movq       0x8(%rsp), %rbp
[Codegen] movq       %rbp, %rcx
[Codegen] andl       $0x1f, %ebx
[Codegen] push       %rbx
[Codegen] xchgq      %rcx, %rbx
[Codegen] shll       %cl, %ebx
[Codegen] movq       %rbx, %rcx
[Codegen] pop        %rbx
[Codegen] movabsq    $0xfff8800000000000, %r11
[Codegen] orq        %r11, %rcx

and now generates:

[Codegen] emitInt32LeftShiftResult
[Codegen] push       %rcx
[Codegen] push       %rbp
[Codegen] movq       0x8(%rsp), %rbp
[Codegen] movq       %rbp, %rcx
[Codegen] andl       $0x1f, %ebx
[Codegen] xchgq      %rbx, %rcx
[Codegen] shll       %cl, %ebx
[Codegen] xchgq      %rbx, %rcx
[Codegen] movabsq    $0xfff8800000000000, %r11
[Codegen] orq        %r11, %rcx
Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3f8428b83795
Simplify flexible shift instructions. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: