Skip to content

Experimental cmp+select instruction fusion #1491

@Robbepop

Description

@Robbepop

Currently Wasmi only fuses comparison (such as i32.eq, f64.lt) and conditional branch instructions (such as if and br_if) together.
This led to a huge speed-up in interpreter performance due to Wasmi having to execute fewer instructions and having to perform fewer stack accesses.

For Wasm's select instructions Wasmi currently already has quite a few instruction variants, mostly to deal with true_val and false_val immediate values.

This issue tracks progress and evaluates the idea to re-design Wasmi's select intruction to allow for fusing it with comparison instructions similar to the existing cmp+branch op-fusion.

This new design necessitates to no longer care about true_val and false_val immediates and simply allocate immediate values there as function local constants. So we end up with the following set of select instruction variants:

  • select_{i32,i64}_{eq,ne,and,or,xor,nand,nor,xnor}
  • select_{i32,i64}_{lt,le}_{s,u}
  • select_{f32,f64}_{eq,ne,lt,le,not_lt,not_le}

Metadata

Metadata

Assignees

No one assigned

    Labels

    researchResearch intense work item.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions