lightning
[Top][All Lists]
Advanced

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

Re: GNU Lightning 2.2.1 release


From: Paul Cercueil
Subject: Re: GNU Lightning 2.2.1 release
Date: Sat, 18 Feb 2023 12:29:13 +0000

Hi Paulo,

Le vendredi 17 février 2023 à 16:23 -0300, Paulo César Pereira de
Andrade a écrit :
> GNU lightning 2.2.1 released!
> 
> GNU lightning is a library to aid in making portable programs
> that compile assembly code at run time.
> 
> Development:
> http://git.savannah.gnu.org/cgit/lightning.git
> 
> Download release:
> ftp://ftp.gnu.org/gnu/lightning/lightning-2.2.1.tar.gz
> 
>   GNU Lightning 2.2.1 main new features:
> 
> o Variable stack framesize implemented for aarch64, arm, i686, mips,
>   riscv, loongarch and x86_64. This means function calls use only
>   the minimum required stack space for prolog and epilog.
> o Optimization of prolog and epilog to not create a frame pointer if
>   not required, and not even save and restore the stack pointer if
>   not required on a leaf function. These features implemented for the
>   ports with variable stack framesize.
> o New clor, czr, ctor and ctzr instructions, that count
> leading/trailing
>   zeros/ones. These use hardware implementation when available,
> otherwise
>   fallback to a software implementation.

That's great. I actually had an alpha version of a patch that added
clzr but never finished it.

I think you could add an extra one, clsr, "count leading sign bits".
The fallback should be very easy:

jit_rshi(rn(tmp), r1, __WORDSIZE - 1);
jit_xorr(rn(tmp), r1, rn(tmp));
jit_clzr(r0, rn(tmp));

Maybe adapted to only return the number of sign bits after the MSB to
match GCC's __builtin_clrsb(), if it makes more sense.

Speaking about fallbacks, the ones in place look very ineffective (e.g.
the bit-swap to count trailing bits). I'm sure there are better
algorithms; I'll have a look.

Also, you added SLL opcodes to "sign extend top 32 bits" on MIPS, but
you do that if (__WORDSIZE == 32). What "top 32 bits" are we talking
about there?

Cheers,
-Paul

> o Correct several bugs with jit_arg_register_p and
> jit_putarg{r,i}{_f,_d}.
>   These bugs were not noticed earlier due to an incorrect check for
>   correctness in check/carg.c.
> o Add rip relative addressing support for x86_64 and shorter signed
> 64
>   bit constant load if the constant fits in a signed 32 bit integer.
>   This significantly reduces code size generation.
> o Correct bugs in branch generation code for pppc and sparc.
> o Correct bug in signed 32 bit integer load in ppc 64 bits.
> o Add short relative unconditional branches and calls to mips,
> reducing
>   code size generation.
> o And several extra minor optimizations.
> 




reply via email to

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