Skip to content

Potentially wrong SIMD opcode generation in 0.17.2 #1551

Closed
@postspectacular

Description

@postspectacular

Hi all, I'm not sure if that's related to the recent Binaryen updates in 0.17.2, but the following code (which compiles just fine w/ all recent assemblyscript versions < 0.17.2) is now causing a validation error during compile and seemingly produces the wrong SIMD opcodes to begin with:

https://github.com/thi-ng/umbrella/blob/develop/packages/simd/assembly/abs.ts#L12

export function abs4_f32(
    out: usize,
    a: usize,
    num: usize,
    so: usize,
    sa: usize
): usize {
    so <<= 2;
    sa <<= 2;
    const res = out;
    for (; num-- > 0; ) {
        v128.store(out, f32x4.abs(v128.load(a)));
        out += so;
        a += sa;
    }
    return res;
}
[wasm-validator error in function assembly/abs/abs4_f32] i32 != v128: store value type must match, on 
[none] (v128.store
 [i32] (local.get $0)
 [i32] (i64x2.all_true
  [v128] (v128.load
   [i32] (local.get $1)
  )
 )
)
FAILURE validate error
    at Object.main (/Users/thing/umbrella/node_modules/assemblyscript/cli/asc.js:735:23)
    at /Users/thing/umbrella/node_modules/assemblyscript/bin/asc:21:47

Where is that i64x2.all_true op coming from here? Should be f32x4.abs...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions