Stream: git-wasmtime

Topic: wasmtime / issue #2906 Cranelift: iconst.i128 stores the ...


view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:06):

afonso360 labeled issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then get wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:06):

afonso360 opened issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then get wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:06):

afonso360 labeled issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then get wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:17):

afonso360 edited issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then get wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:17):

afonso360 edited issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then gets wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 13:35):

bjorn3 commented on issue #2906:

I am suprised that the new backend supports iconst.i128 at all. I use iconst.i64+iconcat for constructing i128 values in cg_clif.

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 15:52):

abrown commented on issue #2906:

I was trying to refactor the handling of immediates over in #2468, mainly from the vector perspective, but I think this could be fixed there as well. Unfortunately, I let that PR languish for a few months so I will have to revive it to fix this, unless someone here wants to pick it up.

view this post on Zulip Wasmtime GitHub notifications bot (May 14 2021 at 17:18):

afonso360 commented on issue #2906:

Let me try to pick that up. Lets see how it goes

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2022 at 15:25):

afonso360 commented on issue #2906:

Fixed in #5075

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2022 at 15:25):

afonso360 closed issue #2906:

When implmenting i128 support for aarch64 I found that iconst is not correctly storing i128 values on x86_64.

It looks like the issue is that we store constants as u64's in machineinst/lower.rs, which then gets wrongly lowered to i128's.

.clif Test Case

test run
target x86_64

function %i128_const_neg_1() -> i64, i64 {
block0:
    v1 = iconst.i128 -1
    v2, v3 = isplit v1
    return v2, v3
}
; run: %i128_const_neg_1() == [0xffffffff_ffffffff, 0xffffffff_ffffffff]

Steps to Reproduce

clif-util test ./the_above.clif

Expected Results

Returns [-1, -1]

Actual Results

Returns [-1, 0]

Versions and Environment

Cranelift version or commit: e676589b0c6e8228c421e18249d4635eb6c4bbe4 (main as of writing this)

Operating system: Windows 10 19042.928

Architecture: x86_64


Last updated: Dec 23 2024 at 12:05 UTC