Bug 136569 - offlineasm generates suboptimal code for load/store on ARM64
Summary: offlineasm generates suboptimal code for load/store on ARM64
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-05 03:16 PDT by Akos Kiss
Modified: 2014-09-10 16:57 PDT (History)
4 users (show)

See Also:


Attachments
Proposed patch. (3.41 KB, patch)
2014-09-05 04:33 PDT, Akos Kiss
msaboff: review+
Details | Formatted Diff | Diff
Updated patch (3.42 KB, patch)
2014-09-10 15:37 PDT, Akos Kiss
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Akos Kiss 2014-09-05 03:16:13 PDT
For every load/store instruction, where the address is in the form of base + offset, and the offset is out of range -255..4095, the ARM64 backend applies the standard risc lowering. That is, as the documentation of riscLowerMalformedAddresses describes:

loadp 10000[foo], bar

will become

move 10000, tmp
addp foo, tmp
loadp 0[tmp], bar

Which, in ARM64, means that, e.g.,

storep cfr, VM::topVMEntryFrame[vm]

becomes

movz x17, #45424, lsl #0
add x17, x17, x1
str x29, [x17, #0]

However, ARM64 can do better:

movz x17, #45424, lsl #0
str x29, [x1, x17, lsl #0]

This would achieve the same result with less instructions.
Comment 1 Akos Kiss 2014-09-05 04:33:42 PDT
Created attachment 237682 [details]
Proposed patch.
Comment 2 Michael Saboff 2014-09-10 14:06:14 PDT
Comment on attachment 237682 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=237682&action=review

r=me

> Source/JavaScriptCore/ChangeLog:10
> +        base to the temporary, and the change the load/store to use the

"the change" -> "then change"

> Source/JavaScriptCore/ChangeLog:13
> +        perform explicit register additons but it is enough to change load/store

Typo: "additions"
Comment 3 Michael Saboff 2014-09-10 14:07:48 PDT
Comment on attachment 237682 [details]
Proposed patch.

r=me
Comment 4 Akos Kiss 2014-09-10 15:37:27 PDT
Created attachment 237911 [details]
Updated patch

Typos fixed.
Comment 5 Michael Saboff 2014-09-10 16:00:25 PDT
Comment on attachment 237911 [details]
Updated patch

r=me.
Comment 6 WebKit Commit Bot 2014-09-10 16:57:48 PDT
Comment on attachment 237911 [details]
Updated patch

Clearing flags on attachment: 237911

Committed r173497: <http://trac.webkit.org/changeset/173497>
Comment 7 WebKit Commit Bot 2014-09-10 16:57:51 PDT
All reviewed patches have been landed.  Closing bug.