mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
ARM/PPC: Remove assembler code for lj_vm_foldarith().
This commit is contained in:
parent
46dc6d347c
commit
c2159f8624
@ -10,9 +10,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "lj_obj.h"
|
||||
#if LJ_HASJIT || LJ_TARGET_MIPS
|
||||
#include "lj_ir.h"
|
||||
#endif
|
||||
#include "lj_vm.h"
|
||||
|
||||
/* -- Helper functions for generated machine code ------------------------- */
|
||||
@ -24,7 +22,7 @@ LJ_FUNCA double lj_vm_cosh(double x) { return cosh(x); }
|
||||
LJ_FUNCA double lj_vm_tanh(double x) { return tanh(x); }
|
||||
#endif
|
||||
|
||||
#if LJ_TARGET_MIPS
|
||||
#if !LJ_TARGET_X86ORX64
|
||||
double lj_vm_foldarith(double x, double y, int op)
|
||||
{
|
||||
switch (op) {
|
||||
|
@ -2141,49 +2141,6 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| rsbmi CARG1, CARG1, #0 // if (sign(divisor) != sign(y)) y = -y
|
||||
| bx lr
|
||||
|
|
||||
|// Callable from C: double lj_vm_foldarith(double x, double y, int op)
|
||||
|// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
|
||||
|// and basic math functions. ORDER ARITH
|
||||
|->vm_foldarith:
|
||||
| ldr OP, [sp]
|
||||
| cmp OP, #1
|
||||
| blo extern __aeabi_dadd
|
||||
| beq extern __aeabi_dsub
|
||||
| cmp OP, #3
|
||||
| blo extern __aeabi_dmul
|
||||
| beq extern __aeabi_ddiv
|
||||
| cmp OP, #5
|
||||
| blo ->vm_mod
|
||||
| beq extern pow
|
||||
| cmp OP, #7
|
||||
| eorlo CARG2, CARG2, #0x80000000
|
||||
| biceq CARG2, CARG2, #0x80000000
|
||||
| bxls lr
|
||||
|.if JIT
|
||||
| cmp OP, #9
|
||||
| blo extern atan2
|
||||
| beq >9 // No support needed for IR_LDEXP.
|
||||
| cmp OP, #11
|
||||
| bhi >9
|
||||
| push {r4, lr}
|
||||
| beq >1
|
||||
| // IR_MIN
|
||||
| bl extern __aeabi_cdcmple
|
||||
| movhi CARG1, CARG3
|
||||
| movhi CARG2, CARG4
|
||||
| pop {r4, pc}
|
||||
|9:
|
||||
| NYI // Bad op.
|
||||
|
|
||||
|1: // IR_MAX
|
||||
| bl extern __aeabi_cdcmple
|
||||
| movlo CARG1, CARG3
|
||||
| movlo CARG2, CARG4
|
||||
| pop {r4, pc}
|
||||
|.else
|
||||
| NYI // Other operations only needed by JIT compiler.
|
||||
|.endif
|
||||
|
|
||||
|//-----------------------------------------------------------------------
|
||||
|//-- Miscellaneous functions --------------------------------------------
|
||||
|//-----------------------------------------------------------------------
|
||||
|
@ -2474,62 +2474,6 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0.
|
||||
| blr
|
||||
|
|
||||
|// Callable from C: double lj_vm_foldarith(double x, double y, int op)
|
||||
|// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
|
||||
|// and basic math functions. ORDER ARITH
|
||||
|->vm_foldarith:
|
||||
| cmplwi CARG1, 1
|
||||
| beq >1; bgt >2
|
||||
| fadd FARG1, FARG1, FARG2; blr
|
||||
|1:
|
||||
| fsub FARG1, FARG1, FARG2; blr
|
||||
|2:
|
||||
| cmplwi CARG1, 3; beq >1; bgt >2
|
||||
| fmul FARG1, FARG1, FARG2; blr
|
||||
|1:
|
||||
| fdiv FARG1, FARG1, FARG2; blr
|
||||
|2:
|
||||
| cmplwi CARG1, 5; beq >1; bgt >2
|
||||
| // NYI: Use internal implementation of floor and avoid spills.
|
||||
| stwu sp, -32(sp); stfd f14, 16(sp); stfd f15, 24(sp)
|
||||
| mflr r0
|
||||
| fmr f14, FARG1
|
||||
| fdiv FARG1, FARG1, FARG2
|
||||
| stw r0, 36(sp)
|
||||
| fmr f15, FARG2
|
||||
| bl extern floor
|
||||
| lwz r0, 36(sp)
|
||||
| fmul FARG1, FARG1, f15
|
||||
| mtlr r0
|
||||
| fsub FARG1, f14, FARG1
|
||||
| lfd f14, 16(sp); lfd f15, 24(sp); addi sp, sp, 32; blr
|
||||
|1:
|
||||
| b extern pow
|
||||
|2:
|
||||
| cmplwi CARG1, 7; beq >1; bgt >2
|
||||
| fneg FARG1, FARG1; blr
|
||||
|1:
|
||||
| fabs FARG1, FARG1; blr
|
||||
|2:
|
||||
|.if JIT
|
||||
| cmplwi CARG1, 9; beq >9; bgt >2
|
||||
| b extern atan2
|
||||
| // No support needed for IR_LDEXP.
|
||||
|2:
|
||||
| cmplwi CARG1, 11; bgt >9
|
||||
| fsub f0, FARG1, FARG2
|
||||
| beq >1
|
||||
| fsel FARG1, f0, FARG2, FARG1 // IR_MAX
|
||||
| blr
|
||||
|1:
|
||||
| fsel FARG1, f0, FARG1, FARG2 // IR_MIN
|
||||
| blr
|
||||
|9:
|
||||
| NYI // Bad op.
|
||||
|.else
|
||||
| NYI // Other operations only needed by JIT compiler.
|
||||
|.endif
|
||||
|
|
||||
|//-----------------------------------------------------------------------
|
||||
|//-- Miscellaneous functions --------------------------------------------
|
||||
|//-----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user