Re: FW: LuaJIT support for MIPS soft-float

  • From: Mike Pall <mike-1405@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 22 May 2014 13:44:43 +0200

Justin Cormack wrote:
> On May 22, 2014 8:53 AM, "Arunkumar Desigan (ardesiga)" <ardesiga@xxxxxxxxx>
> wrote:
> >  Wondering if anyone has looked into supporting LuaJIT for MIPS32 using
> > soft-float mode and/or have any suggestions. As per Mike's suggestion
> > reaching out to the mailing list to see if someone is willing to take up
> > this (under a sponsorship agreement, details of which can be worked out)
> > as we have an immediate need to have this working.
> 
> Just to be clear do you want mips64 or mips32? And by soft float do you
> mean it float mixed mode like the Arm port or do you want to run in a
> system with no emulated floating point at all?

The requirement is to extend the existing single-number MIPS32R1
port to a) add a dual-number mode and b) add soft-float support.
The former is a necessity for the latter to be useful.

This involves understanding and extending ~4000 lines of MIPS
assembler code for the interpreter plus changing the MIPS backend
of the JIT compiler.

A rough laundry list: Have a look at the PPC interpreter
(vm_ppc.dasc) and adapt the dual-number mode changes (DUALNUM
define) to the MIPS interpreter (vm_mips.dasc). Then adapt the
soft-float changes from the ARM interpreter (vm_arm.dasc, !FPU
define). While doing that you'll need to change the stack layout
(vm_mips.dasc, lj_frame.h) and the FFI (lj_c*.[ch], LJ_ABI_SOFTP).
You may need to add shims or GOT definitions for the soft-float
support routines, check dispatch.h and lj_vm.h. Then you'll need
to overhaul lj_asm_mips.h: check the PPC port for dual-number
mode, check the ARM port for soft-float support. I probably forgot
a couple of details -- you'll find them as you go along.

In the end, three modes need to be supported:
- MIPS32R1 hard-float, single-number mode (already exists)
- MIPS32R1 hard-float, dual-number mode (slow FPU)
- MIPS32R1 soft-float, dual-number mode (no FPU)

A soft-float build should auto-select the dual-number mode.
A hard-float build should use single-number mode unless overriden
with -DLUAJIT_NUMMODE=2.

--Mike

Other related posts: