summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-21 11:53:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-21 11:53:14 -0800
commit1e53c3f4776ce442a63fdc9548b2cb9134813392 (patch)
tree2afd5a4377a96c4c43cb42889d435987e7c784d2 /src/asm2wasm.h
parent2532fb4f2ffac65e287f7a26a4b84e19a83f42e5 (diff)
downloadbinaryen-1e53c3f4776ce442a63fdc9548b2cb9134813392.tar.gz
binaryen-1e53c3f4776ce442a63fdc9548b2cb9134813392.tar.bz2
binaryen-1e53c3f4776ce442a63fdc9548b2cb9134813392.zip
support asm.js ceil
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 16ed0cf68..353f80413 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -197,6 +197,7 @@ private:
IString Math_fround;
IString Math_abs;
IString Math_floor;
+ IString Math_ceil;
IString Math_sqrt;
// function types. we fill in this information as we see
@@ -458,6 +459,10 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
assert(Math_floor.isNull());
Math_floor = name;
return;
+ } else if (imported[2] == CEIL) {
+ assert(Math_ceil.isNull());
+ Math_ceil = name;
+ return;
} else if (imported[2] == SQRT) {
assert(Math_sqrt.isNull());
Math_sqrt = name;
@@ -1126,12 +1131,12 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
abort();
}
}
- if (name == Math_floor || name == Math_sqrt) {
+ if (name == Math_floor || name == Math_sqrt || name == Math_ceil) {
// overloaded on type: f32 or f64
Expression* value = process(ast[2][0]);
if (value->type == f32 || value->type == f64) {
auto ret = allocator.alloc<Unary>();
- ret->op = name == Math_floor ? Floor : Sqrt;
+ ret->op = name == Math_floor ? Floor : name == Math_ceil ? Ceil : Sqrt;
ret->value = value;
ret->type = value->type;
return ret;