diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 11:15:37 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 13:00:50 -0700 |
commit | d32d18af61f4b9f83036d5573cad747607023bf7 (patch) | |
tree | ab6ec4f6ab016f3163bb284674f1b9ba9ae1f0f3 /src | |
parent | 023707026d9ce16e570c0297058aa71dda9c164b (diff) |
basic support for uint32x4
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 95eecc87..385482a7 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -325,7 +325,11 @@ function countNormalArgs(type, out, legalized) { } function getVectorBaseType(type) { - return type.substring(type.indexOf(' x ') + 3, type.length-1); + switch (type) { + case '<4 x float>': return 'float'; + case '<4 x i32>': return 'uint'; + default: throw 'unknown vector type ' + type; + } } function addIdent(token) { @@ -1782,6 +1786,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 '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 @@ -2335,10 +2340,10 @@ function processMathop(item) { if (type[0] === '<' && type[type.length-1] !== '*') { // vector/SIMD operation switch (op) { - case 'fadd': return 'SIMD.add(' + idents[0] + ',' + idents[1] + ')'; - case 'fsub': return 'SIMD.sub(' + idents[0] + ',' + idents[1] + ')'; - case 'fmul': return 'SIMD.mul(' + idents[0] + ',' + idents[1] + ')'; - case 'fdiv': return 'SIMD.div(' + idents[0] + ',' + idents[1] + ')'; + case 'add' : case 'fadd': return 'SIMD.add(' + idents[0] + ',' + idents[1] + ')'; + case 'sub' : case 'fsub': return 'SIMD.sub(' + idents[0] + ',' + idents[1] + ')'; + case 'mul' : case 'fmul': return 'SIMD.mul(' + idents[0] + ',' + idents[1] + ')'; + case 'udiv': case 'fdiv': return 'SIMD.div(' + idents[0] + ',' + idents[1] + ')'; default: throw 'vector op todo: ' + dump(item); } } |