Skip to content

Commit

Permalink
feat: Implement relaxed SIMD operations (#2681)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 11, 2023
1 parent f7571a4 commit 77d0af2
Show file tree
Hide file tree
Showing 12 changed files with 1,322 additions and 179 deletions.
2 changes: 1 addition & 1 deletion cli/options.json
Expand Up @@ -221,14 +221,14 @@
" reference-types Reference types and operations.",
" gc Garbage collection (WIP).",
" stringref String reference types.",
" relaxed-simd Relaxed SIMD operations.",
""
],
"TODO_doesNothingYet": [
" exception-handling Exception handling.",
" tail-calls Tail call operations.",
" multi-value Multi value types.",
" memory64 Memory64 operations.",
" relaxed-simd Relaxed SIMD operations.",
" extended-const Extended const expressions."
],
"type": "S",
Expand Down
622 changes: 574 additions & 48 deletions src/builtins.ts

Large diffs are not rendered by default.

114 changes: 109 additions & 5 deletions std/assembly/builtins.ts
Expand Up @@ -1562,6 +1562,50 @@ export namespace v128 {
// @ts-ignore: decorator
@builtin
export declare function extmul_high<T>(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_swizzle(a: v128, s: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_trunc<T>(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_trunc_zero<T>(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_madd<T>(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_nmadd<T>(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_laneselect<T>(a: v128, b: v128, m: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_min<T>(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_max<T>(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_q15mulr<T>(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_dot<T>(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_dot_add<T>(a: v128, b: v128, c: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -1724,6 +1768,14 @@ export namespace i8x16 {
// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_swizzle(a: v128, s: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_laneselect(a: v128, b: v128, m: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -1925,7 +1977,15 @@ export namespace i16x8 {

// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;
export declare function relaxed_laneselect(a: v128, b: v128, m: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_q15mulr_s(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_dot_i8x16_i7x16_s(a: v128, b: v128, c: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -2108,7 +2168,27 @@ export namespace i32x4 {

// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;
export declare function relaxed_trunc_f32x4_s(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_trunc_f32x4_u(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_trunc_f64x2_s_zero(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_trunc_f64x2_u_zero(a: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_laneselect(a: v128, b: v128, m: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_dot_i8x16_i7x16_add_s(a: v128, b: v128, c: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -2231,7 +2311,7 @@ export namespace i64x2 {

// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;
export declare function relaxed_laneselect(a: v128, b: v128, m: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -2354,7 +2434,19 @@ export namespace f32x4 {

// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;
export declare function relaxed_madd(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_nmadd(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_min(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_max(a: v128, b: v128): v128;
}

// @ts-ignore: decorator
Expand Down Expand Up @@ -2477,7 +2569,19 @@ export namespace f64x2 {

// @ts-ignore: decorator
@builtin
export declare function swizzle(a: v128, b: v128): v128;
export declare function relaxed_madd(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_nmadd(a: v128, b: v128, c: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_min(a: v128, b: v128): v128;

// @ts-ignore: decorator
@builtin
export declare function relaxed_max(a: v128, b: v128): v128;
}

@final
Expand Down

0 comments on commit 77d0af2

Please sign in to comment.