gcc/libgfortran/m4/iparm.m4
Thomas Koenig 5d98fe096b Implement MATMUL and DOT_PRODUCT for unsigned.
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.
	* iresolve.cc (gfc_resolve_matmul): If using UNSIGNED, use the
	signed integer version.
	* gfortran.texi: Document MATMUL and DOT_PRODUCT for unsigned.
	* simplify.cc (compute_dot_product): Handle unsigneds.

libgfortran/ChangeLog:

	* m4/iparm.m4: Add UNSIGED if type is m.
	* m4/matmul.m4: If type is GFC_INTEGER, use GFC_UINTEGER instead.
	Whitespace fixes.
	* m4/matmul_internal.m4: Whitespace fixes.

	* generated/matmul_c10.c: Regenerated.
	* generated/matmul_c16.c: Regenerated.
	* generated/matmul_c17.c: Regenerated.
	* generated/matmul_c4.c: Regenerated.
	* generated/matmul_c8.c: Regeneraated.
	* generated/matmul_i1.c: Regenerated.
	* generated/matmul_i16.c: Regenerated.
	* generated/matmul_i2.c: Regenerated.
	* generated/matmul_i4.c: Regenerated.
	* generated/matmul_i8.c: Regenerated.
	* generated/matmul_r10.c: Regenerated.
	* generated/matmul_r16.c: Regenerated.
	* generated/matmul_r17.c: Regenerated.
	* generated/matmul_r4.c: Regenerated.
	* generated/matmul_r8.c: Regenerated.
	* libgfortran.h: Add array types for unsiged.

gcc/testsuite/ChangeLog:

	* gfortran.dg/unsigned_25.f90: New test.
	* gfortran.dg/unsigned_26.f90: New test.
2024-09-24 21:51:42 +02:00

41 lines
1.8 KiB
Plaintext

dnl Support macro file for intrinsic functions.
dnl Works out all the function types from the filename.
dnl This file is part of the GNU Fortran 95 Runtime Library (libgfortran)
dnl Distributed under the GNU GPL with exception. See COPYING for details.
dnl M4 macro file to get type names from filenames
define(get_typename2, `GFC_$1_$2')dnl
define(get_typename, `get_typename2(ifelse($1,i,INTEGER,ifelse($1,r,REAL,ifelse($1,l,LOGICAL,ifelse($1,c,COMPLEX,ifelse($1,m,UINTEGER,ifelse($1,s,UINTEGER,unknown)))))),`$2')')dnl
define(get_arraytype, `gfc_array_$1$2')dnl
define(define_type, `dnl
ifelse(regexp($2,`^[0-9]'),-1,`dnl
define($1_letter, substr($2, 0, 1))dnl
define($1_kind, substr($2, 1))dnl
',`dnl
define($1_letter,i)dnl
define($1_kind,$2)dnl
')dnl
define($1_code,$1_letter`'$1_kind)dnl
define($1,get_arraytype($1_letter,$1_kind))dnl
define($1_name, get_typename($1_letter, $1_kind))')dnl
dnl
define_type(atype, regexp(file, `_\(.?[0-9]*\)\.c$', `\1'))dnl
define(rtype_tmp, regexp(file, `_\(.?[0-9]*\)_[^_]*\.c$', `\1'))dnl
ifelse(rtype_tmp,,`dnl
define_type(rtype, atype_code)dnl
define(rtype_qual,`')dnl
',`dnl
define_type(rtype, rtype_tmp)dnl
define(rtype_qual,`_'rtype_kind)dnl
')dnl
define(atype_max, atype_name`_HUGE')dnl
define(atype_min,ifelse(regexp(file, `_\(.\)[0-9]*\.c$', `\1'),`i',`(-'atype_max`-1)',`-'atype_max))dnl
define(atype_inf, atype_name`_INFINITY')dnl
define(atype_nan, atype_name`_QUIET_NAN')dnl
define(name, regexp(regexp(file, `[^/]*$', `\&'), `^\([^_]*\)_', `\1'))dnl
define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl
define(`u_name',`regexp(upcase(name),`\([A-Z]*\)',`\1')')dnl
define(rtype_ccode,ifelse(rtype_letter,`i',rtype_kind,rtype_code))dnl
define(initval,ifelse(index(name,`maxval'),0,0,index(name,`minval'),0,255))dnl
define(back_arg,ifelse(index(name,`maxloc'),0,``, GFC_LOGICAL_4 back'',dnl
index(name,`minloc'),0,``, GFC_LOGICAL_4 back''))dnl