Closed Bug 1322450 Opened 8 years ago Closed 7 years ago

Wasm baseline: x86 byte stores do not always select byte register

Categories

(Core :: JavaScript Engine: JIT, defect, P1)

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: lth, Assigned: lth)

References

Details

Attachments

(1 file)

Test case is github.com/lars-t-hansen/embenchen/, see asm_v_wasm/wasm_box2d.js.  When storing 8 bytes from an i64 value the baseline compiler does properly consider whether the low register of the 64-bit pair has a byte personality.
No TC included, as I still hope to land the embenchen tests (with suitably low runtime) as test cases.
Attachment #8817342 - Flags: review?(bbouvier)
Priority: -- → P1
Here's a test case for you:

(module
    (memory 1)
    (func $run (param i64) (param i32) (param i32)
        get_local 1
        get_local 2
        i32.add

        get_local 1
        get_local 2
        i32.add

        i32.const 0
        get_local 0
        i64.store8

        drop
        drop
    )
    (export "run" $run)
)
Comment on attachment 8817342 [details] [diff] [review]
bug1322450-byte-reg.patch

Review of attachment 8817342 [details] [diff] [review]:
-----------------------------------------------------------------

Indeed. Thanks!

::: js/src/wasm/WasmBaselineCompile.cpp
@@ +3451,5 @@
>              masm.wasmStoreI64(access, src.i64(), dstAddr);
>          } else {
>              AnyRegister value;
>              if (src.tag == AnyReg::I64) {
> +                if (access.byteSize() == 1 && !singleByteRegs_.has(src.i64().low)) {

Could the code be rearranged so that there's only check that access.byteSize() == 1 and !singleByteRegs_.has(input)? This small duplication is a bit ugly here, but factoring out might introduce overhead, and any way works here, but asking just in case...
Attachment #8817342 - Flags: review?(bbouvier) → review+
(to be clear, I'd like that you embed the test in comment 2 in your patch, as part of the regression suite now, please)
https://hg.mozilla.org/integration/mozilla-inbound/rev/5291363eea76e7f75ac30d09119e911c4d3bfe56
Bug 1322450 - wasm baseline, use byte-capable register when storing one byte from 64-bit register. r=bbouvier
https://hg.mozilla.org/mozilla-central/rev/5291363eea76
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: