Stream: git-wasmtime

Topic: wasmtime / PR #9214 riscv64/x390: add *_overflow


view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2024 at 07:18):

ghostway0 opened PR #9214 from ghostway0:ghostway/9186 to bytecodealliance:main:

currently a draft and only riscv64

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2024 at 15:56):

ghostway0 updated PR #9214.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2024 at 17:23):

ghostway0 updated PR #9214.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2024 at 18:34):

ghostway0 updated PR #9214.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2024 at 14:08):

ghostway0 commented on PR #9214:

@bjorn3 can you take a look? also, I haven't found umul equivalent (or mul with zext*) in s390x. do you know what are their names?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2024 at 14:09):

ghostway0 updated PR #9214.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 19 2024 at 13:28):

uweigand commented on PR #9214:

Hi @ghostway0, a few comments on the s390x part:

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

Ditto here

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

It might be better to use rv_sltu here instead of a select between one and zero. The RISC-V comparision functions already return a zero or one, and they are a lot shorter than our current implementation of select_xreg

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

It might be better to use rv_snez here instead of a select between one and zero.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

Same here

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 submitted PR review:

:wave: Hey,

I don't know if this is ready for review yet, but It's a great start!

A few comments for the RISC-V part. I didn't check the lowerings in a lot of detail, mostly just spotting a few things that could be shorter.

Thanks for working on this!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

Ditto here for sltu.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

This one doesn't seem to be used anywhere, similarly in the rules below there are a few one unused instructions.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

This one doesn't seem to be used anywhere.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

This could also be a snez

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

This could also be replaced with a sltu instruction which is a shorter sequence than a full select.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

Instead of doing madd here, we can just multiply x_lo and y_lo and save one instruction.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

We could replace this with a snez instruction

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:58):

afonso360 created PR review comment:

Here we could use mul instead of madd and save one instruction.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:59):

afonso360 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2024 at 19:59):

afonso360 edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 22 2024 at 13:15):

afonso360 submitted PR review:

:wave: Hey,

I don't know if this is ready for review yet, but It's a great start!

A few comments for the RISC-V part. I didn't check the lowerings in a lot of detail, mostly just spotting a few things that could be shorter.

Thanks for working on this!

Edit: I also ran the fuzzer (with these changes) and it pointed out this testcase.

<details>

<summary>Fuzzer testcase</summary>

Testcase:

test interpret
test run
target riscv64gc
target x86_64

function %a(i8) -> i8 {
block0(v0: i8):
    v1, v2 = smul_overflow v0, v0
    return v2
}
; run: %a(-15) == 1

Result:

 ERROR cranelift_filetests::concurrent > FAIL: run
FAIL ./test.clif: run

Caused by:
    Failed test: run: %a(-15) == 1, actual: 0
1 tests
Error: 1 failure

</summary>


Last updated: Nov 22 2024 at 16:03 UTC