From f68c193f5df2632e247ad151ed83a36f719be934 Mon Sep 17 00:00:00 2001 From: dcode Date: Tue, 1 Jun 2021 15:53:32 +0200 Subject: [PATCH 1/2] Support floats in SIMD load/store lane --- src/builtins.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/builtins.ts b/src/builtins.ts index b47284e9a5..0410fcdebc 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -4233,9 +4233,11 @@ function builtin_v128_load_lane(ctx: BuiltinContext): ExpressionRef { case TypeKind.I16: case TypeKind.U16: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load16Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.I32: - case TypeKind.U32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, idx, arg1); + case TypeKind.U32: + case TypeKind.F32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.I64: - case TypeKind.U64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load64Lane, arg0, immOffset, immAlign, idx, arg1); + case TypeKind.U64: + case TypeKind.F64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load64Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.ISIZE: case TypeKind.USIZE: return module.simd_loadstorelane(compiler.options.isWasm64 ? SIMDLoadStoreLaneOp.Load64Lane : SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, idx, arg1); } @@ -4306,9 +4308,11 @@ function builtin_v128_store_lane(ctx: BuiltinContext): ExpressionRef { case TypeKind.I16: case TypeKind.U16: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store16Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.I32: - case TypeKind.U32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, idx, arg1); + case TypeKind.U32: + case TypeKind.F32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.I64: - case TypeKind.U64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store64Lane, arg0, immOffset, immAlign, idx, arg1); + case TypeKind.U64: + case TypeKind.F64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store64Lane, arg0, immOffset, immAlign, idx, arg1); case TypeKind.ISIZE: case TypeKind.USIZE: return module.simd_loadstorelane(compiler.options.isWasm64 ? SIMDLoadStoreLaneOp.Store64Lane : SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, idx, arg1); } From 44dcc383b0eb5664e0224fd674a68f849efaaed2 Mon Sep 17 00:00:00 2001 From: dcode Date: Tue, 1 Jun 2021 15:58:44 +0200 Subject: [PATCH 2/2] same goes for load_zero --- src/builtins.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/builtins.ts b/src/builtins.ts index 0410fcdebc..31ddd9c42f 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -4160,9 +4160,11 @@ function builtin_v128_load_zero(ctx: BuiltinContext): ExpressionRef { if (type.isValue) { switch (type.kind) { case TypeKind.I32: - case TypeKind.U32: return module.simd_load(SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign); + case TypeKind.U32: + case TypeKind.F32: return module.simd_load(SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign); case TypeKind.I64: - case TypeKind.U64: return module.simd_load(SIMDLoadOp.Load64Zero, arg0, immOffset, immAlign); + case TypeKind.U64: + case TypeKind.F64: return module.simd_load(SIMDLoadOp.Load64Zero, arg0, immOffset, immAlign); case TypeKind.ISIZE: case TypeKind.USIZE: return module.simd_load(compiler.options.isWasm64 ? SIMDLoadOp.Load64Zero : SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign); }