aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parser.js8
-rw-r--r--tests/runner.py5
2 files changed, 8 insertions, 5 deletions
diff --git a/src/parser.js b/src/parser.js
index 299523cc..42613cb4 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -2167,22 +2167,24 @@ function JSify(data) {
case 'ult': case 'slt': return '0+(' + ident + ' < ' + ident2 + ')';
case 'ne': case 'une': return '0+(' + ident + ' != ' + ident2 + ')';
case 'eq': return '0+(' + ident + ' == ' + ident2 + ')';
+ default: throw 'Unknown icmp variant: ' + variant
}
}
case 'fcmp': {
switch (variant) {
case 'uge': case 'sge': return '0+(' + ident + ' >= ' + ident2 + ')';
case 'ule': case 'sle': return '0+(' + ident + ' <= ' + ident2 + ')';
- case 'ugt': case 'sgt': return '0+(' + ident + ' > ' + ident2 + ')';
- case 'ult': case 'slt': return '0+(' + ident + ' < ' + ident2 + ')';
+ case 'ugt': case 'sgt': case 'ogt': return '0+(' + ident + ' > ' + ident2 + ')';
+ case 'ult': case 'slt': case 'olt': return '0+(' + ident + ' < ' + ident2 + ')';
case 'ne': case 'une': return '0+(' + ident + ' != ' + ident2 + ')';
case 'eq': return '0+(' + ident + ' == ' + ident2 + ')';
+ default: throw 'Unknown fcmp variant: ' + variant
}
}
case 'zext': case 'fpext': case 'trunc': case 'sext': return ident;
case 'select': return '(' + ident + ' ? ' + ident3 + ' : ' + ident4 + ')';
+ default: throw 'Unknown mathcmp op: ' + item.op
}
- return '&*&*&*&*&*&' + item.op;
} });
/*
return [{
diff --git a/tests/runner.py b/tests/runner.py
index 4e550aba..d11487cf 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -159,11 +159,12 @@ class T(unittest.TestCase):
{
float x = 1.234, y = 3.5;
y *= 3;
- printf("*%d,%f,%d,%f\\n", int(y), y, (int)x, x);
+ int z = x < y;
+ printf("*%d,%d,%f,%d,%f\\n", z, int(y), y, (int)x, x);
return 0;
}
'''
- self.do_test(src, '*10,10.5,1,1.2339')
+ self.do_test(src, '*1,10,10.5,1,1.2339')
def test_if(self):
src = '''