diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 13:37:41 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 13:37:41 -0700 |
commit | 6129173723073d36b21047be1cd3dc0e58490c19 (patch) | |
tree | fc6546cf4fb908d94c1d9f8282f606a693aae604 | |
parent | b89290b3456bd125b468391537487cbd2fd6f32e (diff) |
vector bitcasts
-rw-r--r-- | src/parseTools.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index aeb85426..4988f766 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -2363,6 +2363,18 @@ function processMathop(item) { 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] + ')'; + case 'bitcast': { + var inType = item.params[0].type; + var outType = item.type; + if (inType === '<4 x float>') { + assert(outType === '<4 x i32>'); + return 'SIMD.float32x4BitsToUint32x4(' + idents[0] + ')'; + } else { + assert(inType === '<4 x i32>'); + assert(outType === '<4 x float>'); + return 'SIMD.uint32x4BitsToFloat32x4(' + idents[0] + ')'; + } + } default: throw 'vector op todo: ' + dump(item); } } |