diff --git a/src/builtins.ts b/src/builtins.ts index 810aea92e1..a31fed61b9 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -541,6 +541,8 @@ export namespace BuiltinNames { export const i16x8_extmul_low_i8x16_u = "~lib/builtins/i16x8.extmul_low_i8x16_u"; export const i16x8_extmul_high_i8x16_s = "~lib/builtins/i16x8.extmul_high_i8x16_s"; export const i16x8_extmul_high_i8x16_u = "~lib/builtins/i16x8.extmul_high_i8x16_u"; + export const i16x8_shuffle = "~lib/builtins/i16x8.shuffle"; + export const i16x8_swizzle = "~lib/builtins/i16x8.swizzle"; export const i32x4_splat = "~lib/builtins/i32x4.splat"; export const i32x4_extract_lane = "~lib/builtins/i32x4.extract_lane"; @@ -584,6 +586,8 @@ export namespace BuiltinNames { export const i32x4_extmul_low_i16x8_u = "~lib/builtins/i32x4.extmul_low_i16x8_u"; export const i32x4_extmul_high_i16x8_s = "~lib/builtins/i32x4.extmul_high_i16x8_s"; export const i32x4_extmul_high_i16x8_u = "~lib/builtins/i32x4.extmul_high_i16x8_u"; + export const i32x4_shuffle = "~lib/builtins/i32x4.shuffle"; + export const i32x4_swizzle = "~lib/builtins/i32x4.swizzle"; export const i64x2_splat = "~lib/builtins/i64x2.splat"; export const i64x2_extract_lane = "~lib/builtins/i64x2.extract_lane"; @@ -616,6 +620,8 @@ export namespace BuiltinNames { export const i64x2_extmul_low_i32x4_u = "~lib/builtins/i64x2.extmul_low_i32x4_u"; export const i64x2_extmul_high_i32x4_s = "~lib/builtins/i64x2.extmul_high_i32x4_s"; export const i64x2_extmul_high_i32x4_u = "~lib/builtins/i64x2.extmul_high_i32x4_u"; + export const i64x2_shuffle = "~lib/builtins/i64x2.shuffle"; + export const i64x2_swizzle = "~lib/builtins/i64x2.swizzle"; export const f32x4_splat = "~lib/builtins/f32x4.splat"; export const f32x4_extract_lane = "~lib/builtins/f32x4.extract_lane"; @@ -644,6 +650,8 @@ export namespace BuiltinNames { export const f32x4_convert_i32x4_s = "~lib/builtins/f32x4.convert_i32x4_s"; export const f32x4_convert_i32x4_u = "~lib/builtins/f32x4.convert_i32x4_u"; export const f32x4_demote_f64x2_zero = "~lib/builtins/f32x4.demote_f64x2_zero"; + export const f32x4_shuffle = "~lib/builtins/f32x4.shuffle"; + export const f32x4_swizzle = "~lib/builtins/f32x4.swizzle"; export const f64x2_splat = "~lib/builtins/f64x2.splat"; export const f64x2_extract_lane = "~lib/builtins/f64x2.extract_lane"; @@ -672,6 +680,8 @@ export namespace BuiltinNames { export const f64x2_convert_low_i32x4_s = "~lib/builtins/f64x2.convert_low_i32x4_s"; export const f64x2_convert_low_i32x4_u = "~lib/builtins/f64x2.convert_low_i32x4_u"; export const f64x2_promote_low_f32x4 = "~lib/builtins/f64x2.promote_low_f32x4"; + export const f64x2_shuffle = "~lib/builtins/f64x2.shuffle"; + export const f64x2_swizzle = "~lib/builtins/f64x2.swizzle"; export const i31_new = "~lib/builtins/i31.new"; export const i31_get = "~lib/builtins/i31.get"; @@ -8337,7 +8347,6 @@ builtins.set(BuiltinNames.i8x16_shuffle, builtin_i8x16_shuffle); // i8x16.swizzle -> v128.swizzle function builtin_i8x16_swizzle(ctx: BuiltinContext): ExpressionRef { - checkTypeAbsent(ctx); ctx.typeArguments = null; ctx.contextualType = Type.v128; return builtin_v128_swizzle(ctx); @@ -8758,6 +8767,23 @@ function builtin_i16x8_extmul_high_i8x16_u(ctx: BuiltinContext): ExpressionRef { } builtins.set(BuiltinNames.i16x8_extmul_high_i8x16_u, builtin_i16x8_extmul_high_i8x16_u); +// i16x8.shuffle -> v128.shuffle +function builtin_i16x8_shuffle(ctx: BuiltinContext): ExpressionRef { + checkTypeAbsent(ctx); + ctx.typeArguments = [ Type.i16 ]; + ctx.contextualType = Type.v128; + return builtin_v128_shuffle(ctx); +} +builtins.set(BuiltinNames.i16x8_shuffle, builtin_i16x8_shuffle); + +// i16x8.swizzle -> v128.swizzle +function builtin_i16x8_swizzle(ctx: BuiltinContext): ExpressionRef { + ctx.typeArguments = null; + ctx.contextualType = Type.v128; + return builtin_v128_swizzle(ctx); +} +builtins.set(BuiltinNames.i16x8_swizzle, builtin_i16x8_swizzle); + // i32x4.splat -> v128.splat function builtin_i32x4_splat(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx); @@ -9136,6 +9162,23 @@ function builtin_i32x4_extmul_high_i16x8_u(ctx: BuiltinContext): ExpressionRef { } builtins.set(BuiltinNames.i32x4_extmul_high_i16x8_u, builtin_i32x4_extmul_high_i16x8_u); +// i32x4.shuffle -> v128.shuffle +function builtin_i32x4_shuffle(ctx: BuiltinContext): ExpressionRef { + checkTypeAbsent(ctx); + ctx.typeArguments = [ Type.i32 ]; + ctx.contextualType = Type.v128; + return builtin_v128_shuffle(ctx); +} +builtins.set(BuiltinNames.i32x4_shuffle, builtin_i32x4_shuffle); + +// i32x4.swizzle -> v128.swizzle +function builtin_i32x4_swizzle(ctx: BuiltinContext): ExpressionRef { + ctx.typeArguments = null; + ctx.contextualType = Type.v128; + return builtin_v128_swizzle(ctx); +} +builtins.set(BuiltinNames.i32x4_swizzle, builtin_i32x4_swizzle); + // i64x2.splat -> v128.splat function builtin_i64x2_splat(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx); @@ -9379,6 +9422,23 @@ function builtin_i64x2_extmul_high_i32x4_u(ctx: BuiltinContext): ExpressionRef { } builtins.set(BuiltinNames.i64x2_extmul_high_i32x4_u, builtin_i64x2_extmul_high_i32x4_u); +// i64x2.shuffle -> v128.shuffle +function builtin_i64x2_shuffle(ctx: BuiltinContext): ExpressionRef { + checkTypeAbsent(ctx); + ctx.typeArguments = [ Type.i64 ]; + ctx.contextualType = Type.v128; + return builtin_v128_shuffle(ctx); +} +builtins.set(BuiltinNames.i64x2_shuffle, builtin_i64x2_shuffle); + +// i64x2.swizzle -> v128.swizzle +function builtin_i64x2_swizzle(ctx: BuiltinContext): ExpressionRef { + ctx.typeArguments = null; + ctx.contextualType = Type.v128; + return builtin_v128_swizzle(ctx); +} +builtins.set(BuiltinNames.i64x2_swizzle, builtin_i64x2_swizzle); + // f32x4.splat -> v128.splat function builtin_f32x4_splat(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx); @@ -9622,6 +9682,23 @@ function builtin_f32x4_demote_f64x2_zero(ctx: BuiltinContext): ExpressionRef { } builtins.set(BuiltinNames.f32x4_demote_f64x2_zero, builtin_f32x4_demote_f64x2_zero); +// f32x4.shuffle -> v128.shuffle +function builtin_f32x4_shuffle(ctx: BuiltinContext): ExpressionRef { + checkTypeAbsent(ctx); + ctx.typeArguments = [ Type.f32 ]; + ctx.contextualType = Type.v128; + return builtin_v128_shuffle(ctx); +} +builtins.set(BuiltinNames.f32x4_shuffle, builtin_f32x4_shuffle); + +// f32x4.swizzle -> v128.swizzle +function builtin_f32x4_swizzle(ctx: BuiltinContext): ExpressionRef { + ctx.typeArguments = null; + ctx.contextualType = Type.v128; + return builtin_v128_swizzle(ctx); +} +builtins.set(BuiltinNames.f32x4_swizzle, builtin_f32x4_swizzle); + // f64x2.splat -> v128.splat function builtin_f64x2_splat(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx); @@ -9865,6 +9942,23 @@ function builtin_f64x4_promote_low_f32x4(ctx: BuiltinContext): ExpressionRef { } builtins.set(BuiltinNames.f64x2_promote_low_f32x4, builtin_f64x4_promote_low_f32x4); +// f64x2.shuffle -> v128.shuffle +function builtin_f64x2_shuffle(ctx: BuiltinContext): ExpressionRef { + checkTypeAbsent(ctx); + ctx.typeArguments = [ Type.f64 ]; + ctx.contextualType = Type.v128; + return builtin_v128_shuffle(ctx); +} +builtins.set(BuiltinNames.f64x2_shuffle, builtin_f64x2_shuffle); + +// f64x2.swizzle -> v128.swizzle +function builtin_f64x2_swizzle(ctx: BuiltinContext): ExpressionRef { + ctx.typeArguments = null; + ctx.contextualType = Type.v128; + return builtin_v128_swizzle(ctx); +} +builtins.set(BuiltinNames.f64x2_swizzle, builtin_f64x2_swizzle); + // === Internal helpers ======================================================================= /** Compiles the `visit_globals` function. */ diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index 3cbe42a94c..6f27011722 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -1177,7 +1177,7 @@ export namespace v128 { // @ts-ignore: decorator @builtin - export declare function swizzle(a: v128, s: v128): v128; + export declare function swizzle(a: v128, b: v128): v128; // @ts-ignore: decorator @unsafe @builtin @@ -1647,7 +1647,7 @@ export namespace i8x16 { // @ts-ignore: decorator @builtin - export declare function swizzle(a: v128, s: v128): v128; + export declare function swizzle(a: v128, b: v128): v128; } // @ts-ignore: decorator @@ -1839,6 +1839,17 @@ export namespace i16x8 { // @ts-ignore: decorator @builtin export declare function extmul_high_i8x16_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function shuffle( + a: v128, b: v128, + l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8 + ): v128; + + // @ts-ignore: decorator + @builtin + export declare function swizzle(a: v128, b: v128): v128; } // @ts-ignore: decorator @@ -2014,6 +2025,14 @@ export namespace i32x4 { // @ts-ignore: decorator @builtin export declare function extmul_high_i16x8_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8): v128; + + // @ts-ignore: decorator + @builtin + export declare function swizzle(a: v128, b: v128): v128; } // @ts-ignore: decorator @@ -2129,6 +2148,14 @@ export namespace i64x2 { // @ts-ignore: decorator @builtin export declare function extmul_high_i32x4_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function shuffle(a: v128, b: v128, l0: u8, l1: u8): v128; + + // @ts-ignore: decorator + @builtin + export declare function swizzle(a: v128, b: v128): v128; } // @ts-ignore: decorator @@ -2244,6 +2271,14 @@ export namespace f32x4 { // @ts-ignore: decorator @builtin export declare function demote_f64x2_zero(a: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8): v128; + + // @ts-ignore: decorator + @builtin + export declare function swizzle(a: v128, b: v128): v128; } // @ts-ignore: decorator @@ -2359,6 +2394,14 @@ export namespace f64x2 { // @ts-ignore: decorator @builtin export declare function promote_low_f32x4(a: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function shuffle(a: v128, b: v128, l0: u8, l1: u8): v128; + + // @ts-ignore: decorator + @builtin + export declare function swizzle(a: v128, b: v128): v128; } @final diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index c10cf76a1e..69996d0cdf 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -1075,6 +1075,10 @@ declare namespace i16x8 { export function extmul_high_i8x16_s(a: v128, b: v128): v128; /** Performs the lane-wise 8-bit unsigned integer extended multiplication of the eight higher lanes producing twice wider 16-bit integer results. */ export function extmul_high_i8x16_u(a: v128, b: v128): v128; + /** Selects 16-bit lanes from either vector according to the specified [0-7] respectively [8-15] lane indexes. */ + export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8): v128; + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ + export function swizzle(a: v128, s: v128): v128; } /** Initializes a 128-bit vector from four 32-bit integer values. Arguments must be compile-time constants. */ declare function i32x4(a: i32, b: i32, c: i32, d: i32): v128; @@ -1163,6 +1167,10 @@ declare namespace i32x4 { export function extmul_high_i16x8_s(a: v128, b: v128): v128; /** Performs the lane-wise 16-bit unsigned integer extended multiplication of the four higher lanes producing twice wider 32-bit integer results. */ export function extmul_high_i16x8_u(a: v128, b: v128): v128; + /** Selects 32-bit lanes from either vector according to the specified [0-3] respectively [4-7] lane indexes. */ + export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8): v128; + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ + export function swizzle(a: v128, s: v128): v128; } /** Initializes a 128-bit vector from two 64-bit integer values. Arguments must be compile-time constants. */ declare function i64x2(a: i64, b: i64): v128; @@ -1221,6 +1229,10 @@ declare namespace i64x2 { export function extmul_high_i32x4_s(a: v128, b: v128): v128; /** Performs the lane-wise 32-bit unsigned integer extended multiplication of the two higher lanes producing twice wider 64-bit integer results. */ export function extmul_high_i32x4_u(a: v128, b: v128): v128; + /** Selects 64-bit lanes from either vector according to the specified [0-1] respectively [2-3] lane indexes. */ + export function shuffle(a: v128, b: v128, l0: u8, l1: u8): v128; + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ + export function swizzle(a: v128, s: v128): v128; } /** Initializes a 128-bit vector from four 32-bit float values. Arguments must be compile-time constants. */ declare function f32x4(a: f32, b: f32, c: f32, d: f32): v128; @@ -1279,6 +1291,10 @@ declare namespace f32x4 { export function convert_i32x4_u(a: v128): v128; /** Demotes each 64-bit float lane of a vector to single-precision. The higher lanes of the result are initialized to zero. */ export function demote_f64x2_zero(a: v128): v128; + /** Selects 32-bit lanes from either vector according to the specified [0-3] respectively [4-7] lane indexes. */ + export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8, l4: u8): v128; + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ + export function swizzle(a: v128, s: v128): v128; } /** Initializes a 128-bit vector from two 64-bit float values. Arguments must be compile-time constants. */ declare function f64x2(a: f64, b: f64): v128; @@ -1337,6 +1353,10 @@ declare namespace f64x2 { export function convert_low_i32x4_u(a: v128): v128; /** Promotes the low 32-bit float lanes of a vector to double-precision. */ export function promote_low_f32x4(a: v128): v128; + /** Selects 64-bit lanes from either vector according to the specified [0-1] respectively [2-3] lane indexes. */ + export function shuffle(a: v128, b: v128, l0: u8, l1: u8): v128; + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ + export function swizzle(a: v128, s: v128): v128; } declare abstract class i31 { diff --git a/tests/compiler/simd.debug.wat b/tests/compiler/simd.debug.wat index 9c34856ad8..ea7ac48daa 100644 --- a/tests/compiler/simd.debug.wat +++ b/tests/compiler/simd.debug.wat @@ -4049,6 +4049,44 @@ i32.const 0 i32.ne drop + local.get $0 + local.get $1 + i8x16.shuffle 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 + local.get $0 + local.get $1 + i8x16.shuffle 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 + i8x16.eq + i8x16.all_true + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 528 + i32.const 579 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i8x16.swizzle + local.get $0 + local.get $1 + i8x16.swizzle + i8x16.eq + i8x16.all_true + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 528 + i32.const 584 + i32.const 3 + call $~lib/builtins/abort + unreachable + end i32.const 16 call $~lib/rt/tlsf/__alloc local.set $7 @@ -4087,7 +4125,7 @@ if i32.const 0 i32.const 528 - i32.const 589 + i32.const 599 i32.const 5 call $~lib/builtins/abort unreachable @@ -4103,7 +4141,7 @@ if i32.const 0 i32.const 528 - i32.const 594 + i32.const 604 i32.const 5 call $~lib/builtins/abort unreachable @@ -4205,7 +4243,7 @@ if i32.const 0 i32.const 528 - i32.const 662 + i32.const 672 i32.const 3 call $~lib/builtins/abort unreachable @@ -4223,7 +4261,7 @@ if i32.const 0 i32.const 528 - i32.const 664 + i32.const 674 i32.const 3 call $~lib/builtins/abort unreachable @@ -4242,7 +4280,7 @@ if i32.const 0 i32.const 528 - i32.const 666 + i32.const 676 i32.const 3 call $~lib/builtins/abort unreachable @@ -4259,7 +4297,7 @@ if i32.const 0 i32.const 528 - i32.const 667 + i32.const 677 i32.const 3 call $~lib/builtins/abort unreachable @@ -4276,7 +4314,7 @@ if i32.const 0 i32.const 528 - i32.const 668 + i32.const 678 i32.const 3 call $~lib/builtins/abort unreachable @@ -4337,7 +4375,7 @@ if i32.const 0 i32.const 528 - i32.const 709 + i32.const 719 i32.const 3 call $~lib/builtins/abort unreachable @@ -4350,7 +4388,7 @@ if i32.const 0 i32.const 528 - i32.const 714 + i32.const 724 i32.const 3 call $~lib/builtins/abort unreachable @@ -4363,7 +4401,7 @@ if i32.const 0 i32.const 528 - i32.const 715 + i32.const 725 i32.const 3 call $~lib/builtins/abort unreachable @@ -4380,7 +4418,7 @@ if i32.const 0 i32.const 528 - i32.const 716 + i32.const 726 i32.const 3 call $~lib/builtins/abort unreachable @@ -4397,7 +4435,7 @@ if i32.const 0 i32.const 528 - i32.const 721 + i32.const 731 i32.const 3 call $~lib/builtins/abort unreachable @@ -4477,7 +4515,7 @@ if i32.const 0 i32.const 528 - i32.const 735 + i32.const 745 i32.const 3 call $~lib/builtins/abort unreachable @@ -4494,7 +4532,7 @@ if i32.const 0 i32.const 528 - i32.const 736 + i32.const 746 i32.const 3 call $~lib/builtins/abort unreachable @@ -4511,7 +4549,7 @@ if i32.const 0 i32.const 528 - i32.const 737 + i32.const 747 i32.const 3 call $~lib/builtins/abort unreachable @@ -4528,7 +4566,7 @@ if i32.const 0 i32.const 528 - i32.const 738 + i32.const 748 i32.const 3 call $~lib/builtins/abort unreachable @@ -4545,7 +4583,7 @@ if i32.const 0 i32.const 528 - i32.const 739 + i32.const 749 i32.const 3 call $~lib/builtins/abort unreachable @@ -4562,7 +4600,7 @@ if i32.const 0 i32.const 528 - i32.const 740 + i32.const 750 i32.const 3 call $~lib/builtins/abort unreachable @@ -4579,7 +4617,7 @@ if i32.const 0 i32.const 528 - i32.const 741 + i32.const 751 i32.const 3 call $~lib/builtins/abort unreachable @@ -4596,7 +4634,7 @@ if i32.const 0 i32.const 528 - i32.const 742 + i32.const 752 i32.const 3 call $~lib/builtins/abort unreachable @@ -4613,7 +4651,7 @@ if i32.const 0 i32.const 528 - i32.const 743 + i32.const 753 i32.const 3 call $~lib/builtins/abort unreachable @@ -4630,7 +4668,7 @@ if i32.const 0 i32.const 528 - i32.const 744 + i32.const 754 i32.const 3 call $~lib/builtins/abort unreachable @@ -4703,6 +4741,25 @@ i32.const 0 i32.ne drop + local.get $0 + local.get $1 + i8x16.shuffle 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 + local.get $0 + local.get $1 + i8x16.shuffle 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 + i8x16.eq + i8x16.all_true + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 528 + i32.const 769 + i32.const 3 + call $~lib/builtins/abort + unreachable + end i32.const 16 call $~lib/rt/tlsf/__alloc local.set $7 @@ -4729,7 +4786,7 @@ if i32.const 0 i32.const 528 - i32.const 765 + i32.const 780 i32.const 5 call $~lib/builtins/abort unreachable @@ -4745,7 +4802,7 @@ if i32.const 0 i32.const 528 - i32.const 770 + i32.const 785 i32.const 5 call $~lib/builtins/abort unreachable @@ -4845,7 +4902,7 @@ if i32.const 0 i32.const 528 - i32.const 804 + i32.const 819 i32.const 3 call $~lib/builtins/abort unreachable @@ -4863,7 +4920,7 @@ if i32.const 0 i32.const 528 - i32.const 806 + i32.const 821 i32.const 3 call $~lib/builtins/abort unreachable @@ -4882,7 +4939,7 @@ if i32.const 0 i32.const 528 - i32.const 808 + i32.const 823 i32.const 3 call $~lib/builtins/abort unreachable @@ -4899,7 +4956,7 @@ if i32.const 0 i32.const 528 - i32.const 809 + i32.const 824 i32.const 3 call $~lib/builtins/abort unreachable @@ -4916,7 +4973,7 @@ if i32.const 0 i32.const 528 - i32.const 810 + i32.const 825 i32.const 3 call $~lib/builtins/abort unreachable @@ -4932,7 +4989,7 @@ if i32.const 0 i32.const 528 - i32.const 811 + i32.const 826 i32.const 3 call $~lib/builtins/abort unreachable @@ -4945,7 +5002,7 @@ if i32.const 0 i32.const 528 - i32.const 816 + i32.const 831 i32.const 3 call $~lib/builtins/abort unreachable @@ -4958,7 +5015,7 @@ if i32.const 0 i32.const 528 - i32.const 817 + i32.const 832 i32.const 3 call $~lib/builtins/abort unreachable @@ -4975,7 +5032,7 @@ if i32.const 0 i32.const 528 - i32.const 818 + i32.const 833 i32.const 3 call $~lib/builtins/abort unreachable @@ -4992,7 +5049,7 @@ if i32.const 0 i32.const 528 - i32.const 823 + i32.const 838 i32.const 3 call $~lib/builtins/abort unreachable @@ -5065,7 +5122,7 @@ if i32.const 0 i32.const 528 - i32.const 837 + i32.const 852 i32.const 5 call $~lib/builtins/abort unreachable @@ -5081,7 +5138,7 @@ if i32.const 0 i32.const 528 - i32.const 842 + i32.const 857 i32.const 5 call $~lib/builtins/abort unreachable @@ -5461,7 +5518,7 @@ if i32.const 0 i32.const 528 - i32.const 915 + i32.const 930 i32.const 3 call $~lib/builtins/abort unreachable @@ -5479,7 +5536,7 @@ if i32.const 0 i32.const 528 - i32.const 917 + i32.const 932 i32.const 3 call $~lib/builtins/abort unreachable @@ -5498,7 +5555,7 @@ if i32.const 0 i32.const 528 - i32.const 919 + i32.const 934 i32.const 3 call $~lib/builtins/abort unreachable @@ -5515,7 +5572,7 @@ if i32.const 0 i32.const 528 - i32.const 920 + i32.const 935 i32.const 3 call $~lib/builtins/abort unreachable @@ -5532,7 +5589,7 @@ if i32.const 0 i32.const 528 - i32.const 921 + i32.const 936 i32.const 3 call $~lib/builtins/abort unreachable @@ -5553,7 +5610,7 @@ if i32.const 0 i32.const 528 - i32.const 923 + i32.const 938 i32.const 3 call $~lib/builtins/abort unreachable @@ -5570,7 +5627,7 @@ if i32.const 0 i32.const 528 - i32.const 924 + i32.const 939 i32.const 3 call $~lib/builtins/abort unreachable @@ -5586,7 +5643,7 @@ if i32.const 0 i32.const 528 - i32.const 925 + i32.const 940 i32.const 3 call $~lib/builtins/abort unreachable @@ -5599,7 +5656,7 @@ if i32.const 0 i32.const 528 - i32.const 926 + i32.const 941 i32.const 3 call $~lib/builtins/abort unreachable @@ -5612,7 +5669,7 @@ if i32.const 0 i32.const 528 - i32.const 927 + i32.const 942 i32.const 3 call $~lib/builtins/abort unreachable @@ -5629,7 +5686,7 @@ if i32.const 0 i32.const 528 - i32.const 928 + i32.const 943 i32.const 3 call $~lib/builtins/abort unreachable @@ -5646,7 +5703,7 @@ if i32.const 0 i32.const 528 - i32.const 933 + i32.const 948 i32.const 3 call $~lib/builtins/abort unreachable @@ -5677,7 +5734,7 @@ if i32.const 0 i32.const 528 - i32.const 942 + i32.const 957 i32.const 3 call $~lib/builtins/abort unreachable @@ -5694,7 +5751,7 @@ if i32.const 0 i32.const 528 - i32.const 943 + i32.const 958 i32.const 3 call $~lib/builtins/abort unreachable @@ -5711,7 +5768,7 @@ if i32.const 0 i32.const 528 - i32.const 944 + i32.const 959 i32.const 3 call $~lib/builtins/abort unreachable @@ -5728,7 +5785,7 @@ if i32.const 0 i32.const 528 - i32.const 945 + i32.const 960 i32.const 3 call $~lib/builtins/abort unreachable @@ -5745,7 +5802,7 @@ if i32.const 0 i32.const 528 - i32.const 946 + i32.const 961 i32.const 3 call $~lib/builtins/abort unreachable @@ -5762,7 +5819,7 @@ if i32.const 0 i32.const 528 - i32.const 947 + i32.const 962 i32.const 3 call $~lib/builtins/abort unreachable @@ -5779,7 +5836,7 @@ if i32.const 0 i32.const 528 - i32.const 948 + i32.const 963 i32.const 3 call $~lib/builtins/abort unreachable @@ -5796,7 +5853,7 @@ if i32.const 0 i32.const 528 - i32.const 949 + i32.const 964 i32.const 3 call $~lib/builtins/abort unreachable @@ -5812,7 +5869,7 @@ if i32.const 0 i32.const 528 - i32.const 950 + i32.const 965 i32.const 3 call $~lib/builtins/abort unreachable @@ -5879,7 +5936,7 @@ if i32.const 0 i32.const 528 - i32.const 977 + i32.const 992 i32.const 5 call $~lib/builtins/abort unreachable @@ -5897,7 +5954,7 @@ if i32.const 0 i32.const 528 - i32.const 981 + i32.const 996 i32.const 5 call $~lib/builtins/abort unreachable @@ -5941,7 +5998,7 @@ if i32.const 0 i32.const 528 - i32.const 997 + i32.const 1012 i32.const 3 call $~lib/builtins/abort unreachable @@ -5959,7 +6016,7 @@ if i32.const 0 i32.const 528 - i32.const 999 + i32.const 1014 i32.const 3 call $~lib/builtins/abort unreachable @@ -5978,7 +6035,7 @@ if i32.const 0 i32.const 528 - i32.const 1001 + i32.const 1016 i32.const 3 call $~lib/builtins/abort unreachable @@ -5995,7 +6052,7 @@ if i32.const 0 i32.const 528 - i32.const 1002 + i32.const 1017 i32.const 3 call $~lib/builtins/abort unreachable @@ -6012,7 +6069,7 @@ if i32.const 0 i32.const 528 - i32.const 1003 + i32.const 1018 i32.const 3 call $~lib/builtins/abort unreachable @@ -6033,7 +6090,7 @@ if i32.const 0 i32.const 528 - i32.const 1005 + i32.const 1020 i32.const 3 call $~lib/builtins/abort unreachable @@ -6050,7 +6107,7 @@ if i32.const 0 i32.const 528 - i32.const 1006 + i32.const 1021 i32.const 3 call $~lib/builtins/abort unreachable @@ -6066,7 +6123,7 @@ if i32.const 0 i32.const 528 - i32.const 1007 + i32.const 1022 i32.const 3 call $~lib/builtins/abort unreachable @@ -6079,7 +6136,7 @@ if i32.const 0 i32.const 528 - i32.const 1008 + i32.const 1023 i32.const 3 call $~lib/builtins/abort unreachable @@ -6092,7 +6149,7 @@ if i32.const 0 i32.const 528 - i32.const 1009 + i32.const 1024 i32.const 3 call $~lib/builtins/abort unreachable @@ -6109,7 +6166,7 @@ if i32.const 0 i32.const 528 - i32.const 1010 + i32.const 1025 i32.const 3 call $~lib/builtins/abort unreachable @@ -6126,7 +6183,7 @@ if i32.const 0 i32.const 528 - i32.const 1015 + i32.const 1030 i32.const 3 call $~lib/builtins/abort unreachable @@ -6157,7 +6214,7 @@ if i32.const 0 i32.const 528 - i32.const 1024 + i32.const 1039 i32.const 3 call $~lib/builtins/abort unreachable @@ -6174,7 +6231,7 @@ if i32.const 0 i32.const 528 - i32.const 1025 + i32.const 1040 i32.const 3 call $~lib/builtins/abort unreachable @@ -6191,7 +6248,7 @@ if i32.const 0 i32.const 528 - i32.const 1026 + i32.const 1041 i32.const 3 call $~lib/builtins/abort unreachable @@ -6208,7 +6265,7 @@ if i32.const 0 i32.const 528 - i32.const 1027 + i32.const 1042 i32.const 3 call $~lib/builtins/abort unreachable @@ -6225,7 +6282,7 @@ if i32.const 0 i32.const 528 - i32.const 1028 + i32.const 1043 i32.const 3 call $~lib/builtins/abort unreachable @@ -6242,7 +6299,7 @@ if i32.const 0 i32.const 528 - i32.const 1029 + i32.const 1044 i32.const 3 call $~lib/builtins/abort unreachable @@ -6259,7 +6316,7 @@ if i32.const 0 i32.const 528 - i32.const 1030 + i32.const 1045 i32.const 3 call $~lib/builtins/abort unreachable @@ -6276,7 +6333,7 @@ if i32.const 0 i32.const 528 - i32.const 1031 + i32.const 1046 i32.const 3 call $~lib/builtins/abort unreachable @@ -6292,7 +6349,7 @@ if i32.const 0 i32.const 528 - i32.const 1032 + i32.const 1047 i32.const 3 call $~lib/builtins/abort unreachable @@ -6345,7 +6402,7 @@ if i32.const 0 i32.const 528 - i32.const 1051 + i32.const 1066 i32.const 5 call $~lib/builtins/abort unreachable @@ -6363,7 +6420,7 @@ if i32.const 0 i32.const 528 - i32.const 1055 + i32.const 1070 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/simd.release.wat b/tests/compiler/simd.release.wat index 8ba8db8d1e..c2edfbc789 100644 --- a/tests/compiler/simd.release.wat +++ b/tests/compiler/simd.release.wat @@ -2051,7 +2051,7 @@ if i32.const 0 i32.const 1552 - i32.const 589 + i32.const 599 i32.const 5 call $~lib/builtins/abort unreachable @@ -2065,7 +2065,7 @@ if i32.const 0 i32.const 1552 - i32.const 594 + i32.const 604 i32.const 5 call $~lib/builtins/abort unreachable @@ -2103,7 +2103,7 @@ if i32.const 0 i32.const 1552 - i32.const 765 + i32.const 780 i32.const 5 call $~lib/builtins/abort unreachable @@ -2117,7 +2117,7 @@ if i32.const 0 i32.const 1552 - i32.const 770 + i32.const 785 i32.const 5 call $~lib/builtins/abort unreachable @@ -2149,7 +2149,7 @@ if i32.const 0 i32.const 1552 - i32.const 837 + i32.const 852 i32.const 5 call $~lib/builtins/abort unreachable @@ -2163,7 +2163,7 @@ if i32.const 0 i32.const 1552 - i32.const 842 + i32.const 857 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/simd.ts b/tests/compiler/simd.ts index e7c2acce90..4acb95b520 100644 --- a/tests/compiler/simd.ts +++ b/tests/compiler/simd.ts @@ -576,6 +576,16 @@ function test_i16x8(): void { assert(i16x8.extend_low_i8x16_u(i8x16.replace_lane(i8x16.splat(-1), 8, 0)) == i16x8.splat(255)); assert(i16x8.extend_high_i8x16_s(i8x16.replace_lane(i8x16.splat(-1), 0, 0)) == i16x8.splat(-1)); assert(i16x8.extend_high_i8x16_u(i8x16.replace_lane(i8x16.splat(-1), 0, 0)) == i16x8.splat(255)); + assert( + i16x8.shuffle(a, b, 0, 1, 2, 3, 12, 13, 14, 15) + == + v128.shuffle(a, b, 0, 1, 2, 3, 12, 13, 14, 15) + ); + assert( + i16x8.swizzle(a, b) + == + v128.swizzle(a, b) + ); { let ptr = __alloc(16); store(ptr, 1); @@ -756,6 +766,11 @@ function test_i32x4(): void { assert(i32x4.extend_low_i16x8_u(i16x8.replace_lane(i16x8.splat(-1), 4, 0)) == i32x4.splat(65535)); assert(i32x4.extend_high_i16x8_s(i16x8.replace_lane(i16x8.splat(-1), 0, 0)) == i32x4.splat(-1)); assert(i32x4.extend_high_i16x8_u(i16x8.replace_lane(i16x8.splat(-1), 0, 0)) == i32x4.splat(65535)); + assert( + i32x4.shuffle(a, b, 0, 1, 6, 7) + == + v128.shuffle(a, b, 0, 1, 6, 7) + ); { let ptr = __alloc(16); store(ptr, 1);