public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ
@ 2008-09-24 8:16 burnus at gcc dot gnu dot org
2008-09-24 16:21 ` [Bug fortran/37635] " kargl at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-24 8:16 UTC (permalink / raw)
To: gcc-bugs
Requested by Richard Townsend at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1e4130b9720e4f2a
LEADZ and TRAILZ are rather common vendor extensions, e.g. supported by the
Intel compiler (it also allows for logical arguments).
LEADZ (I)
Description. Number of leading zero bits.
Argument. I shall be of type integer.
Result Value. If all of the bits of I are zero, the result value is
BIT SIZE (I). [...]
TRAILZ (I)
Description. Number of trailing zero bits.
Argument. I shall be of type integer.
The implementation should be relatively easy using the following built-ins,
however, one presumably needs a special case for ZERO.
BUILT_IN_CLZ*
"These functions return the number of leading 0-bits in a, starting
at the most significant bit position. If a is zero, the result
is undefined."
and
BUILT_IN_CTZ*
"These functions return the number of trailing 0-bits in a, starting at the
least significant bit position. If a is zero, the result is undefined."
(Description copied from
http://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html)
For compile-time simplification, MPFR does not seem to provide a ready-to-use
function; if one cooks up something oneself, one needs to check endian issues
(though there might be none).
--
Summary: Fortran 2008: Support LEADZ / TRAILZ
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
@ 2008-09-24 16:21 ` kargl at gcc dot gnu dot org
2008-09-24 22:29 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-09-24 16:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kargl at gcc dot gnu dot org 2008-09-24 16:19 -------
(In reply to comment #0)
> For compile-time simplification, MPFR does not seem to provide a ready-to-use
> function; if one cooks up something oneself, one needs to check endian issues
> (though there might be none).
I think you mean GMP because we're concerned with INTEGER types.
See mpz_scan0 and mpz_scan1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
2008-09-24 16:21 ` [Bug fortran/37635] " kargl at gcc dot gnu dot org
@ 2008-09-24 22:29 ` steven at gcc dot gnu dot org
2008-09-27 14:11 ` steven at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-09-24 22:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from steven at gcc dot gnu dot org 2008-09-24 22:28 -------
I'll see this weekend if I can take care of this.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-09-24 22:28:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
2008-09-24 16:21 ` [Bug fortran/37635] " kargl at gcc dot gnu dot org
2008-09-24 22:29 ` steven at gcc dot gnu dot org
@ 2008-09-27 14:11 ` steven at gcc dot gnu dot org
2008-09-28 18:05 ` burnus at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-09-27 14:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from steven at gcc dot gnu dot org 2008-09-27 14:09 -------
Created an attachment (id=16414)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16414&action=view)
draft patch
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-09-27 14:11 ` steven at gcc dot gnu dot org
@ 2008-09-28 18:05 ` burnus at gcc dot gnu dot org
2008-10-02 18:53 ` steven at gcc dot gnu dot org
2008-10-02 18:53 ` steven at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-28 18:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2008-09-28 18:03 -------
Posted patch:
http://gcc.gnu.org/ml/fortran/2008-09/msg00443.html
Approved, but check in will probably deferred until 4.5 opens.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-09-28 18:05 ` burnus at gcc dot gnu dot org
@ 2008-10-02 18:53 ` steven at gcc dot gnu dot org
2008-10-02 18:53 ` steven at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-10-02 18:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from steven at gcc dot gnu dot org 2008-10-02 18:52 -------
Subject: Bug 37635
Author: steven
Date: Thu Oct 2 18:51:12 2008
New Revision: 140837
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140837
Log:
testsuite
* gfortran.fortran-torture/execute/intrinsic_leadz.f90: New test.
* gfortran.fortran-torture/execute/intrinsic_trailz.f90: New test.
fortran/
PR fortran/37635
* intrinsic.c (add_functions): Add LEADZ and TRAILZ as generics.
* intrinsic.h (gfc_simplify_leadz, gfc_simplify_trailz): New protos.
* gfortran.h <enum gfc_isym_id>: (GFC_ISYM_LEADZ, GFC_ISYM_TRAILZ):
New.
* f95-lang (gfc_init_builtin_functions): Add BUILT_IN_CLZ,
BUILT_IN_CLZL, BUILT_IN_CLZLL, BUILT_IN_CTZ, BUILT_IN_CTZL, and
BUILT_IN_CTZLL.
* trans-intrinsic.c (gfc_conv_intrinsic_leadz,
gfc_conv_intrinsic_trails): New code-generation functions for LEADZ
and TRAILZ intrinsics.
(gfc_conv_intrinsic_function): Use them
* intrinsic.texi: Add documentation for LEADZ and TRAILZ.
* simplify.c (gfc_simplify_leadz, gfc_simplify_trailz): New functions.
Added:
trunk/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_leadz.f90
trunk/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_trailz.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/f95-lang.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/intrinsic.h
trunk/gcc/fortran/intrinsic.texi
trunk/gcc/fortran/simplify.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/37635] Fortran 2008: Support LEADZ / TRAILZ
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-10-02 18:53 ` steven at gcc dot gnu dot org
@ 2008-10-02 18:53 ` steven at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-10-02 18:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from steven at gcc dot gnu dot org 2008-10-02 18:52 -------
.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37635
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-02 18:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 8:16 [Bug fortran/37635] New: Fortran 2008: Support LEADZ / TRAILZ burnus at gcc dot gnu dot org
2008-09-24 16:21 ` [Bug fortran/37635] " kargl at gcc dot gnu dot org
2008-09-24 22:29 ` steven at gcc dot gnu dot org
2008-09-27 14:11 ` steven at gcc dot gnu dot org
2008-09-28 18:05 ` burnus at gcc dot gnu dot org
2008-10-02 18:53 ` steven at gcc dot gnu dot org
2008-10-02 18:53 ` steven at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).