aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-09-08 00:14:36 +0200
committerMike Pall <mike>2010-09-08 00:14:36 +0200
commitb2aa08c75c82e19e9522ba21438f8ed7632f524d (patch)
treeb608ce2ff07888984763d053838a216e7ec0dace /src
parent932193baa61c8acf026e8f8b0c4278e1a42fb980 (diff)
downloadluajit-b2aa08c75c82e19e9522ba21438f8ed7632f524d.tar.gz
luajit-b2aa08c75c82e19e9522ba21438f8ed7632f524d.tar.bz2
luajit-b2aa08c75c82e19e9522ba21438f8ed7632f524d.zip
PPC: Add helper function for folding arithmetic ops.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_ppc.dasc28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc
index 9cdc3643..9c5bc437 100644
--- a/src/buildvm_ppc.dasc
+++ b/src/buildvm_ppc.dasc
@@ -981,7 +981,33 @@ static void build_subroutines(BuildCtx *ctx)
981 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -) 981 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
982 |// and basic math functions. ORDER ARITH 982 |// and basic math functions. ORDER ARITH
983 |->vm_foldarith: 983 |->vm_foldarith:
984 | NYI 984 | evmergelo CARG2, CARG1, CARG2
985 | cmplwi CARG5, 1
986 | evmergelo CARG4, CARG3, CARG4
987 | beq >1; bgt >2
988 | efdadd CRET2, CARG2, CARG4; evmergehi CRET1, CRET2, CRET2; blr
989 |1:
990 | efdsub CRET2, CARG2, CARG4; evmergehi CRET1, CRET2, CRET2; blr
991 |2:
992 | cmplwi CARG5, 3; beq >1; bgt >2
993 | efdmul CRET2, CARG2, CARG4; evmergehi CRET1, CRET2, CRET2; blr
994 |1:
995 | efddiv CRET2, CARG2, CARG4; evmergehi CRET1, CRET2, CRET2; blr
996 |2:
997 | cmplwi CARG5, 5; beq >1; bgt >2
998 | evmr CARG3, CARG2; efddiv CRET2, CARG2, CARG4
999 | mflr SAVE0; bl ->vm_floor; mtlr SAVE0
1000 | efdmul CRET2, CRET2, CARG4; efdsub CRET2, CARG3, CRET2
1001 | evmergehi CRET1, CRET2, CRET2; blr
1002 |1:
1003 | b extern pow
1004 |2:
1005 | cmplwi CARG5, 7; beq >1; bgt >2
1006 | xoris CARG1, CARG1, 0x8000; blr
1007 |1:
1008 | rlwinm CARG1, CARG1, 0, 1, 31; blr
1009 |2:
1010 | NYI // Other operations only needed by JIT compiler.
985 | 1011 |
986 |//----------------------------------------------------------------------- 1012 |//-----------------------------------------------------------------------
987 |//-- Miscellaneous functions -------------------------------------------- 1013 |//-- Miscellaneous functions --------------------------------------------