RFA: matmul/transpose optimisation

Janne Blomqvist jblomqvi@cc.hut.fi
Wed Dec 7 08:43:00 GMT 2005


On Tue, Dec 06, 2005 at 06:18:37PM +0000, Richard Sandiford wrote:
> Index: libgfortran/m4/matmul.m4
> ===================================================================
> *** libgfortran/m4/matmul.m4	(revision 108072)
> --- libgfortran/m4/matmul.m4	(working copy)
> --- 219,246 ----
>   	    }
>   	}
>       }
> !   else if (rxstride == 1 && aystride == 1 && bxstride == 1)
> !     {
> !       rtype_name *bbase_y;
> !       rtype_name *dest_y;
> !       rtype_name *abase_x;

I think you'll want to mark the above variables as

      const rtype_name * restrict bbase_y;
      rtype_name * restrict dest_y;
      const rtype_name * restrict abase_n;

Otherwise the vectorizer doesn't get it. See matmul.m4 in trunk for
details. You can check that it works by adding
-ftree-vectorizer-verbose=5 -msse2 after the -ftree-vectorize for
$(i_matmul_c) in Makefile.am and recompiling.

> --- 252,278 ----
>   	    /* dest[x,y] += a[x,n] * b[n,y] */
>   	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
>       }
> +   else
> +     {
> +       rtype_name *bbase_y;
> +       rtype_name *dest_y;
> +       rtype_name *abase_x;
> +       rtype_name s;

Same here.


-- 
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051207/eaa740b6/attachment.sig>


More information about the Gcc-patches mailing list