aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-07 15:16:54 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-08 18:28:30 -0400
commitb4655b4088a51484e86cf738f2d3494cad473636 (patch)
tree2a6f43994ef3f60327af9a6a3066f616f0b6bb74 /src
parent0e4520e0227f23316175ee9de9edb5c867859e8a (diff)
explicit mathop node in legalizer end case
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 898649d5..7770cfdf 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -872,10 +872,17 @@ function analyzer(data, sidePass) {
}
if (targetBits <= 32) {
// We are generating a normal legal type here
- legalValue = {
- intertype: 'value',
- ident: targetElements[0].ident + (targetBits < 32 ? '&' + (Math.pow(2, targetBits)-1) : ''),
- type: 'rawJS'
+ legalValue = { intertype: 'value', ident: targetElements[0].ident, type: 'i32' };
+ if (targetBits < 32) {
+ legalValue = {
+ intertype: 'mathop',
+ op: 'and',
+ type: 'i32',
+ params: [
+ legalValue,
+ { intertype: 'value', ident: (Math.pow(2, targetBits)-1).toString(), type: 'i32' }
+ ]
+ }
};
legalValue.assignTo = item.assignTo;
toAdd.push(legalValue);