]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
ARM: Add modulo subroutine and temp. math.floor()/math.ceil().
authorMike Pall <mike>
Wed, 13 Apr 2011 00:22:59 +0000 (02:22 +0200)
committerMike Pall <mike>
Wed, 13 Apr 2011 00:22:59 +0000 (02:22 +0200)
src/buildvm_arm.dasc

index e977f844f1b6a09c6213ff143aaa971694e7d711..321c4f3acb30af1005787f6537fb8e66a5dd55d3 100644 (file)
@@ -1119,8 +1119,12 @@ static void build_subroutines(BuildCtx *ctx)
   |.endmacro
   |
   |.macro math_round, func
-  |  .ffunc math_ .. func
-  |  NYI
+  |  .ffunc_1 math_ .. func
+  |  checktp CARG2, LJ_TISNUM
+  |  bhi ->fff_fallback
+  |  bllo extern func  // NYI: use internal implementation of floor/ceil.
+  |  // NYI: normalize result.
+  |  b ->fff_restv
   |.endmacro
   |
   |  math_round floor
@@ -1618,7 +1622,16 @@ static void build_subroutines(BuildCtx *ctx)
 #endif
   |
   |->vm_mod:
-  |  NYI
+  |  push {r0, r1, r2, r3, r4, lr}
+  |  bl extern __aeabi_ddiv
+  |  bl extern floor  // NYI: Use internal implementation of floor.
+  |  ldrd CARG34, [sp, #8]
+  |  bl extern __aeabi_dmul
+  |  ldrd CARG34, [sp]
+  |  eor CARG2, CARG2, #0x80000000
+  |  bl extern __aeabi_dadd
+  |  add sp, sp, #20
+  |  pop {pc}
   |
   |->vm_powi:
 #if LJ_HASJIT