diff options
author | Michael Meissner <meissner@linux.ibm.com> | 2022-05-06 11:39:13 -0500 |
---|---|---|
committer | Peter Bergner <bergner@linux.ibm.com> | 2022-05-06 11:40:43 -0500 |
commit | 2fb654f77d5292864ef57040f7bc01d7a975f6d9 (patch) | |
tree | 948376ddf38ee22ad197b64d320c20aa9ade9567 /gcc | |
parent | 37f57a3f4e48fe1a22dfc1544730483022ee5ffb (diff) | |
download | gcc-2fb654f77d5292864ef57040f7bc01d7a975f6d9.zip gcc-2fb654f77d5292864ef57040f7bc01d7a975f6d9.tar.gz gcc-2fb654f77d5292864ef57040f7bc01d7a975f6d9.tar.bz2 |
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>
gcc/
PR target/102059
* config/rs6000/rs6000.cc (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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/pr102059-4.c | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index bc61959..4030864 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -25350,6 +25350,11 @@ rs6000_can_inline_p (tree caller, tree callee) } } + /* 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 0000000..5fe66f8 --- /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"))) +foo (int *b) +{ + *b += 10; + return *b; +} + +int +bar (int *a) +{ + *a = foo (a); + return 0; +} |