Skip to content

Commit 39a99f0

Browse files
authored
fix: Support floats in SIMD load/store lane/zero (#1879)
1 parent 5427eb9 commit 39a99f0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/builtins.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,9 +4160,11 @@ function builtin_v128_load_zero(ctx: BuiltinContext): ExpressionRef {
41604160
if (type.isValue) {
41614161
switch (type.kind) {
41624162
case TypeKind.I32:
4163-
case TypeKind.U32: return module.simd_load(SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign);
4163+
case TypeKind.U32:
4164+
case TypeKind.F32: return module.simd_load(SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign);
41644165
case TypeKind.I64:
4165-
case TypeKind.U64: return module.simd_load(SIMDLoadOp.Load64Zero, arg0, immOffset, immAlign);
4166+
case TypeKind.U64:
4167+
case TypeKind.F64: return module.simd_load(SIMDLoadOp.Load64Zero, arg0, immOffset, immAlign);
41664168
case TypeKind.ISIZE:
41674169
case TypeKind.USIZE: return module.simd_load(compiler.options.isWasm64 ? SIMDLoadOp.Load64Zero : SIMDLoadOp.Load32Zero, arg0, immOffset, immAlign);
41684170
}
@@ -4233,9 +4235,11 @@ function builtin_v128_load_lane(ctx: BuiltinContext): ExpressionRef {
42334235
case TypeKind.I16:
42344236
case TypeKind.U16: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load16Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
42354237
case TypeKind.I32:
4236-
case TypeKind.U32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
4238+
case TypeKind.U32:
4239+
case TypeKind.F32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
42374240
case TypeKind.I64:
4238-
case TypeKind.U64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load64Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
4241+
case TypeKind.U64:
4242+
case TypeKind.F64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Load64Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
42394243
case TypeKind.ISIZE:
42404244
case TypeKind.USIZE: return module.simd_loadstorelane(compiler.options.isWasm64 ? SIMDLoadStoreLaneOp.Load64Lane : SIMDLoadStoreLaneOp.Load32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
42414245
}
@@ -4306,9 +4310,11 @@ function builtin_v128_store_lane(ctx: BuiltinContext): ExpressionRef {
43064310
case TypeKind.I16:
43074311
case TypeKind.U16: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store16Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
43084312
case TypeKind.I32:
4309-
case TypeKind.U32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
4313+
case TypeKind.U32:
4314+
case TypeKind.F32: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
43104315
case TypeKind.I64:
4311-
case TypeKind.U64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store64Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
4316+
case TypeKind.U64:
4317+
case TypeKind.F64: return module.simd_loadstorelane(SIMDLoadStoreLaneOp.Store64Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
43124318
case TypeKind.ISIZE:
43134319
case TypeKind.USIZE: return module.simd_loadstorelane(compiler.options.isWasm64 ? SIMDLoadStoreLaneOp.Store64Lane : SIMDLoadStoreLaneOp.Store32Lane, arg0, immOffset, immAlign, <u8>idx, arg1);
43144320
}

0 commit comments

Comments
 (0)