Skip to content

clif: pattern-match to remove specialized SIMD instructions #3045

Closed
@abrown

Description

@abrown

Feature

As discussed in several places (e.g. here and here), several Wasm SIMD instructions can be translated to multiple, simpler CLIF instructions and then pattern-matched in the backend lowering.

Benefit

Removing specialized CLIF instructions would make things simpler for users of the builder API and somewhat simpler for maintainers. I feel this feature is more about making the CLIF ISA "nicer," which is a bit relative, but not unreasonable. The risk is that it actually complicates things ("one CLIF instruction per Wasm instruction" is also "nice") or that it slows down lowering.

Implementation

This would involve:

  • reviewing CLIF SIMD instructions to identify specialized instructions that can be replaced by pattern-matching: e.g., any instruction that involves widening/narrowing, conversion from signed to unsigned or vice versa, pairwise or low/high access, conversion from to from floats, etc.
  • replace those instructions in the lowerings with the pattern-matched version
  • remove unused instructions

Alternatives

Leave things as-is: some mixture of the "specialized CLIF instruction for a Wasm SIMD instruction" paradigm along with some of the "pattern-match several simpler CLIF instructions" paradigm.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions