public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	Bernhard Reutner-Fischer <aldot@gcc.gnu.org>,
	gfortran ML <fortran@gcc.gnu.org>
Subject: [PATCH 0/2] Fortran: add attribute target_clones
Date: Wed,  9 Nov 2022 20:02:23 +0100	[thread overview]
Message-ID: <20221109190225.96037-1-aldot@gcc.gnu.org> (raw)

Hi!

These two patches add support for attribute target_clones to the fortran
frontend.

1) The symtab hunk is identical to the one sent in
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605081.html
which had some additional information.
I only tested it on x86_64-unknown-linux and for
languages c,fortran,c++,lto so far, i.e. not for ada,go,d,modula2

2) fortran FE hunks
I'm aware that the documentation will have to be rewritten now for
Sphinx.
I'll will take care of that before pushing the change anyway, of course.

The fortran FE part works as intended.
Note that it is of course not possible to mix ISA features of different
target architectures, i.e. "sse","avx512f" is fine, "powerpc7" in the
same attribute is prohibited.

There is a gotcha that took me a while to (re-)notice when writing the
testcase though: We (the fortran FE, fortran/cpp.cc) do not define arch
defines. Consider:
$ echo -e "#ifndef __x86_64__\nbummer\n#endif\nend" > /tmp/ouch.F95
$ ./gfortran -B. -c -o /tmp/ouch.o /tmp/ouch.F95
/tmp/ouch.F95:2:1:

    2 | bummer
      | 1
Error: Unclassifiable statement at (1)

$ echo -e "#ifndef __x86_64__\nbummer\n#endif" \
  | ./xgcc -B. -x f95-cpp-input -ffree-form -E -dD - | grep -i x86
$ # nothing
versus
$ echo -e "#ifndef __x86_64__\nbummer\n#endif" \
  | ./xgcc -B. -x assembler-with-cpp -E -dD - | grep -i x86
#define __x86_64 1
#define __x86_64__ 1

I'm sure we have existing PRs about those missing defines but i didn't
look yet.


Bernhard Reutner-Fischer (2):
  symtab: also change RTL decl name
  Fortran: add attribute target_clones

 gcc/fortran/decl.cc                           | 104 ++++++++++++++++++
 gcc/fortran/f95-lang.cc                       |   4 +
 gcc/fortran/gfortran.h                        |   2 +
 gcc/fortran/gfortran.texi                     |  31 ++++++
 gcc/fortran/trans-decl.cc                     |   3 +
 gcc/symtab.cc                                 |   6 +-
 .../gfortran.dg/attr_target_clones-1.F90      |  30 +++++
 7 files changed, 178 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/attr_target_clones-1.F90

-- 
2.38.1


             reply	other threads:[~2022-11-09 19:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 19:02 Bernhard Reutner-Fischer [this message]
2022-11-09 19:02 ` [PATCH 1/2] symtab: also change RTL decl name Bernhard Reutner-Fischer
2022-11-17  8:02   ` Bernhard Reutner-Fischer
2022-11-21 18:24     ` Mikael Morin
2022-11-21 19:02     ` Jan Hubicka
2022-11-21 19:47       ` Bernhard Reutner-Fischer
2022-11-22 11:54         ` Jan Hubicka
2023-02-19  2:29           ` Bernhard Reutner-Fischer
2023-02-19  2:49             ` Bernhard Reutner-Fischer
2022-11-09 19:02 ` [PATCH 2/2] Fortran: add attribute target_clones Bernhard Reutner-Fischer
2022-11-21 19:13   ` Mikael Morin
2022-11-21 22:26     ` Bernhard Reutner-Fischer
2022-11-22 13:17       ` Mikael Morin

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=20221109190225.96037-1-aldot@gcc.gnu.org \
    --to=rep.dot.nop@gmail.com \
    --cc=aldot@gcc.gnu.org \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).