afonso360 opened issue #6600:
:wave: Hey,
Feature
Currently we don't have any special lowerings for the
ExtAddPairwise
family of WASM instructions, so we generate a quite poor implementation.Benefit
We can get better codegen on this backend for these instructions.
Implementation
cranelift-wasm
translates these asiadd_pairwise(uwiden_low(x), uwiden_high(y))
and similar variations.We use the generic
iadd_pairwise
implementation which is quite large, however with the widening instructions as an input, we can generate much better codegen.Since we know we are going to discard half of the input register elements, we can use a single
vrgather.vv
on each input to reshuffle them and then use avwadd.vv
to do the sum.This is pretty much what v8 emits for these instructions.
Alternatives
We don't need to do this. I also don't know how often these instructions get used in real code.
afonso360 labeled issue #6600:
:wave: Hey,
Feature
Currently we don't have any special lowerings for the
ExtAddPairwise
family of WASM instructions, so we generate a quite poor implementation.Benefit
We can get better codegen on this backend for these instructions.
Implementation
cranelift-wasm
translates these asiadd_pairwise(uwiden_low(x), uwiden_high(y))
and similar variations.We use the generic
iadd_pairwise
implementation which is quite large, however with the widening instructions as an input, we can generate much better codegen.Since we know we are going to discard half of the input register elements, we can use a single
vrgather.vv
on each input to reshuffle them and then use avwadd.vv
to do the sum.This is pretty much what v8 emits for these instructions.
Alternatives
We don't need to do this. I also don't know how often these instructions get used in real code.
afonso360 edited issue #6600:
:wave: Hey,
Feature
Currently we don't have any special lowerings for the
ExtAddPairwise
family of WASM instructions, so we generate a quite poor implementation.Benefit
We can get better codegen on this backend for these instructions.
Implementation
cranelift-wasm
translates these asiadd_pairwise(uwiden_low(x), uwiden_high(y))
and similar variations.We use the generic
iadd_pairwise
implementation which is quite large, however with the widening instructions as an input, we can generate much better codegen.Since we know we are going to discard half of the input register elements, we can use a single
vrgather.vv
on each input to reshuffle them and then use avwadd.vv
to do the sum.This is pretty much what v8 emits for these instructions.
Alternatives
We don't need to do this, the current lowerings are working as intended. I also don't know how often these instructions get used in real code.
afonso360 labeled issue #6600:
:wave: Hey,
Feature
Currently we don't have any special lowerings for the
ExtAddPairwise
family of WASM instructions, so we generate a quite poor implementation.Benefit
We can get better codegen on this backend for these instructions.
Implementation
cranelift-wasm
translates these asiadd_pairwise(uwiden_low(x), uwiden_high(y))
and similar variations.We use the generic
iadd_pairwise
implementation which is quite large, however with the widening instructions as an input, we can generate much better codegen.Since we know we are going to discard half of the input register elements, we can use a single
vrgather.vv
on each input to reshuffle them and then use avwadd.vv
to do the sum.This is pretty much what v8 emits for these instructions.
Alternatives
We don't need to do this, the current lowerings are working as intended. I also don't know how often these instructions get used in real code.
Last updated: Nov 22 2024 at 17:03 UTC