poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/3] pkl: Add RAS macro zero_extend_64


From: Jose E. Marchesi
Subject: Re: [PATCH 1/3] pkl: Add RAS macro zero_extend_64
Date: Sat, 08 Jan 2022 23:20:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Mohammad.

> 2022-01-08  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>
>       * libpoke/pkl-gen.pks (zero_extend_64): Add new macro.
> ---
>  ChangeLog           |  4 ++++
>  libpoke/pkl-gen.pks | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 34 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index e2d27f4d..8150754b 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2022-01-08  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
> +
> +     * libpoke/pkl-gen.pks (zero_extend_64): Add new macro.
> +
>  2022-01-08  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>  
>       * libpoke/pvm-val.c (pvm_print_val_1): Add `0x` prefix to
> diff --git a/libpoke/pkl-gen.pks b/libpoke/pkl-gen.pks
> index 526be994..080d2305 100644
> --- a/libpoke/pkl-gen.pks
> +++ b/libpoke/pkl-gen.pks
> @@ -430,6 +430,36 @@
>          raise
>          .end
>  
> +;;; RAS_MACRO_ZERO_EXTEND_64 @from_int_type
> +;;; ( IVAL -- IVAL_U64 )
> +;;;
> +;;; Cast the integer on stack as ulong<64> without perserving the

typo: preserving

> +;;; sign bit.
> +;;;
> +;;; Macro arguments:
> +;;;
> +;;; @from_int_type is the type of integer on stack.
> +
> +        ;; XXX This must be a PVM instruction instead
> +        .macro zero_extend_64 @from_int_type
> +        .let @uint64_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0)
> +   .c if (PKL_AST_TYPE_I_SIGNED_P (@from_int_type))
> +   .c {
> +        .let @utype =                                                       \
> +          pkl_ast_make_integral_type (PKL_PASS_AST,                         \
> +                                      PKL_AST_TYPE_I_SIZE (@from_int_type), \
> +                                      0);
> +        nton @from_int_type, @utype
> +        nton @utype, @uint64_type
> +        nip2
> +   .c }
> +   .c else
> +   .c {
> +        nton @from_int_type, @uint64_type
> +        nip
> +   .c }
> +        .end
> +

OK for master.
Thanks!



reply via email to

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