浏览代码

PPC: Use own implementation for math.floor/ceil() fast functions.

Mike Pall 15 年之前
父节点
当前提交
8f5efb2c43
共有 1 个文件被更改,包括 17 次插入2 次删除
  1. 17 2
      src/buildvm_ppc.dasc

+ 17 - 2
src/buildvm_ppc.dasc

@@ -1267,8 +1267,23 @@ static void build_subroutines(BuildCtx *ctx)
   |  b ->fff_restv
   |  b ->fff_restv
   |.endmacro
   |.endmacro
   |
   |
-  |  math_extern floor
-  |  math_extern ceil
+  |.macro math_round, func
+  |  .ffunc math_ .. func
+  |  cmplwi NARGS8:RC, 8
+  |   evldd CARG2, 0(BASE)
+  |  blt ->fff_fallback
+  |  checknum CARG2
+  |   evmergehi CARG1, CARG2, CARG2
+  |  checkfail ->fff_fallback
+  |   lwz PC, FRAME_PC(BASE)
+  |  bl ->vm_..func.._hilo;
+  |  la RA, -8(BASE)
+  |  evstdd CRET2, 0(RA)
+  |  b ->fff_res1
+  |.endmacro
+  |
+  |  math_round floor
+  |  math_round ceil
   |
   |
   |  math_extern sqrt
   |  math_extern sqrt
   |  math_extern log
   |  math_extern log