aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-10 11:43:30 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-10 11:43:30 -0700
commit34e9973bcb1c917acdc3b61e72bc583556d115ea (patch)
tree2babd94bfd584441473b967c7fcff3a690671c96 /lib
parentb04c754c0294d84e85d3546b7c2ef5e0de86c726 (diff)
update float ffi rules
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/JSBackend/CallHandlers.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h
index e1e8cbb46f..8ae8c26c1d 100644
--- a/lib/Target/JSBackend/CallHandlers.h
+++ b/lib/Target/JSBackend/CallHandlers.h
@@ -101,8 +101,14 @@ DEF_CALL_HANDLER(__default__, {
}
if (NumArgs > 0) text += ",";
}
- // this is an ffi call if we need casts, and it is not a Math_ builtin (with just 1 arg - Math with more args is different XXX)
- bool FFI = NeedCasts && (NumArgs > 1 || Name.find("Math_") != 0);
+ // this is an ffi call if we need casts, and it is not a special Math_ builtin
+ bool FFI = NeedCasts;
+ if (FFI && Name.find("Math_") == 0) {
+ if (Name == "Math_ceil" || Name == "Math_floor" || Name == "Math_min" || Name == "Math_max" || Name == "Math_sqrt" || Name == "Math_abs") {
+ // This special Math builtin is optimizable with all types, including floats, so can treat it as non-ffi
+ FFI = false;
+ }
+ }
unsigned FFI_OUT = FFI ? ASM_FFI_OUT : 0;
for (int i = 0; i < NumArgs; i++) {
if (!NeedCasts) {