dotgnu-libjit
[Top][All Lists]
Advanced

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

Re: [Libjit-developers] JIT_REG_INFO and alpha floating poin


From: Kirill Kononenko
Subject: Re: [Libjit-developers] JIT_REG_INFO and alpha floating poin
Date: Tue, 30 May 2006 21:04:42 +0400


> I was wondering if the
> meaning of JIT_REG_NFLOAT could be clarified too.
NFLOAT represents a floating point type that represents the greatest precision supported on the native platform. Might be 64 bit for Alpha GNU/Linux.


> Many alpha systems (those with processors before EV6) do not fully
> implement the IEEE floating point standard. For those earlier systems,
> there is no hardware support for denormalized numbers or exceptional
> IEEE values like not a number and positive/negative infinity. For C
> programs on those systems, gcc has a flag "-mieee" which will add
> instructions to trap into the kernel to do software assisted floating
> point. The gcc flag and kernel support are optional. If the program
> was not compiled with "-mieee" and/or kernel support is not enabled,
> then there will be a floating-point exception if the program tries to
> make use of an un-implemented feature.

> For the curious, here is some documentation I've written about the subject:
> http://www.gentoo.org/proj/en/base/alpha/doc/alpha-porting-guide.xml#doc_chap4

> There is an instruction, implver, that can tell if the system is EV6
> or higher. However, I'm wondering what should be done in libjit on
> systems that do not have IEEE floating point. Someone could want no
> software assistance (increased speed), but most people will want
> software assistance. Should I make software assistance the default for
> systems without hardware support (for example, call implver at runtime
> and use software assistance on older systems), or should I determine
> if libjit is being compiled with "-mieee" (gcc defines _IEEE_FP) and
> enable software assistance if "-mieee" was enabled?

I think in the first implementation the best would be to use intrinsic functions for arithmetic/logic functions on floating point values.

Libjit supports intrinsic functions for a large set of arithmetic/logic functions, that is, if the CPU does not support an operation, we will generate code which calls a function which performs that operation. These intrinsic functions are defined in jit-intrinsic.c. Within a libjit function we can indeed execute other functions defined in current C code.

In jit-rules-*.c the _jit_opcode_is_supported(int opcode) defines which libjit opcodes are supported for low-level generation on the * platform. For example, these are all the opcodes where an equivalent intrinsic function cannot be used instead.

In jit-insn.c the jit_insn_* functions  manipulates these primitive code generator. Take a look in jit-insn.c for apply_unary_arith(..) and apply_binary_arith(..) to understand how these opcodes are applied:

if(_jit_opcode_is_supported(oper))
{
         return apply_unary(func, oper, value1, result_type);
}
else
{
       return apply_intrinsic(func, desc, value1, 0, result_type);
}

So if in the libjit function an intrinsic function will be called is chosed there. I think the support of intrinsic function for floating point values will be very deliberating.


Kirill

reply via email to

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