[PATCH xf86-video-ati] Use finer-grained pointer types in mem copying functions

Michel Dänzer michel at daenzer.net
Mon Nov 28 09:43:11 UTC 2016


On 25/11/16 07:00 PM, Jochen Rollwagen wrote:
> This commit modifies some pointer definitions in functions copying
> memory corresponding to those in memcpy.
> That should enable a compiler to produce better code (though i haven't
> checked whether that's the case).

Please always check that patches actually have an effect before
submitting them. :)

With gcc, the stripped radeon_accel.o and radeon_dri2.o object files are
identical for me with and without this patch. With clang, the patch does
seem to make the code generated for RADEONCopySwap slightly smaller, but
I'm afraid I'm wary of applying this kind of micro-optimization without
justification such as benchmark numbers showing significant gains.


> @@ -128,13 +128,13 @@ int radeon_cs_space_remaining(ScrnInfoPtr pScrn)
>      return (info->cs->ndw - info->cs->cdw);
>  }
> 
> -void RADEONCopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int
> swap)
> +void RADEONCopySwap(uint8_t * __restrict dst, const uint8_t *
> __restrict src, unsigned int size, int swap)
>  {
>      switch(swap) {
>      case RADEON_HOST_DATA_SWAP_32BIT:
>          {
> -           unsigned int *d = (unsigned int *)dst;
> -           unsigned int *s = (unsigned int *)src;
> +           unsigned int * __restrict d = (unsigned int *)dst;
> +           unsigned int * __restrict s = (unsigned int *)src;
>             unsigned int nwords = size >> 2;
> 
>             for (; nwords > 0; --nwords, ++d, ++s)

BTW, this hunk wouldn't apply to current master, looks like it's on top
of your previous patch removing the RADEON_HOST_DATA_SWAP_HDW case.
Please always either make sure patches you submit apply to current
master, or explicitly state dependencies on other patches.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer



More information about the amd-gfx mailing list