Stream: git-wasmtime

Topic: wasmtime / PR #7131 riscv64: Add another pattern for load...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:23):

alexcrichton opened PR #7131 from alexcrichton:rv64-more-constants to bytecodealliance:main:

Currently any 32-bit constant can be materialized without a load from a constant pool on RISCV-64 but once constants start getting larger than this they're always loaded from the constant pool. This commit adds another special case for loading constants which appears to match what LLVM does which is to consider materializing a smaller constant and than shifting it left.

This is done by chopping off all trailing zeros from an immediate and then testing if the immediate can be materialized as a 32-bit constant. This means that the current constant loading sequence can optionally be followed by a trailing slli instruction to shift the zeros back into the constant. This namely means that loading i64::MIN (1 << 63) no longer falls back to the constant pool.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:23):

alexcrichton requested elliottt for a review on PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:23):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 20:23):

alexcrichton requested afonso360 for a review on PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 21:54):

afonso360 submitted PR review:

LGTM! :+1:

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 22:45):

alexcrichton updated PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2023 at 22:45):

alexcrichton has enabled auto merge for PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 00:10):

alexcrichton merged PR #7131.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 10:06):

a1phyr submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 10:06):

a1phyr created PR review comment:

lui accepts 20 bits immediates so this could probably be optimized further:

   lui a0, 0xffff
   slli a0, a0, 0x14

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 10:28):

afonso360 created PR review comment:

Oh right, that's a good catch! Since we always test materializing the immediate at position 0, there could be another shift amount that would produce a better immediate generation sequence.

I wonder how we could better match these other cases.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 10:28):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 14:43):

a1phyr submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 03 2023 at 14:43):

a1phyr created PR review comment:

Opened #7139


Last updated: Nov 22 2024 at 17:03 UTC