public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10022] rs6000: Ignore fusion option flags for inlining test [PR102059]
@ 2022-05-19 21:20 Peter Bergner
  0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2022-05-19 21:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3ea6d0ed6860e4f1d8f609c26de9d9a7f7a9ad2d

commit r11-10022-g3ea6d0ed6860e4f1d8f609c26de9d9a7f7a9ad2d
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Fri May 6 11:39:13 2022 -0500

    rs6000: Ignore fusion option flags for inlining test [PR102059]
    
    The -mpower8-fusion and -mpower10-fusion options do not modify which
    instructions we can generate, so ignore them when deciding whether we
    can inline callee into caller.
    
    2022-05-06  Michael Meissner  <meissner@linux.ibm.com>
                Segher Boessenkool  <segher@kernel.crashing.org>
    
    gcc/
            PR target/102059
            * config/rs6000/rs6000.c (rs6000_can_inline_p): Ignore -mpower8-fusion
            and -mpower10-fusion options for inlining purposes.
    
    gcc/testsuite/
            PR target/102059
            * gcc.target/powerpc/pr102059-4.c: New test.
    
    (cherry picked from commit 2fb654f77d5292864ef57040f7bc01d7a975f6d9)

Diff:
---
 gcc/config/rs6000/rs6000.c                    |  5 +++++
 gcc/testsuite/gcc.target/powerpc/pr102059-4.c | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0421dc7adb3..83748d47657 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -25074,6 +25074,11 @@ rs6000_can_inline_p (tree caller, tree callee)
       else
 	caller_isa = rs6000_isa_flags;
 
+      /* Ignore -mpower8-fusion and -mpower10-fusion options for inlining
+	 purposes.  */
+      callee_isa &= ~(OPTION_MASK_P8_FUSION | OPTION_MASK_P10_FUSION);
+      explicit_isa &= ~(OPTION_MASK_P8_FUSION | OPTION_MASK_P10_FUSION);
+
       /* The callee's options must be a subset of the caller's options, i.e.
 	 a vsx function may inline an altivec function, but a no-vsx function
 	 must not inline a vsx function.  However, for those options that the
diff --git a/gcc/testsuite/gcc.target/powerpc/pr102059-4.c b/gcc/testsuite/gcc.target/powerpc/pr102059-4.c
new file mode 100644
index 00000000000..4a0ad3daf73
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr102059-4.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-require-effective-target power10_ok } */
+
+/* Verify that power10 can explicity include functions compiled for power8.
+   The issue was -mcpu=power8 enables -mpower8-fusion, but -mcpu=power9 or
+   -mcpu=power10 do not set power8-fusion by default.  Thus when doing this
+   compilation, they would get an error that the inline function failed in its
+   inlining due to having incompatible options.  */
+
+static inline int __attribute__ ((always_inline,target("cpu=power8,no-htm")))
+foo (int *b)
+{
+  *b += 10;
+  return *b;
+}
+
+int
+bar (int *a)
+{
+  *a = foo (a);
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-19 21:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 21:20 [gcc r11-10022] rs6000: Ignore fusion option flags for inlining test [PR102059] Peter Bergner

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