[Patch,Fortran] PR 38282 - Add F2008's transformational bit intrinsics

Mikael Morin mikael.morin@sfr.fr
Sun Sep 5 19:32:00 GMT 2010


Le 04.09.2010 12:44, Tobias Burnus a écrit :
>  Dear all,
>
> this patch adds the transformational bit intrinsics IALL (bitwise and), IANY (bitwise inclusive or), and IPARITY (bitwise exclusive or); the syntax is the same as SUM or PRODUCT.
>
> (François-Xavier is working on the other Fortran 2008 bit intrinsics, which should be ready soon.)
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
OK, with the nits below fixed.
Thanks!

>
> Tobias
>
>
> iall.diff
>
> 2010-09-04  Tobias Burnus  <burnus@net-b.de>
>
> 	PR fortran/38282
> 	* intrinsic.c (add_functions): Support IALL, IANY, IPARITY.
> 	(check_specific): Special case for those intrinsics.
> 	* gfortran.h (gfc_isym_id): Add new intrinsics
> 	* intrinsic.h (gfc_check_transf_bit_intrins,
> 	gfc_simplify_iall, gfc_simplify_iany, gfc_simplify_iparity,
The simplify_* can be factorized to share a common workhorse function.
> 	gfc_resolve_iall, gfc_resolve_iany, gfc_resolve_iparity):
Same for the resolve_* functions.
> 	New prototypes.
> 	* iresolve.c (gfc_resolve_iall, gfc_resolve_iany,
> 	gfc_resolve_iparity): New functions.
> 	* check.c (gfc_check_transf_bit_intrins): New function.
> 	* simplify.c (gfc_simplify_iall, gfc_simplify_iany,
> 	gfc_simplify_iparity, do_bit_any, do_bit_ior,
> 	do_bit_xor): New functions.
> 	* trans-intrinsic.c (gfc_conv_intrinsic_arith,
> 	gfc_conv_intrinsic_function, gfc_is_intrinsic_libcall):
> 	Handle IALL, IANY and IPARITY intrinsics.	
> 	* intrinsic.texi (IMAGE_INDEX): Move up to fix alphabetic
> 	order.
> 	(IALL, IANY, IPARITY): Document new intrinsics.
>



> Index: gcc/fortran/intrinsic.texi
> ===================================================================
> --- gcc/fortran/intrinsic.texi	(Revision 163853)
> +++ gcc/fortran/intrinsic.texi	(Arbeitskopie)
> @@ -139,7 +139,9 @@ Some basic guidelines for editing this d
>  * @code{HUGE}:          HUGE,      Largest number of a kind
>  * @code{HYPOT}:         HYPOT,     Euclidian distance function
>  * @code{IACHAR}:        IACHAR,    Code in @acronym{ASCII} collating sequence
> +* @code{IALL}:          IALL,      Bitwise AND of array elements
>  * @code{IAND}:          IAND,      Bitwise logical and
> +* @code{IANY}:          IANY,      Bitwise OR of array elements
>  * @code{IARGC}:         IARGC,     Get the number of command line arguments
>  * @code{IBCLR}:         IBCLR,     Clear bit
>  * @code{IBITS}:         IBITS,     Bit extraction
> @@ -148,13 +150,14 @@ Some basic guidelines for editing this d
>  * @code{IDATE}:         IDATE,     Current local time (day/month/year)
>  * @code{IEOR}:          IEOR,      Bitwise logical exclusive or
>  * @code{IERRNO}:        IERRNO,    Function to get the last system error number
> +* @code{IMAGE_INDEX}:   IMAGE_INDEX, Cosubscript to image index convertion
>  * @code{INDEX}:         INDEX intrinsic, Position of a substring within a string
>  * @code{INT}:           INT,       Convert to integer type
>  * @code{INT2}:          INT2,      Convert to 16-bit integer type
>  * @code{INT8}:          INT8,      Convert to 64-bit integer type
>  * @code{IOR}:           IOR,       Bitwise logical or
> +* @code{IPARITY}:       IPARITY,   Bitwise XOR of array elements
>  * @code{IRAND}:         IRAND,     Integer pseudo-random number
> -* @code{IMAGE_INDEX}:   IMAGE_INDEX, Cosubscript to image index convertion
>  * @code{IS_IOSTAT_END}:  IS_IOSTAT_END, Test for end-of-file value
>  * @code{IS_IOSTAT_EOR}:  IS_IOSTAT_EOR, Test for end-of-record value
>  * @code{ISATTY}:        ISATTY,    Whether a unit is a terminal device
> @@ -5580,6 +5583,66 @@ and formatted string representations.
>
>
>
> +@node IALL
> +@section @code{IALL} --- Bitwise AND of array elements
> +@fnindex ILL
@fnindex IALL

> +@cindex array, AND
> +@cindex bits, AND of array elements



> Index: libgfortran/m4/iany.m4
> ===================================================================
> --- libgfortran/m4/iany.m4	(Revision 0)
> +++ libgfortran/m4/iany.m4	(Revision 0)
> @@ -0,0 +1,46 @@
> +`/* Implementation of the SUM intrinsic
This should be the IANY intrinsic.
> +   Copyright 2002, 2007, 2009 Free Software Foundation, Inc.
It should be 2010 only?
> +   Contributed by Paul Brook <paul@nowt.org>
What about Tobias Burnus?
> +
> +This file is part of the GNU Fortran 95 runtime library (libgfortran).
> +
> +Libgfortran is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public
> +License as published by the Free Software Foundation; either
> +version 3 of the License, or (at your option) any later version.


> Index: libgfortran/m4/iall.m4
> Index: libgfortran/m4/iparity.m4
The same applies for them



More information about the Fortran mailing list