> -----Original Message-----
> From: Alessandro Di Federico <[email protected]>
> Sent: Saturday, June 19, 2021 3:37 AM
> To: [email protected]
> Cc: Taylor Simpson <[email protected]>; Brian Cain
> <[email protected]>; [email protected]; [email protected]; [email protected];
> [email protected]; Alessandro Di Federico <[email protected]>
> Subject: [PATCH v5 06/14] target/hexagon: introduce new helper functions
>
> From: Niccolò Izzo <[email protected]>
>
> These helpers will be employed by the idef-parser generated code.
>
> Signed-off-by: Alessandro Di Federico <[email protected]>
> Signed-off-by: Niccolò Izzo <[email protected]>
> ---
> target/hexagon/genptr.c | 163
> ++++++++++++++++++++++++++++++++++++----
> target/hexagon/genptr.h | 23 ++++++
> target/hexagon/macros.h | 9 +++
> 3 files changed, 180 insertions(+), 15 deletions(-)
>
> diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index
> 6f2816f6e2..cf45c28f58 100644
> --- a/target/hexagon/genptr.c
> +++ b/target/hexagon/genptr.c
> +void gen_fbrev(TCGv result, TCGv src)
> +{
> + TCGv lo = tcg_temp_new();
> + TCGv tmp1 = tcg_temp_new();
> + TCGv tmp2 = tcg_temp_new();
> +
> + /* Bit reversal of low 16 bits */
> + tcg_gen_extract_tl(lo, src, 0, 16);
> + tcg_gen_andi_tl(tmp1, lo, 0xaaaa);
> + tcg_gen_shri_tl(tmp1, tmp1, 1);
> + tcg_gen_andi_tl(tmp2, lo, 0x5555);
> + tcg_gen_shli_tl(tmp2, tmp2, 1);
> + tcg_gen_or_tl(lo, tmp1, tmp2);
> + tcg_gen_andi_tl(tmp1, lo, 0xcccc);
> + tcg_gen_shri_tl(tmp1, tmp1, 2);
> + tcg_gen_andi_tl(tmp2, lo, 0x3333);
> + tcg_gen_shli_tl(tmp2, tmp2, 2);
> + tcg_gen_or_tl(lo, tmp1, tmp2);
> + tcg_gen_andi_tl(tmp1, lo, 0xf0f0);
> + tcg_gen_shri_tl(tmp1, tmp1, 4);
> + tcg_gen_andi_tl(tmp2, lo, 0x0f0f);
> + tcg_gen_shli_tl(tmp2, tmp2, 4);
> + tcg_gen_or_tl(lo, tmp1, tmp2);
> + tcg_gen_bswap16_tl(lo, lo);
> +
> + /* Final tweaks */
> + tcg_gen_deposit_tl(result, src, lo, 0, 16);
> + tcg_gen_or_tl(result, result, lo);
> +
> + tcg_temp_free(lo);
> + tcg_temp_free(tmp1);
> + tcg_temp_free(tmp2);
> +}
Remove this function and call gen_helper_fbrev instead. This was feedback from
Richard Henderson on one of my previous patch series.
Thanks,
Taylor