[Mesa-dev] [PATCH] radeonsi: use shifts for sign extension
Marek Olšák
maraeo at gmail.com
Thu Jun 21 04:31:43 UTC 2018
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Jun 20, 2018 at 3:25 PM, Grazvydas Ignotas <notasas at gmail.com> wrote:
> Avoids a branch and reduces code size a tiny bit:
> text data bss dec hex filename
> 10804563 398653 2070368 13273584 ca89f0 /tmp/radeonsi_dri.so.old
> 10804499 398653 2070368 13273520 ca89b0 /tmp/radeonsi_dri.so
> ---
> src/gallium/drivers/radeonsi/si_descriptors.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 57a3124..f368ea6 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -98,12 +98,12 @@ static uint64_t si_desc_extract_buffer_address(const uint32_t *desc)
> {
> uint64_t va = desc[0] |
> ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
>
> /* Sign-extend the 48-bit address. */
> - if (va & (1ull << 47))
> - va |= 0xffffull << 48;
> + va <<= 16;
> + va = (int64_t)va >> 16;
> return va;
> }
>
> static void si_init_descriptor_list(uint32_t *desc_list,
> unsigned element_dw_size,
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list