[patch, fortran] Matmul and dot_product for unsigned
Richard Biener
richard.guenther@gmail.com
Mon Sep 9 07:19:13 GMT 2024
On Sun, Sep 8, 2024 at 10:32 PM Thomas Koenig <tkoenig@netcologne.de> wrote:
>
> Hello world,
>
> like the subject says. The patch is gzipped because it is large;
> it contains multiple MATMUL library implementations.
>
> OK for trunk?
>
> Implement MATMUL and DOT_PRODUCT for unsgigned.
Is the library implementation in any way different from the signed
one? Iff only
multiplication and addition/subtraction are involved the unsigned implementation
could implement both variants (the signed one would eventually cause
undefinedness
with respect to overflow unless built with -fwrapv). That would save code size
in libgfortran and eventually icache if mixing uses of both.
Richard.
> gcc/fortran/ChangeLog:
>
> * arith.cc (gfc_arith_uminus): Fix warning.
> (gfc_arith_minus): Correctly truncate unsigneds.
> * check.cc (gfc_check_dot_product): Handle unsigned arguments.
> (gfc_check_matmul): Likewise.
> * expr.cc (gfc_get_unsigned_expr): New function.
> * gfortran.h (gfc_get_unsigned_expr): Add prototype.
> * gfortran.texi: Document MATMUL and DOT_PRODUCT for unsigned.
> * simplify.cc (compute_dot_product): Handle unsigneds.
>
> libgfortran/ChangeLog:
>
> * Makefile.am: Add unsigned MATMUL versions.
> * Makefile.in: Regenerate.
> * gfortran.map: Add unsigned MATMUL versions.o
> * libgfortran.h: Add array types for unsigned.
> * m4/iparm.m4: Add UNSIGNED if type is m.
> * generated/matmul_m1.c: New file.
> * generated/matmul_m16.c: New file.
> * generated/matmul_m2.c: New file.
> * generated/matmul_m4.c: New file.
> * generated/matmul_m8.c: New file.
> * generated/matmulavx128_m1.c: New file.
> * generated/matmulavx128_m16.c: New file.
> * generated/matmulavx128_m2.c: New file.
> * generated/matmulavx128_m4.c: New file.
> * generated/matmulavx128_m8.c: New file.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/unsigned_25.f90: New test.
> * gfortran.dg/unsigned_26.f90: New test.
More information about the Fortran
mailing list