[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nfloat on x86-64

From: Jakob Löw
Subject: nfloat on x86-64
Date: Mon, 13 Jan 2020 14:34:34 +0100


I've been working on fixing all tests with the new graph allocator when
i noticed some oddities with nfloats and especially with the x86 FPU

First of all an implementation of JIT_OP_STORE_RELATIVE_NFLOAT is
missing. The only hardware instruction i could find that can store
nfloats is fstp, but it also pops the value from the register stack, so
maybe something like this would work?

        [reg, freg, imm] -> {
                x86_64_fstp_membase_size(inst, $1, $3, sizeof(jit_nfloat));
                x86_64_fld_membase_size(inst, $1, $3, sizeof(jit_nfloat));

Another problem i found is that in jit-rules-x86-64.c:34 FPU registers
are marked to able to hold float32, float64 and nfloat values. Thus my
allocator happily placed e.g. float32 values in them when it ran out of
xmm registers. However all float32/float64 math implementations work on
xmm registers and thus do not work correctly when given st0-st7
An easy fix here would be to mark fpu to only hold nfloat values. The
other options would be to implement all float32/64 operations (FADD,
DADD, FMUL, DMUL, ...) for both xmm and fpu registers.

Btw math on nfloats isnt implemented either and relies on intrinsic
calls, so a third option maybe would be to set nfloat == float64 and
remove all support for the FPU. The i686 instruction set supports SSE
too, which would allow us to remove all FPU related code. Maybe thats
just me, but i never liked the stack based register of the FPU, as they
add more complexity to a compiler. I guess that would mean we loose
support for native i386, which afaik gcc did a while ago?

- Jakob

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]