On Mon, 7 Jan 2013, Richard Sandiford wrote: > > ll, sc, dmult, ddiv, cvt.w.s, 64 bit FPU instructions. > > ll and sc is disabled with "-mno-llsc" and works. > > cvt.w.s is replaced by trunc.w.s. This seems to work. > > Probably showing my ignorance, but I couldn't see this in the patch.
This has raised my attention -- AFAICS the binutils change recently approved correctly disables DMULT, DDIV, CVT.W.S, etc. for -march=r5900, but does not do that for LL or SC. I think that should be fixed. And I gather LLD and SCD should then be disabled as well. > > I disabled 64 bit FPU instructions by "-msoft-float". This works, but > > using "-msingle-float" fails. This would be the better > > configuration. There are still 64 bit FPU instructions used (e.g. "dmfc1 > > $2,$f0" when using "long double" multiplication). So "-msingle-float" > > doesn't seem to work on generic mips64-linux-gnu. > > Right. That combination hasn't really been defined. What happens > for plain doubles? Do you pass those in FPRs or GPRs? IIUC the R5900 has an FPU that is functionally the same as that of the R4640/R4650. If that is the case, then there is no way to pass doubles in FPRs -- there is no room to store the upper halves. The single-precision FPU of the R4640/R4650 processors can be configured with CP0.Status.FR to present a register file of either 16 or 32 32-bit registers. The upper halves are not implemented. Frankly I don't think we have an ABI to express doubles on such platforms -- we could "approximate" one by passing doubles in GPRs and singles in FPRs (where mandated by o32), but that would really be an entirely new ABI. The compiler could presumably be taught to call soft-float routines for double arithmetic and emit FP machine code for single arithmetic. I'm not sure how feasible the use of single float could be in the soft-float library. Things would get more complicated if one wanted to run a real OS such as Linux on the R5900 and let the kernel FP emulator handle the missing double FP automagically -- this is a little bit out of scope here as regular -mdouble-float would then just do, but makes me wonder whether -mfp32 should really be enforced (as opposed to just defaulted) for the R5900, hmm... Maciej