WebAssembly / simd

Branch of the spec repo scoped to discussion of SIMD in WebAssembly
Other
531 stars 43 forks source link

i64x2.abs instruction #413

Closed Maratyszcza closed 3 years ago

Maratyszcza commented 3 years ago

Introduction

This is proposal to add 64-bit variant of existing abs instruction. ARM64 and x86 with AVX512 natively support this instruction, and on earlier instruction sets it can be emulated with 3-5 instructions.

Applications

Mapping to Common Instruction Sets

This section illustrates how the new WebAssembly instructions can be lowered on common instruction sets. However, these patterns are provided only for convenience, compliant WebAssembly implementations do not have to follow the same code generation patterns.

x86/x86-64 processors with AVX512F and AVX512VL instruction sets

x86/x86-64 processors with AVX instruction set

x86/x86-64 processors with SSE4.1 instruction set

x86/x86-64 processors with SSE2 instruction set

ARM64 processors

ARMv7 processors with NEON instruction set

jan-wassenberg commented 3 years ago

Strong support, I'm adding this to Highway as well. It would be much harder for users to emulate this, especially if we do not add sign select nor i64 gt_s.

dtig commented 3 years ago

Adding a preliminary vote for the inclusion of i64x2.abs operation to the SIMD proposal below. Please vote with -

👍 For including i64x2.abs 👎 Against including i64x2.abs

penzn commented 3 years ago

I do have an issue with examples here - they seem to be all wrapper libraries. It isn't surprising that wrapper libraries would ave all sorts of operations, but this isn't the same as an app somebody could run.

Maratyszcza commented 3 years ago

Fixed a bug in suggested lowering on SSE2 and ARM NEON (thanks @ngzhian for reporting).