Skip to content

Commit

Permalink
fix: Fix SIMD Store Lane signatures (#2697)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 28, 2023
1 parent e28f536 commit a0c27fa
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 153 deletions.
4 changes: 2 additions & 2 deletions src/builtins.ts
Expand Up @@ -4916,7 +4916,7 @@ function builtin_v128_load_lane(ctx: BuiltinFunctionContext): ExpressionRef {
}
builtinFunctions.set(BuiltinNames.v128_load_lane, builtin_v128_load_lane);

// v128.store_lane<TFrom!>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize) -> v128
// v128.store_lane<TFrom!>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize) -> void
function builtin_v128_store_lane(ctx: BuiltinFunctionContext): ExpressionRef {
let compiler = ctx.compiler;
let module = compiler.module;
Expand Down Expand Up @@ -4958,7 +4958,7 @@ function builtin_v128_store_lane(ctx: BuiltinFunctionContext): ExpressionRef {
}
}
}
compiler.currentType = Type.v128;
compiler.currentType = Type.void;
if (type.isValue) {
let maxIdx = (16 / assert(type.byteSize)) - 1;
if (idx < 0 || idx > maxIdx) {
Expand Down
10 changes: 5 additions & 5 deletions std/assembly/builtins.ts
Expand Up @@ -1273,7 +1273,7 @@ export namespace v128 {

// @ts-ignore: decorator
@unsafe @builtin
export declare function store_lane<TFrom>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export declare function store_lane<TFrom>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;

// @ts-ignore: decorator
@builtin
Expand Down Expand Up @@ -1345,19 +1345,19 @@ export namespace v128 {

// @ts-ignore: decorator
@unsafe @builtin
export declare function store8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;
export declare function store8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): void;

// @ts-ignore: decorator
@unsafe @builtin
export declare function store16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;
export declare function store16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): void;

// @ts-ignore: decorator
@unsafe @builtin
export declare function store32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;
export declare function store32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): void;

// @ts-ignore: decorator
@unsafe @builtin
export declare function store64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;
export declare function store64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): void;

// @ts-ignore: decorator
@unsafe @builtin
Expand Down
10 changes: 5 additions & 5 deletions std/assembly/index.d.ts
Expand Up @@ -808,7 +808,7 @@ declare namespace v128 {
/** Loads a single lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
export function load_lane<T>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
/** Stores the single lane at the specified index of the given vector to memory. */
export function store_lane<T>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export function store_lane<T>(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;
/** Creates a vector with eight 16-bit integer lanes by loading and sign extending eight 8-bit integers. */
export function load8x8_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;
/** Creates a vector with eight 16-bit integer lanes by loading and zero extending eight 8-bit integers. */
Expand Down Expand Up @@ -844,13 +844,13 @@ declare namespace v128 {
/** Loads a single 64-bit lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
export function load64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
/** Stores the 8-bit lane at the specified lane of the given vector to memory. */
export function store8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export function store8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;
/** Stores the 16-bit lane at the specified lane of the given vector to memory. */
export function store16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export function store16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;
/** Stores the 32-bit lane at the specified lane of the given vector to memory. */
export function store32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export function store32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;
/** Stores the 64-bit lane at the specified lane of the given vector to memory. */
export function store64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;
export function store64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): void;
/** Stores a vector to memory. */
export function store(ptr: usize, value: v128, immOffset?: usize, immAlign?: usize): void;
/** Adds each lane. */
Expand Down

0 comments on commit a0c27fa

Please sign in to comment.