summaryrefslogtreecommitdiff
path: root/src/type.h
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2020-03-25 12:43:23 -0700
committerGitHub <noreply@github.com>2020-03-25 12:43:23 -0700
commit1f397a3c829869f23ae0ff3e311d22f12d8c72a9 (patch)
tree870b00e154c59c3f79ffe9f5b8ec7b0903c8241d /src/type.h
parentd8771ed54edc85ee71e69b835cdaab57bd2722f4 (diff)
downloadwabt-1f397a3c829869f23ae0ff3e311d22f12d8c72a9.tar.gz
wabt-1f397a3c829869f23ae0ff3e311d22f12d8c72a9.tar.bz2
wabt-1f397a3c829869f23ae0ff3e311d22f12d8c72a9.zip
Update testsuite (for SIMD) (#1373)
Lots of changes necessary to make this work, as well as some bug fixes. The main change is allowing `nan:canonical` and `nan:arithmetic` as a possible value for each lane of a `v128`. This needs to propogate through the parser, IR, the JSON format, and the spec interpreter. This also changes the format of the spec JSON file, where a SIMD value is now stored as a list of values instead of a single u128: ``` {"type": "v128", "lane_type": "i32", "value": ["0", "0", "0", "0"]} ``` Since the lane type can be `i8` and `i16`, these types can now be used in more places (not just the decompiler). They'll be used for the GC proposal too (for packed values), so I've updated them to use the binary value specified for that proposal. Here are the actual SIMD fixes: * SIMD lanes are malformed if they don't match the binary format, but invalid if they are smaller than the lane width. For example, `i8x16.extract_lane_s` is malformed if the lane is >= 256, because the lane is stored as a byte. But it is invalid if the lane is >= 16. * The `i8x16.narrow_i16x8_u`, `i16x8.narrow_i32x4_u` and `i64x2.load_32x2_u` instructions were not handling sign-extension propoerly. TODO: This code is pretty clumsy now; it would be better to have a universal `Value` and `ExpectedValue` that can be used everywhere, so the logic doesn't need to be duplicated.
Diffstat (limited to 'src/type.h')
-rw-r--r--src/type.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/type.h b/src/type.h
index 2a7597ae..fb51e013 100644
--- a/src/type.h
+++ b/src/type.h
@@ -36,6 +36,8 @@ class Type {
F32 = -0x03, // 0x7d
F64 = -0x04, // 0x7c
V128 = -0x05, // 0x7b
+ I8 = -0x06, // 0x7a : packed-type only, used in gc and as v128 lane
+ I16 = -0x07, // 0x79 : packed-type only, used in gc and as v128 lane
Funcref = -0x10, // 0x70
Anyref = -0x11, // 0x6f
Nullref = -0x12, // 0x6e
@@ -48,9 +50,7 @@ class Type {
Any = 0, // Not actually specified, but useful for type-checking
Hostref = 2, // Not actually specified, but used in testing and type-checking
- I8 = 3, // Not actually specified, but used internally with load/store
I8U = 4, // Not actually specified, but used internally with load/store
- I16 = 5, // Not actually specified, but used internally with load/store
I16U = 6, // Not actually specified, but used internally with load/store
I32U = 7, // Not actually specified, but used internally with load/store
};
@@ -78,6 +78,8 @@ class Type {
case Type::F32: return "f32";
case Type::F64: return "f64";
case Type::V128: return "v128";
+ case Type::I8: return "i8";
+ case Type::I16: return "i16";
case Type::Funcref: return "funcref";
case Type::Func: return "func";
case Type::Exnref: return "exnref";