[Pixman] [PATCH 2/3] mmx: fix unaligned accesses

Soeren Sandmann sandmann at cs.au.dk
Wed Jul 27 11:31:47 PDT 2011


Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

> The 'test1' function does not look good because it uses ARM
> instructions to read data one byte at a time and combine it. Function
> 'test2' looks a bit better because it now uses WALIGNR, but this is
> still not an optimal solution. Ideally, if we need to read N
> contiguous unaligned 64-bit values, this requires (N + 1) loads via
> WLDRD instructions and N fixups via WALIGNR, also shift argument for
> WALIGNR has to be calculated only once.

Yes, this would be the best way. It should be possible to do something
like this for acessing 32 bit values:

        while (height--)
        {

              ...

              align = 4 - (src & 3);
              st = wldrd (src & ~3)
              src += 4;
              while (w >= 4)
              {
                   new_st = wldr (src);
                   s = walignr (st, new_st, align);

                   st = new_st;

                   ...
              }

If the wldr/walignr instructions are encapsulated in inline functions,
then for x86 those functions could simply expand to movd/movq.


Soren


More information about the Pixman mailing list