Inline-Lua
view release on metacpan or search on metacpan
ffi/target/release/build/mlua-sys-6a99a2ae50f12319/out/luajit-build/build/src/vm_mips64.dasc view on Meta::CPAN
|.endmacro
|
|.macro vm_round, func
|.if FPU
| vm_round_hf, func
|.endif
|.endmacro
|
|->vm_floor:
| vm_round floor
|->vm_ceil:
| vm_round ceil
|->vm_trunc:
|.if JIT
| vm_round trunc
|.endif
|
|// Soft-float integer to number conversion.
|.macro sfi2d, ARG
|.if not FPU
| beqz ARG, >9 // Handle zero first.
|. sra TMP0, ARG, 31
| xor TMP1, ARG, TMP0
| dsubu TMP1, TMP1, TMP0 // Absolute value in TMP1.
| dclz ARG, TMP1
| addiu ARG, ARG, -11
| li AT, 0x3ff+63-11-1
| dsllv TMP1, TMP1, ARG // Align mantissa left with leading 1.
| subu ARG, AT, ARG // Exponent - 1.
| ins ARG, TMP0, 11, 11 // Sign | Exponent.
| dsll ARG, ARG, 52 // Align left.
| jr ra
|. daddu ARG, ARG, TMP1 // Add mantissa, increment exponent.
|9:
| jr ra
|. nop
|.endif
|.endmacro
|
|// Input CARG1. Output: CARG1. Temporaries: AT, TMP0, TMP1.
|->vm_sfi2d_1:
| sfi2d CARG1
|
|// Input CARG2. Output: CARG2. Temporaries: AT, TMP0, TMP1.
|->vm_sfi2d_2:
| sfi2d CARG2
|
|// Soft-float comparison. Equivalent to c.eq.d.
|// Input: CARG*. Output: CRET1. Temporaries: AT, TMP0, TMP1.
|->vm_sfcmpeq:
|.if not FPU
| dsll AT, CARG1, 1
| dsll TMP0, CARG2, 1
| or TMP1, AT, TMP0
| beqz TMP1, >8 // Both args +-0: return 1.
|. lui TMP1, 0xffe0
| dsll TMP1, TMP1, 32
| sltu AT, TMP1, AT
| sltu TMP0, TMP1, TMP0
| or TMP1, AT, TMP0
| bnez TMP1, >9 // Either arg is NaN: return 0;
|. xor AT, CARG1, CARG2
| jr ra
|. sltiu CRET1, AT, 1 // Same values: return 1.
|8:
| jr ra
|. li CRET1, 1
|9:
| jr ra
|. li CRET1, 0
|.endif
|
|// Soft-float comparison. Equivalent to c.ult.d and c.olt.d.
|// Input: CARG1, CARG2. Output: CRET1. Temporaries: AT, TMP0, TMP1, CRET2.
|->vm_sfcmpult:
|.if not FPU
| b >1
|. li CRET2, 1
|.endif
|
|->vm_sfcmpolt:
|.if not FPU
| li CRET2, 0
|1:
| dsll AT, CARG1, 1
| dsll TMP0, CARG2, 1
| or TMP1, AT, TMP0
| beqz TMP1, >8 // Both args +-0: return 0.
|. lui TMP1, 0xffe0
| dsll TMP1, TMP1, 32
| sltu AT, TMP1, AT
| sltu TMP0, TMP1, TMP0
| or TMP1, AT, TMP0
| bnez TMP1, >9 // Either arg is NaN: return 0 or 1;
|. and AT, CARG1, CARG2
| bltz AT, >5 // Both args negative?
|. nop
| jr ra
|. slt CRET1, CARG1, CARG2
|5: // Swap conditions if both operands are negative.
| jr ra
|. slt CRET1, CARG2, CARG1
|8:
| jr ra
|. li CRET1, 0
|9:
| jr ra
|. move CRET1, CRET2
|.endif
|
|->vm_sfcmpogt:
|.if not FPU
| dsll AT, CARG2, 1
| dsll TMP0, CARG1, 1
| or TMP1, AT, TMP0
| beqz TMP1, >8 // Both args +-0: return 0.
|. lui TMP1, 0xffe0
| dsll TMP1, TMP1, 32
| sltu AT, TMP1, AT
| sltu TMP0, TMP1, TMP0
| or TMP1, AT, TMP0
| bnez TMP1, >9 // Either arg is NaN: return 0 or 1;
|. and AT, CARG2, CARG1
| bltz AT, >5 // Both args negative?
|. nop
| jr ra
|. slt CRET1, CARG2, CARG1
|5: // Swap conditions if both operands are negative.
| jr ra
|. slt CRET1, CARG1, CARG2
|8:
| jr ra
|. li CRET1, 0
|9:
| jr ra
|. li CRET1, 0
|.endif
|
|// Soft-float comparison. Equivalent to c.ole.d a, b or c.ole.d b, a.
|// Input: CARG1, CARG2, TMP3. Output: CRET1. Temporaries: AT, TMP0, TMP1.
|->vm_sfcmpolex:
|.if not FPU
| dsll AT, CARG1, 1
| dsll TMP0, CARG2, 1
| or TMP1, AT, TMP0
| beqz TMP1, >8 // Both args +-0: return 1.
|. lui TMP1, 0xffe0
| dsll TMP1, TMP1, 32
| sltu AT, TMP1, AT
| sltu TMP0, TMP1, TMP0
| or TMP1, AT, TMP0
| bnez TMP1, >9 // Either arg is NaN: return 0;
|. and AT, CARG1, CARG2
| xor AT, AT, TMP3
| bltz AT, >5 // Both args negative?
|. nop
| jr ra
|. slt CRET1, CARG2, CARG1
|5: // Swap conditions if both operands are negative.
| jr ra
|. slt CRET1, CARG1, CARG2
|8:
| jr ra
|. li CRET1, 1
|9:
| jr ra
|. li CRET1, 0
|.endif
|
|.macro sfmin_max, name, fpcall
|->vm_sf .. name:
|.if JIT and not FPU
| move TMP2, ra
| bal ->fpcall
|. nop
| move ra, TMP2
| move TMP0, CRET1
| move CRET1, CARG1
|.if MIPSR6
| selnez CRET1, CRET1, TMP0
| seleqz TMP0, CARG2, TMP0
| jr ra
|. or CRET1, CRET1, TMP0
|.else
| jr ra
|. movz CRET1, CARG2, TMP0
|.endif
|.endif
|.endmacro
|
| sfmin_max min, vm_sfcmpolt
| sfmin_max max, vm_sfcmpogt
|
|//-----------------------------------------------------------------------
|//-- Miscellaneous functions --------------------------------------------
|//-----------------------------------------------------------------------
|
|.define NEXT_TAB, TAB:CARG1
|.define NEXT_IDX, CARG2
|.define NEXT_ASIZE, CARG3
|.define NEXT_NIL, CARG4
|.define NEXT_TMP0, r12
|.define NEXT_TMP1, r13
|.define NEXT_TMP2, r14
|.define NEXT_RES_VK, CRET1
|.define NEXT_RES_IDX, CRET2
|.define NEXT_RES_PTR, sp
|.define NEXT_RES_VAL, 0(sp)
|.define NEXT_RES_KEY, 8(sp)
|
|// TValue *lj_vm_next(GCtab *t, uint32_t idx)
|// Next idx returned in CRET2.
( run in 1.628 second using v1.01-cache-2.11-cpan-39bf76dae61 )