aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-06-12 17:25:52 +0200
committerMike Pall <mike>2012-06-12 17:25:52 +0200
commitc2159f8624c99d18e2c5b8a090e741008062a0c1 (patch)
treef5c7330b5adf9a017763487cdbc562a4e5e6dfed /src
parent46dc6d347cc82bd1548ed83b7b5597d9cf3a2259 (diff)
downloadluajit-c2159f8624c99d18e2c5b8a090e741008062a0c1.tar.gz
luajit-c2159f8624c99d18e2c5b8a090e741008062a0c1.tar.bz2
luajit-c2159f8624c99d18e2c5b8a090e741008062a0c1.zip
ARM/PPC: Remove assembler code for lj_vm_foldarith().
Diffstat (limited to 'src')
-rw-r--r--src/lj_vmmath.c4
-rw-r--r--src/vm_arm.dasc43
-rw-r--r--src/vm_ppc.dasc56
3 files changed, 1 insertions, 102 deletions
diff --git a/src/lj_vmmath.c b/src/lj_vmmath.c
index 1416b600..9b2235f3 100644
--- a/src/lj_vmmath.c
+++ b/src/lj_vmmath.c
@@ -10,9 +10,7 @@
10#include <math.h> 10#include <math.h>
11 11
12#include "lj_obj.h" 12#include "lj_obj.h"
13#if LJ_HASJIT || LJ_TARGET_MIPS
14#include "lj_ir.h" 13#include "lj_ir.h"
15#endif
16#include "lj_vm.h" 14#include "lj_vm.h"
17 15
18/* -- Helper functions for generated machine code ------------------------- */ 16/* -- Helper functions for generated machine code ------------------------- */
@@ -24,7 +22,7 @@ LJ_FUNCA double lj_vm_cosh(double x) { return cosh(x); }
24LJ_FUNCA double lj_vm_tanh(double x) { return tanh(x); } 22LJ_FUNCA double lj_vm_tanh(double x) { return tanh(x); }
25#endif 23#endif
26 24
27#if LJ_TARGET_MIPS 25#if !LJ_TARGET_X86ORX64
28double lj_vm_foldarith(double x, double y, int op) 26double lj_vm_foldarith(double x, double y, int op)
29{ 27{
30 switch (op) { 28 switch (op) {
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc
index aa5fbc88..8ddce49e 100644
--- a/src/vm_arm.dasc
+++ b/src/vm_arm.dasc
@@ -2141,49 +2141,6 @@ static void build_subroutines(BuildCtx *ctx)
2141 | rsbmi CARG1, CARG1, #0 // if (sign(divisor) != sign(y)) y = -y 2141 | rsbmi CARG1, CARG1, #0 // if (sign(divisor) != sign(y)) y = -y
2142 | bx lr 2142 | bx lr
2143 | 2143 |
2144 |// Callable from C: double lj_vm_foldarith(double x, double y, int op)
2145 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
2146 |// and basic math functions. ORDER ARITH
2147 |->vm_foldarith:
2148 | ldr OP, [sp]
2149 | cmp OP, #1
2150 | blo extern __aeabi_dadd
2151 | beq extern __aeabi_dsub
2152 | cmp OP, #3
2153 | blo extern __aeabi_dmul
2154 | beq extern __aeabi_ddiv
2155 | cmp OP, #5
2156 | blo ->vm_mod
2157 | beq extern pow
2158 | cmp OP, #7
2159 | eorlo CARG2, CARG2, #0x80000000
2160 | biceq CARG2, CARG2, #0x80000000
2161 | bxls lr
2162 |.if JIT
2163 | cmp OP, #9
2164 | blo extern atan2
2165 | beq >9 // No support needed for IR_LDEXP.
2166 | cmp OP, #11
2167 | bhi >9
2168 | push {r4, lr}
2169 | beq >1
2170 | // IR_MIN
2171 | bl extern __aeabi_cdcmple
2172 | movhi CARG1, CARG3
2173 | movhi CARG2, CARG4
2174 | pop {r4, pc}
2175 |9:
2176 | NYI // Bad op.
2177 |
2178 |1: // IR_MAX
2179 | bl extern __aeabi_cdcmple
2180 | movlo CARG1, CARG3
2181 | movlo CARG2, CARG4
2182 | pop {r4, pc}
2183 |.else
2184 | NYI // Other operations only needed by JIT compiler.
2185 |.endif
2186 |
2187 |//----------------------------------------------------------------------- 2144 |//-----------------------------------------------------------------------
2188 |//-- Miscellaneous functions -------------------------------------------- 2145 |//-- Miscellaneous functions --------------------------------------------
2189 |//----------------------------------------------------------------------- 2146 |//-----------------------------------------------------------------------
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc
index d2d10b3e..bf46f694 100644
--- a/src/vm_ppc.dasc
+++ b/src/vm_ppc.dasc
@@ -2474,62 +2474,6 @@ static void build_subroutines(BuildCtx *ctx)
2474 | mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0. 2474 | mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0.
2475 | blr 2475 | blr
2476 | 2476 |
2477 |// Callable from C: double lj_vm_foldarith(double x, double y, int op)
2478 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
2479 |// and basic math functions. ORDER ARITH
2480 |->vm_foldarith:
2481 | cmplwi CARG1, 1
2482 | beq >1; bgt >2
2483 | fadd FARG1, FARG1, FARG2; blr
2484 |1:
2485 | fsub FARG1, FARG1, FARG2; blr
2486 |2:
2487 | cmplwi CARG1, 3; beq >1; bgt >2
2488 | fmul FARG1, FARG1, FARG2; blr
2489 |1:
2490 | fdiv FARG1, FARG1, FARG2; blr
2491 |2:
2492 | cmplwi CARG1, 5; beq >1; bgt >2
2493 | // NYI: Use internal implementation of floor and avoid spills.
2494 | stwu sp, -32(sp); stfd f14, 16(sp); stfd f15, 24(sp)
2495 | mflr r0
2496 | fmr f14, FARG1
2497 | fdiv FARG1, FARG1, FARG2
2498 | stw r0, 36(sp)
2499 | fmr f15, FARG2
2500 | bl extern floor
2501 | lwz r0, 36(sp)
2502 | fmul FARG1, FARG1, f15
2503 | mtlr r0
2504 | fsub FARG1, f14, FARG1
2505 | lfd f14, 16(sp); lfd f15, 24(sp); addi sp, sp, 32; blr
2506 |1:
2507 | b extern pow
2508 |2:
2509 | cmplwi CARG1, 7; beq >1; bgt >2
2510 | fneg FARG1, FARG1; blr
2511 |1:
2512 | fabs FARG1, FARG1; blr
2513 |2:
2514 |.if JIT
2515 | cmplwi CARG1, 9; beq >9; bgt >2
2516 | b extern atan2
2517 | // No support needed for IR_LDEXP.
2518 |2:
2519 | cmplwi CARG1, 11; bgt >9
2520 | fsub f0, FARG1, FARG2
2521 | beq >1
2522 | fsel FARG1, f0, FARG2, FARG1 // IR_MAX
2523 | blr
2524 |1:
2525 | fsel FARG1, f0, FARG1, FARG2 // IR_MIN
2526 | blr
2527 |9:
2528 | NYI // Bad op.
2529 |.else
2530 | NYI // Other operations only needed by JIT compiler.
2531 |.endif
2532 |
2533 |//----------------------------------------------------------------------- 2477 |//-----------------------------------------------------------------------
2534 |//-- Miscellaneous functions -------------------------------------------- 2478 |//-- Miscellaneous functions --------------------------------------------
2535 |//----------------------------------------------------------------------- 2479 |//-----------------------------------------------------------------------