aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-10 16:56:13 +0200
committerMike Pall <mike>2011-04-10 16:56:13 +0200
commitf089f3954c9be976faccc82661b4a7b00e70c3b0 (patch)
tree3bd8281a9506a961bfa544a21359b0ed1788d232 /src
parent161bc379f059bc903873b67da603b48d50cb8ffe (diff)
downloadluajit-f089f3954c9be976faccc82661b4a7b00e70c3b0.tar.gz
luajit-f089f3954c9be976faccc82661b4a7b00e70c3b0.tar.bz2
luajit-f089f3954c9be976faccc82661b4a7b00e70c3b0.zip
ARM: Add bit.* fast functions and lj_vm_tobit().
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_arm.dasc96
1 files changed, 81 insertions, 15 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc
index 7280438c..bf800eab 100644
--- a/src/buildvm_arm.dasc
+++ b/src/buildvm_arm.dasc
@@ -1240,41 +1240,107 @@ static void build_subroutines(BuildCtx *ctx)
1240 | 1240 |
1241 |//-- Bit library -------------------------------------------------------- 1241 |//-- Bit library --------------------------------------------------------
1242 | 1242 |
1243 |// FP number to bit conversion for soft-float. Clobbers r0-r3.
1244 |->vm_tobit_fb:
1245 | bhi ->fff_fallback
1246 |->vm_tobit:
1247 | lsl CARG3, CARG2, #1
1248 | adds CARG3, CARG3, #0x00200000
1249 | movpl CARG1, #0 // |x| < 1?
1250 | bxpl lr
1251 | mvn CARG4, #0x3e0
1252 | subs CARG3, CARG4, CARG3, asr #21
1253 | bmi >1 // |x| >= 2^32?
1254 | lsl CARG4, CARG2, #11
1255 | orr CARG4, CARG4, #0x80000000
1256 | orr CARG4, CARG4, CARG1, lsr #21
1257 | cmp CARG2, #0
1258 | lsr CARG1, CARG4, CARG3
1259 | rsblt CARG1, CARG1, #0
1260 | bx lr
1261 |1:
1262 | add CARG3, CARG3, #21
1263 | lsr CARG4, CARG1, CARG3
1264 | rsb CARG3, CARG3, #20
1265 | lsl CARG1, CARG2, #12
1266 | cmp CARG2, #0
1267 | orr CARG1, CARG4, CARG1, lsl CARG3
1268 | rsblt CARG1, CARG1, #0
1269 | bx lr
1270 |
1243 |.macro .ffunc_bit, name 1271 |.macro .ffunc_bit, name
1244 | .ffunc_1 bit_..name 1272 | .ffunc_1 bit_..name
1245 | NYI 1273 | checktp CARG2, LJ_TISNUM
1274 | blne ->vm_tobit_fb
1246 |.endmacro 1275 |.endmacro
1247 | 1276 |
1248 |.ffunc_bit tobit 1277 |.ffunc_bit tobit
1249 | NYI 1278 | mvn CARG2, #~LJ_TISNUM
1250 |->fff_resbit: 1279 | b ->fff_restv
1251 | NYI
1252 | 1280 |
1253 |.macro .ffunc_bit_op, name, ins 1281 |.macro .ffunc_bit_op, name, ins
1254 | .ffunc_bit name 1282 | .ffunc_bit name
1255 | NYI 1283 | mov CARG3, CARG1
1284 | mov RA, #8
1285 |1:
1286 | ldrd CARG12, [BASE, RA]
1287 | cmp RA, NARGS8:RC
1288 | add RA, RA, #8
1289 | bge >2
1290 | checktp CARG2, LJ_TISNUM
1291 | blne ->vm_tobit_fb
1292 | ins CARG3, CARG3, CARG1
1293 | b <1
1256 |.endmacro 1294 |.endmacro
1257 | 1295 |
1258 |.ffunc_bit_op band, and 1296 |.ffunc_bit_op band, and
1259 |.ffunc_bit_op bor, or 1297 |.ffunc_bit_op bor, orr
1260 |.ffunc_bit_op bxor, eor 1298 |.ffunc_bit_op bxor, eor
1261 | 1299 |
1300 |2:
1301 | mvn CARG4, #~LJ_TISNUM
1302 | ldr PC, [BASE, FRAME_PC]
1303 | strd CARG34, [BASE, #-8]
1304 | b ->fff_res1
1305 |
1262 |.ffunc_bit bswap 1306 |.ffunc_bit bswap
1263 | NYI 1307 | eor CARG3, CARG1, CARG1, ror #16
1308 | bic CARG3, CARG3, #0x00ff0000
1309 | ror CARG1, CARG1, #8
1310 | mvn CARG2, #~LJ_TISNUM
1311 | eor CARG1, CARG1, CARG3, lsr #8
1312 | b ->fff_restv
1264 | 1313 |
1265 |.ffunc_bit bnot 1314 |.ffunc_bit bnot
1266 | NYI 1315 | mvn CARG1, CARG1
1316 | mvn CARG2, #~LJ_TISNUM
1317 | b ->fff_restv
1267 | 1318 |
1268 |.macro .ffunc_bit_sh, name, ins, shmod 1319 |.macro .ffunc_bit_sh, name, ins, shmod
1269 | .ffunc_2 bit_..name 1320 | .ffunc bit_..name
1270 | NYI 1321 | ldrd CARG12, [BASE, #8]
1322 | cmp NARGS8:RC, #16
1323 | blo ->fff_fallback
1324 | checktp CARG2, LJ_TISNUM
1325 | blne ->vm_tobit_fb
1326 |.if shmod == 0
1327 | and RA, CARG1, #31
1328 |.else
1329 | rsb RA, CARG1, #0
1330 |.endif
1331 | ldrd CARG12, [BASE]
1332 | checktp CARG2, LJ_TISNUM
1333 | blne ->vm_tobit_fb
1334 | ins CARG1, CARG1, RA
1335 | mvn CARG2, #~LJ_TISNUM
1336 | b ->fff_restv
1271 |.endmacro 1337 |.endmacro
1272 | 1338 |
1273 |.ffunc_bit_sh lshift, NYI, 1 1339 |.ffunc_bit_sh lshift, lsl, 0
1274 |.ffunc_bit_sh rshift, NYI, 1 1340 |.ffunc_bit_sh rshift, lsr, 0
1275 |.ffunc_bit_sh arshift, NYI, 1 1341 |.ffunc_bit_sh arshift, asr, 0
1276 |.ffunc_bit_sh rol, NYI, 2 1342 |.ffunc_bit_sh rol, ror, 1
1277 |.ffunc_bit_sh ror, NYI, 0 1343 |.ffunc_bit_sh ror, ror, 0
1278 | 1344 |
1279 |//----------------------------------------------------------------------- 1345 |//-----------------------------------------------------------------------
1280 | 1346 |