diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-29 17:58:09 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-29 17:58:09 -0700 |
commit | c45cd7c72a019f54b0f6ee873641200ecb043a25 (patch) | |
tree | c33e9da60e6c7e64a68e2cf8e5f70a6c4d250a74 /src/parseTools.js | |
parent | 4af62232d03bd71db0f1ec907ff2a52ecef2f5d9 (diff) |
clean up simd code, fix uint32x4 heap offsets, and add testing
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 223adbbf..16f4058c 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -328,28 +328,29 @@ function getVectorSize(type) { return parseInt(type.substring(1, type.indexOf(' '))); } -function getVectorBaseType(type) { +function getVectorNativeType(type) { Types.usesSIMD = true; switch (type) { case '<2 x float>': case '<4 x float>': return 'float'; case '<2 x i32>': - case '<4 x i32>': return 'uint'; + case '<4 x i32>': return 'i32'; default: throw 'unknown vector type ' + type; } } -function getVectorNativeType(type) { - Types.usesSIMD = true; +function getSIMDName(type) { switch (type) { - case '<2 x float>': - case '<4 x float>': return 'float'; - case '<2 x i32>': - case '<4 x i32>': return 'i32'; - default: throw 'unknown vector type ' + type; + case 'i32': return 'uint'; + case 'float': return 'float'; + default: throw 'getSIMDName ' + type; } } +function getVectorBaseType(type) { + return getSIMDName(getVectorNativeType(type)); +} + function addIdent(token) { token.ident = token.text; return token; @@ -1807,7 +1808,7 @@ function makeGetSlabs(ptr, type, allowMultiple, unsigned) { switch(type) { case 'i1': case 'i8': return [unsigned ? 'HEAPU8' : 'HEAP8']; break; case 'i16': return [unsigned ? 'HEAPU16' : 'HEAP16']; break; - case '<4 x i32>': case 'uint': + case '<4 x i32>': case 'i32': case 'i64': return [unsigned ? 'HEAPU32' : 'HEAP32']; break; case 'double': { if (TARGET_LE32) return ['HEAPF64']; // in le32, we do have the ability to assume 64-bit alignment |