public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make multiple_target.c aware of LTO (PR lto/66295)
@ 2017-01-16  9:30 Martin Liška
  2017-01-17  1:03 ` Jan Hubicka
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Martin Liška @ 2017-01-16  9:30 UTC (permalink / raw)
  To: GCC Patches; +Cc: evstupac, Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Hello.

Not being expert in multi_target area, however it consists of 2 passes. The first
one (ipa_target_clone) is responsible for creation of multiple targets for functions
decorated with __attribute__((target_clones("xxx"))). I guess the pass should be
called just in LGEN phase and consecutive clone materialization takes care of these
clones. I'm also adding lto test-case.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
mvc test-cases work find on x86_64-linux-gnu.

Ready to be installed?
Martin

[-- Attachment #2: 0001-Make-multiple_target.c-aware-of-LTO-PR-lto-66295.patch --]
[-- Type: text/x-patch, Size: 1663 bytes --]

From 7ec7045680e10838c43b2713a4fa34b205ba5004 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 13 Jan 2017 15:26:45 +0100
Subject: [PATCH] Make multiple_target.c aware of LTO (PR lto/66295)

gcc/ChangeLog:

2017-01-13  Martin Liska  <mliska@suse.cz>

	PR lto/66295
	* multiple_target.c (pass_target_clone::gate): Run the pass
	just in LGEN (in LTO mode).

gcc/testsuite/ChangeLog:

2017-01-13  Martin Liska  <mliska@suse.cz>

	PR lto/66295
	* gcc.target/i386/mvc9.c: New test.
---
 gcc/multiple_target.c                |  2 +-
 gcc/testsuite/gcc.target/i386/mvc9.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/mvc9.c

diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index 5be3980db20..3df1e297122 100644
--- a/gcc/multiple_target.c
+++ b/gcc/multiple_target.c
@@ -378,7 +378,7 @@ public:
 bool
 pass_target_clone::gate (function *)
 {
-  return true;
+  return !flag_wpa && !flag_ltrans;
 }
 
 } // anon namespace
diff --git a/gcc/testsuite/gcc.target/i386/mvc9.c b/gcc/testsuite/gcc.target/i386/mvc9.c
new file mode 100644
index 00000000000..d510b6c18b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mvc9.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-require-ifunc "" } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto" } */
+
+__attribute__((target_clones("avx","arch=slm","arch=core-avx2","default")))
+int
+foo ()
+{
+  return -2;
+}
+
+int
+bar ()
+{
+  return 2;
+}
+
+int
+main ()
+{
+  int r = 0;
+  r += bar ();
+  r += foo ();
+  r += bar ();
+  r += foo ();
+  r += bar ();
+  return r - 2;
+}
-- 
2.11.0


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

end of thread, other threads:[~2017-03-15 10:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16  9:30 [PATCH] Make multiple_target.c aware of LTO (PR lto/66295) Martin Liška
2017-01-17  1:03 ` Jan Hubicka
2017-01-17  9:33   ` Richard Biener
2017-02-02 13:18   ` Martin Liška
2017-02-03 13:42     ` Martin Liška
2017-02-03 13:43     ` Martin Liška
2017-02-02 13:20 ` [PATCH] IPA: enhance dump output Martin Liška
2017-02-02 14:54   ` Jan Hubicka
2017-02-03 13:40     ` Martin Liška
2017-03-13 15:19 ` [PATCH 2] Fix multiple target clones nodes (PR lto/66295) Martin Liška
2017-03-14  9:46   ` Richard Biener
2017-03-14 10:09     ` Martin Liška
2017-03-14 10:29       ` Richard Biener
2017-03-14 11:04         ` Martin Liška
2017-03-14 11:11           ` Richard Biener
2017-03-15  9:30   ` Rainer Orth
2017-03-15 10:04     ` Martin Liška

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