public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fortran: add attribute target_clones
@ 2022-11-09 19:02 Bernhard Reutner-Fischer
  2022-11-09 19:02 ` [PATCH 1/2] symtab: also change RTL decl name Bernhard Reutner-Fischer
  2022-11-09 19:02 ` [PATCH 2/2] Fortran: add attribute target_clones Bernhard Reutner-Fischer
  0 siblings, 2 replies; 13+ messages in thread
From: Bernhard Reutner-Fischer @ 2022-11-09 19:02 UTC (permalink / raw)
  To: gcc-patches
  Cc: Bernhard Reutner-Fischer, Bernhard Reutner-Fischer, gfortran ML

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-02-19  2:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 19:02 [PATCH 0/2] Fortran: add attribute target_clones Bernhard Reutner-Fischer
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

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).