diff options
author | Mike Pall <mike> | 2010-10-05 19:35:04 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-10-05 19:35:04 +0200 |
commit | 52b67fd3ea6fe034bad7e01e00da68502e377321 (patch) | |
tree | 1408d4b890a12b0f72ad1b0e01283ae8193677a5 /src | |
parent | 34185128628bf8e685d7cae500d2266d90f298ee (diff) | |
download | luajit-52b67fd3ea6fe034bad7e01e00da68502e377321.tar.gz luajit-52b67fd3ea6fe034bad7e01e00da68502e377321.tar.bz2 luajit-52b67fd3ea6fe034bad7e01e00da68502e377321.zip |
PPC: Add math.abs/deg/rad/min/max() fast functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_ppc.dasc | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 47409b03..ce79d67f 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -1206,7 +1206,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1206 | |//-- Math library ------------------------------------------------------- | 1206 | |//-- Math library ------------------------------------------------------- |
1207 | | | 1207 | | |
1208 | |.ffunc_n math_abs | 1208 | |.ffunc_n math_abs |
1209 | | NYI | 1209 | | efdabs CRET1, CARG1 |
1210 | | // Fallthrough. | 1210 | | // Fallthrough. |
1211 | | | 1211 | | |
1212 | |->fff_restv: | 1212 | |->fff_restv: |
@@ -1241,12 +1241,30 @@ static void build_subroutines(BuildCtx *ctx) | |||
1241 | | | 1241 | | |
1242 | |.macro math_extern, func | 1242 | |.macro math_extern, func |
1243 | | .ffunc math_ .. func | 1243 | | .ffunc math_ .. func |
1244 | | NYI | 1244 | | cmplwi NARGS8:RC, 8 |
1245 | | evldd CARG2, 0(BASE) | ||
1246 | | blt ->fff_fallback | ||
1247 | | checknum CARG2 | ||
1248 | | evmergehi CARG1, CARG2, CARG2 | ||
1249 | | checkfail ->fff_fallback | ||
1250 | | bl extern func | ||
1251 | | evmergelo CRET1, CRET1, CRET2 | ||
1252 | | b ->fff_restv | ||
1245 | |.endmacro | 1253 | |.endmacro |
1246 | | | 1254 | | |
1247 | |.macro math_extern2, func | 1255 | |.macro math_extern2, func |
1248 | | .ffunc math_ .. func | 1256 | | .ffunc math_ .. func |
1249 | | NYI | 1257 | | cmplwi NARGS8:RC, 16 |
1258 | | evldd CARG2, 0(BASE) | ||
1259 | | evldd CARG4, 8(BASE) | ||
1260 | | blt ->fff_fallback | ||
1261 | | evmergehi CARG1, CARG4, CARG2 | ||
1262 | | checknum CARG1 | ||
1263 | | evmergehi CARG3, CARG4, CARG4 | ||
1264 | | checkanyfail ->fff_fallback | ||
1265 | | bl extern func | ||
1266 | | evmergelo CRET1, CRET1, CRET2 | ||
1267 | | b ->fff_restv | ||
1250 | |.endmacro | 1268 | |.endmacro |
1251 | | | 1269 | | |
1252 | | math_extern floor | 1270 | | math_extern floor |
@@ -1271,7 +1289,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
1271 | | | 1289 | | |
1272 | |->ff_math_deg: | 1290 | |->ff_math_deg: |
1273 | |.ffunc_1 math_rad | 1291 | |.ffunc_1 math_rad |
1274 | | NYI | 1292 | | evldd CARG2, CFUNC:RB->upvalue[0] |
1293 | | efdmul CRET1, CARG1, CARG2 | ||
1294 | | b ->fff_restv | ||
1275 | | | 1295 | | |
1276 | |.ffunc_nn math_ldexp; NYI | 1296 | |.ffunc_nn math_ldexp; NYI |
1277 | |.ffunc_n math_frexp; NYI | 1297 | |.ffunc_n math_frexp; NYI |
@@ -1279,7 +1299,20 @@ static void build_subroutines(BuildCtx *ctx) | |||
1279 | | | 1299 | | |
1280 | |.macro math_minmax, name, cmpop | 1300 | |.macro math_minmax, name, cmpop |
1281 | | .ffunc_1 name | 1301 | | .ffunc_1 name |
1282 | | NYI | 1302 | | checknum CARG1 |
1303 | | li TMP1, 8 | ||
1304 | | checkfail ->fff_fallback | ||
1305 | |1: | ||
1306 | | evlddx CARG2, BASE, TMP1 | ||
1307 | | cmplw cr1, TMP1, NARGS8:RC | ||
1308 | | checknum CARG2 | ||
1309 | | bge cr1, ->fff_restv // Ok, since CRET1 = CARG1. | ||
1310 | | checkfail ->fff_fallback | ||
1311 | | cmpop CARG2, CARG1 | ||
1312 | | addi TMP1, TMP1, 8 | ||
1313 | | crmove 4*cr0+lt, 4*cr0+gt | ||
1314 | | evsel CARG1, CARG2, CARG1 | ||
1315 | | b <1 | ||
1283 | |.endmacro | 1316 | |.endmacro |
1284 | | | 1317 | | |
1285 | | math_minmax math_min, efdtstlt | 1318 | | math_minmax math_min, efdtstlt |