public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45159] Unneccessary temporaries
Date: Sun, 01 Aug 2010 16:52:00 -0000	[thread overview]
Message-ID: <20100801165226.12155.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45159-13404@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from burnus at gcc dot gnu dot org  2010-08-01 16:52 -------
! --- FOUR ----  (also occurs for Octopus)

      subroutine t2(b,c)
        implicit none
        REAL :: b(3,3),c(3)
        c = matmul(b, c)
      end subroutine

That's a pattern I see quite often: LHS variable on the RHS as second (or
first) argument to MATMUL. However, no temporary is needed - but one probably
needs to handle this carefully and it depends how one generates the MATMUL
internally. While most implementation ways should work, one probably can
program it such that avoiding a temporary will lead to wrong results ...
Additionally, one should confirm that it works with-fexternal-blas

As a variant: The same but with one or two items TRANSPOSEd - or CONJugated.


! --- FIVE --- (Found in octopus, www.tddft.org [GPL])

  if(any(shape(a).ne.shape(b))) then

That generates two temporaries - one for each SHAPE.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45159


  reply	other threads:[~2010-08-01 16:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-01 16:32 [Bug fortran/45159] New: " burnus at gcc dot gnu dot org
2010-08-01 16:52 ` burnus at gcc dot gnu dot org [this message]
2010-08-01 17:28 ` [Bug fortran/45159] " burnus at gcc dot gnu dot org
2010-08-01 17:37 ` tkoenig at gcc dot gnu dot org
2010-08-01 18:12 ` tkoenig at gcc dot gnu dot org
2010-08-02 11:41 ` dominiq at lps dot ens dot fr
2010-08-02 12:42 ` burnus at gcc dot gnu dot org
2010-08-02 13:39 ` dominiq at lps dot ens dot fr
2010-08-02 14:10 ` [Bug fortran/45159] Unnecessary temporaries burnus at gcc dot gnu dot org
2010-08-02 14:36 ` dominiq at lps dot ens dot fr
2010-08-02 19:00 ` tkoenig at gcc dot gnu dot org
2010-08-02 22:05 ` tkoenig at gcc dot gnu dot org
2010-08-02 22:17 ` tkoenig at gcc dot gnu dot org
2010-08-03 22:03 ` tkoenig at gcc dot gnu dot org
2010-08-06 22:34 ` tkoenig at gcc dot gnu dot org
2010-08-09 21:54 ` tkoenig at gcc dot gnu dot org
2010-08-09 22:56 ` tkoenig at gcc dot gnu dot org
2010-08-10  8:45 ` dominiq at lps dot ens dot fr
2010-08-10  9:19 ` tkoenig at netcologne dot de
2010-08-10 12:01 ` dominiq at lps dot ens dot fr
2010-08-27 12:09 ` tkoenig at gcc dot gnu dot org
2010-09-03 16:17 ` tkoenig at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100801165226.12155.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).