Message ID | CAKdteObgr2tnX4x1CneBwbyWmpr_FBT+ZpeUdNZQpbRTUvQ8vA@mail.gmail.com |
---|---|
State | Accepted |
Commit | 227e57986a52f7aba4fbc819eec4b64ae2a9776f |
Headers | show |
Series | [ARM] Add -mbranch-cost option, and update a few tests | expand |
On Mon, Oct 23, 2017 at 02:30:24PM +0200, Christophe Lyon wrote: > After Jakub's suggestion in PR82120 and PR81184, the attached patch > adds the -mbranch-cost option to the ARM target. My understanding > is that it's intended to be used internally for testing and does not > require user-facing documentation. > > I have updated a few tests, validation on aarch64 & arm targets shows > no regression, > and a few improvements when targeting cortex-a5 or cortex-m3: > gcc.dg/tree-ssa/reassoc-3[3456].c now pass. > > That being said, I'm not sure about the other targets for which I > changed the condition, > and I am also concerned by the fact that it has no impact on > gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c (PR81184). > > Should I restrict my patch to the only tests where it has an impact > (gcc.dg/tree-ssa/reassoc-3[3456].c) ? Let's change all and watch the effects on all targets in testresults, we can fine tune later on. Does pr21643.c really fail somewhere on arm*? Tried -mcpu=cortex-a5 and don't see the failure in x86_64-linux -> armv7a-hardfloat-linux-gnueabi cross. > gcc/ChangeLog: > > 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> > > * config/arm/arm.opt (-mbranch-cost): New option. > * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into > account. > > gcc/testsuite/ChangeLog: > > 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> > > * lib/target-supports.exp (check_effective_target_branch_cost): > New function. > * gcc.dg/builtin-bswap-7.c: Use branch_cost effective target. > * gcc.dg/pr21643.c: Likewise. > * gcc.dg/pr46309.c: Likewise. > * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. > * gcc.dg/tree-ssa/phi-opt-2.c: Likewise. > * gcc.dg/tree-ssa/reassoc-32.c: Likewise. > * gcc.dg/tree-ssa/reassoc-33.c: Likewise. > * gcc.dg/tree-ssa/reassoc-34.c: Likewise. > * gcc.dg/tree-ssa/reassoc-35.c: Likewise. > * gcc.dg/tree-ssa/reassoc-36.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise. Ok for trunk. Note, unreviewed patches should be pinged from time to time. Jakub
On 10 January 2018 at 15:44, Jakub Jelinek <jakub@redhat.com> wrote: > On Mon, Oct 23, 2017 at 02:30:24PM +0200, Christophe Lyon wrote: >> After Jakub's suggestion in PR82120 and PR81184, the attached patch >> adds the -mbranch-cost option to the ARM target. My understanding >> is that it's intended to be used internally for testing and does not >> require user-facing documentation. >> >> I have updated a few tests, validation on aarch64 & arm targets shows >> no regression, >> and a few improvements when targeting cortex-a5 or cortex-m3: >> gcc.dg/tree-ssa/reassoc-3[3456].c now pass. >> >> That being said, I'm not sure about the other targets for which I >> changed the condition, >> and I am also concerned by the fact that it has no impact on >> gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c (PR81184). >> >> Should I restrict my patch to the only tests where it has an impact >> (gcc.dg/tree-ssa/reassoc-3[3456].c) ? > > Let's change all and watch the effects on all targets in testresults, > we can fine tune later on. > OK, thanks > Does pr21643.c really fail somewhere on arm*? Tried -mcpu=cortex-a5 > and don't see the failure in x86_64-linux -> armv7a-hardfloat-linux-gnueabi > cross. Yes, for me still fails on arm-none-linux-gnueabihf --with-cpu=cortex-a5 --with-fpu=vfpv3-d16-fp16 > >> gcc/ChangeLog: >> >> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >> >> * config/arm/arm.opt (-mbranch-cost): New option. >> * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into >> account. >> >> gcc/testsuite/ChangeLog: >> >> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >> >> * lib/target-supports.exp (check_effective_target_branch_cost): >> New function. >> * gcc.dg/builtin-bswap-7.c: Use branch_cost effective target. >> * gcc.dg/pr21643.c: Likewise. >> * gcc.dg/pr46309.c: Likewise. >> * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. >> * gcc.dg/tree-ssa/phi-opt-2.c: Likewise. >> * gcc.dg/tree-ssa/reassoc-32.c: Likewise. >> * gcc.dg/tree-ssa/reassoc-33.c: Likewise. >> * gcc.dg/tree-ssa/reassoc-34.c: Likewise. >> * gcc.dg/tree-ssa/reassoc-35.c: Likewise. >> * gcc.dg/tree-ssa/reassoc-36.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise. > > Ok for trunk. > > Note, unreviewed patches should be pinged from time to time. Sorry, I thought the patch was too crappy ;-) Thanks, Christophe > > Jakub
Hi Christophe, > On 10 January 2018 at 15:44, Jakub Jelinek <jakub@redhat.com> wrote: >> On Mon, Oct 23, 2017 at 02:30:24PM +0200, Christophe Lyon wrote: >>> After Jakub's suggestion in PR82120 and PR81184, the attached patch >>> adds the -mbranch-cost option to the ARM target. My understanding >>> is that it's intended to be used internally for testing and does not >>> require user-facing documentation. >>> >>> I have updated a few tests, validation on aarch64 & arm targets shows >>> no regression, >>> and a few improvements when targeting cortex-a5 or cortex-m3: >>> gcc.dg/tree-ssa/reassoc-3[3456].c now pass. >>> >>> That being said, I'm not sure about the other targets for which I >>> changed the condition, >>> and I am also concerned by the fact that it has no impact on >>> gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c (PR81184). >>> >>> Should I restrict my patch to the only tests where it has an impact >>> (gcc.dg/tree-ssa/reassoc-3[3456].c) ? >> >> Let's change all and watch the effects on all targets in testresults, >> we can fine tune later on. >> > OK, thanks > >> Does pr21643.c really fail somewhere on arm*? Tried -mcpu=cortex-a5 >> and don't see the failure in x86_64-linux -> armv7a-hardfloat-linux-gnueabi >> cross. > > Yes, for me still fails on arm-none-linux-gnueabihf > --with-cpu=cortex-a5 --with-fpu=vfpv3-d16-fp16 > >> >>> gcc/ChangeLog: >>> >>> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >>> >>> * config/arm/arm.opt (-mbranch-cost): New option. >>> * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into >>> account. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >>> >>> * lib/target-supports.exp (check_effective_target_branch_cost): >>> New function. >>> * gcc.dg/builtin-bswap-7.c: Use branch_cost effective target. >>> * gcc.dg/pr21643.c: Likewise. >>> * gcc.dg/pr46309.c: Likewise. >>> * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. >>> * gcc.dg/tree-ssa/phi-opt-2.c: Likewise. >>> * gcc.dg/tree-ssa/reassoc-32.c: Likewise. >>> * gcc.dg/tree-ssa/reassoc-33.c: Likewise. >>> * gcc.dg/tree-ssa/reassoc-34.c: Likewise. >>> * gcc.dg/tree-ssa/reassoc-35.c: Likewise. >>> * gcc.dg/tree-ssa/reassoc-36.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise. >>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise. >> >> Ok for trunk. >> >> Note, unreviewed patches should be pinged from time to time. > Sorry, I thought the patch was too crappy ;-) not at all, but it has two problems: * The new branch_cost effective-target keyword needs documenting in sourcebuild.texi, as always. * The patch caused a regression on non-Linux x86 targets: FAIL: gcc.dg/tree-ssa/phi-opt-2.c scan-tree-dump-times optimized "if" 1 (found 0 times) I'm seeing this on i386-pc-solaris2.*, and according to gcc-testresults it happens on *86-*-freebsd*, too. The reason is simple: while the original testcase enabled -mbranch-cost for all i?86-*-* and x86_64-*-* targets, the new branch_cost keyword does so only for i?86-*-linux* and x86_64-*-linux* for no reason I can see. Fixing that lets the test PASS on Solaris/x86, too, so I'm installing the following patch. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2018-01-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * lib/target-supports.exp (check_effective_target_branch_cost): Accept all x86 targets. # HG changeset patch # Parent 76d1f957bcf2be744c67e2ff4587f00e87722cc9 Include all x86 targets in branch_cost effective target diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8623,7 +8623,7 @@ proc check_effective_target_branch_cost || [istarget avr*-*-*] || [istarget epiphany*-*-*] || [istarget frv*-*-*] - || [istarget i?86-*-linux*] || [istarget x86_64-*-linux*] + || [istarget i?86-*-*] || [istarget x86_64-*-*] || [istarget mips*-*-*] || [istarget s390*-*-*] || [istarget riscv*-*-*]
On 12 January 2018 at 10:25, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > Hi Christophe, > >> On 10 January 2018 at 15:44, Jakub Jelinek <jakub@redhat.com> wrote: >>> On Mon, Oct 23, 2017 at 02:30:24PM +0200, Christophe Lyon wrote: >>>> After Jakub's suggestion in PR82120 and PR81184, the attached patch >>>> adds the -mbranch-cost option to the ARM target. My understanding >>>> is that it's intended to be used internally for testing and does not >>>> require user-facing documentation. >>>> >>>> I have updated a few tests, validation on aarch64 & arm targets shows >>>> no regression, >>>> and a few improvements when targeting cortex-a5 or cortex-m3: >>>> gcc.dg/tree-ssa/reassoc-3[3456].c now pass. >>>> >>>> That being said, I'm not sure about the other targets for which I >>>> changed the condition, >>>> and I am also concerned by the fact that it has no impact on >>>> gcc.dg/pr21643.c and gcc.dg/tree-ssa/phi-opt-11.c (PR81184). >>>> >>>> Should I restrict my patch to the only tests where it has an impact >>>> (gcc.dg/tree-ssa/reassoc-3[3456].c) ? >>> >>> Let's change all and watch the effects on all targets in testresults, >>> we can fine tune later on. >>> >> OK, thanks >> >>> Does pr21643.c really fail somewhere on arm*? Tried -mcpu=cortex-a5 >>> and don't see the failure in x86_64-linux -> armv7a-hardfloat-linux-gnueabi >>> cross. >> >> Yes, for me still fails on arm-none-linux-gnueabihf >> --with-cpu=cortex-a5 --with-fpu=vfpv3-d16-fp16 >> >>> >>>> gcc/ChangeLog: >>>> >>>> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >>>> >>>> * config/arm/arm.opt (-mbranch-cost): New option. >>>> * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into >>>> account. >>>> >>>> gcc/testsuite/ChangeLog: >>>> >>>> 2017-10-23 Christophe Lyon <christophe.lyon@linaro.org> >>>> >>>> * lib/target-supports.exp (check_effective_target_branch_cost): >>>> New function. >>>> * gcc.dg/builtin-bswap-7.c: Use branch_cost effective target. >>>> * gcc.dg/pr21643.c: Likewise. >>>> * gcc.dg/pr46309.c: Likewise. >>>> * gcc.dg/tree-ssa/phi-opt-11.c: Likewise. >>>> * gcc.dg/tree-ssa/phi-opt-2.c: Likewise. >>>> * gcc.dg/tree-ssa/reassoc-32.c: Likewise. >>>> * gcc.dg/tree-ssa/reassoc-33.c: Likewise. >>>> * gcc.dg/tree-ssa/reassoc-34.c: Likewise. >>>> * gcc.dg/tree-ssa/reassoc-35.c: Likewise. >>>> * gcc.dg/tree-ssa/reassoc-36.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise. >>>> * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise. >>> >>> Ok for trunk. >>> >>> Note, unreviewed patches should be pinged from time to time. >> Sorry, I thought the patch was too crappy ;-) > > not at all, but it has two problems: > > * The new branch_cost effective-target keyword needs documenting in > sourcebuild.texi, as always. > Sorry, I keep forgetting this. How about the trivial attached patch? (I'm mainly asking to check I add it to the most appropriate section) > * The patch caused a regression on non-Linux x86 targets: > > FAIL: gcc.dg/tree-ssa/phi-opt-2.c scan-tree-dump-times optimized "if" 1 (found 0 times) > > I'm seeing this on i386-pc-solaris2.*, and according to > gcc-testresults it happens on *86-*-freebsd*, too. The reason is > simple: while the original testcase enabled -mbranch-cost for all > i?86-*-* and x86_64-*-* targets, the new branch_cost keyword does so > only for i?86-*-linux* and x86_64-*-linux* for no reason I can see. > Fixing that lets the test PASS on Solaris/x86, too, so I'm installing > the following patch. > Thanks for taking care of that, I can't remember why I added the *linux* part. Christophe > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > > > 2018-01-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> > > * lib/target-supports.exp (check_effective_target_branch_cost): > Accept all x86 targets. > 2018-01-12 Christophe Lyon <christophe.lyon@linaro.org> * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): Add item for branch_cost. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index f7de713..e4a3835 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2133,6 +2133,9 @@ Target supports wide characters. @item automatic_stack_alignment Target supports automatic stack alignment. +@item branch_cost +Target supports @option{-branch-cost=N}. + @item cxa_atexit Target uses @code{__cxa_atexit}.
Hi Christophe, >> not at all, but it has two problems: >> >> * The new branch_cost effective-target keyword needs documenting in >> sourcebuild.texi, as always. >> > > Sorry, I keep forgetting this. How about the trivial attached patch? (I'm mainly > asking to check I add it to the most appropriate section) it can be non-trivial at times :-) > 2018-01-12 Christophe Lyon <christophe.lyon@linaro.org> > > * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): > Add item for branch_cost. Ok, thanks. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 2d71e8f..854c753 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1946,8 +1946,9 @@ enum arm_auto_incmodes /* Try to generate sequences that don't involve branches, we can then use conditional instructions. */ -#define BRANCH_COST(speed_p, predictable_p) \ - (current_tune->branch_cost (speed_p, predictable_p)) +#define BRANCH_COST(speed_p, predictable_p) \ + ((arm_branch_cost != -1) ? arm_branch_cost : \ + (current_tune->branch_cost (speed_p, predictable_p))) /* False if short circuit operation is preferred. */ #define LOGICAL_OP_NON_SHORT_CIRCUIT \ diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index 6060516..a3719cb 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -294,3 +294,7 @@ When linking for big-endian targets, generate a BE8 format image. mbe32 Target Report RejectNegative Negative(mbe8) InverseMask(BE8) When linking for big-endian targets, generate a legacy BE32 format image. + +mbranch-cost= +Target RejectNegative Joined UInteger Var(arm_branch_cost) Init(-1) +Cost to assume for a branch insn. diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-7.c b/gcc/testsuite/gcc.dg/builtin-bswap-7.c index 3e1718d..fe85441 100644 --- a/gcc/testsuite/gcc.dg/builtin-bswap-7.c +++ b/gcc/testsuite/gcc.dg/builtin-bswap-7.c @@ -5,7 +5,7 @@ /* The branch cost setting prevents the return value from being calculated with arithmetic instead of doing a compare. */ -/* { dg-additional-options "-mbranch-cost=0" { target s390x-*-* } } */ +/* { dg-additional-options "-mbranch-cost=0" { target branch_cost } } */ #include <stdint.h> diff --git a/gcc/testsuite/gcc.dg/pr21643.c b/gcc/testsuite/gcc.dg/pr21643.c index bd76aa8..d981fbc 100644 --- a/gcc/testsuite/gcc.dg/pr21643.c +++ b/gcc/testsuite/gcc.dg/pr21643.c @@ -1,6 +1,7 @@ /* PR tree-optimization/21643 */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-reassoc1-details" } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int f1 (unsigned char c) diff --git a/gcc/testsuite/gcc.dg/pr46309.c b/gcc/testsuite/gcc.dg/pr46309.c index 68229cf..c964529 100644 --- a/gcc/testsuite/gcc.dg/pr46309.c +++ b/gcc/testsuite/gcc.dg/pr46309.c @@ -4,7 +4,7 @@ /* The transformation depends on BRANCH_COST being greater than 1 (see the notes in the PR), so try to force that. */ /* { dg-additional-options "-mtune=octeon2" { target mips*-*-* } } */ -/* { dg-additional-options "-mbranch-cost=2" { target avr*-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int f1 (int a) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c index cda3abf..20728fc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized" } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int f(int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c index 1408122..e0b2618 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=1" { target { i?86-*-* x86_64-*-* mips*-*-* s390*-*-* avr*-*-* } } } */ +/* { dg-additional-options "-mbranch-cost=1" { target branch_cost } } */ _Bool f1(_Bool a, _Bool b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c index 3ac1fb6..b6ca8e2 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c @@ -1,7 +1,7 @@ /* { dg-do run { target { ! "m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-*"} } } */ /* { dg-options "-O2 -fno-inline -fdump-tree-reassoc1-details" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int test (int a, int b, int c) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c index 6811a42..5572df4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c @@ -1,7 +1,7 @@ /* { dg-do run { target { ! "m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */ /* { dg-options "-O2 -fno-inline -fdump-tree-reassoc1-details" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int test (int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c index 523654d..9b45f1c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c @@ -1,7 +1,7 @@ /* { dg-do run { target { ! "m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */ /* { dg-options "-O2 -fno-inline -fdump-tree-reassoc1-details" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int test (int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c index 216604e..9ee3abc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c @@ -1,7 +1,7 @@ /* { dg-do run { target { ! "m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */ /* { dg-options "-O2 -fno-inline -fdump-tree-reassoc1-details" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int test (unsigned int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c index dbbf8a1..ac3a042 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c @@ -1,7 +1,7 @@ /* { dg-do run { target { ! "m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* hppa*-*-* nios2*-*-*"} } } */ /* { dg-options "-O2 -fno-inline -fdump-tree-reassoc1-details" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int test (int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c index 7f4f011..5f3147a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized-details-blocks" } */ -/* { dg-additional-options "-mbranch-cost=2" { target { i?86-*-* x86_64-*-* s390*-*-* avr*-*-* } } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ _Bool f1(_Bool a, _Bool b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c index acfcb7d..1714fcf 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c index 0435d55..f35ec5e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c index 4f2b570..d84bdd5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c index 9c64b5e..be0ee26 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c index 8cd4a60..09c22ab 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b, int c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c index c161b16..a0dc82d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! { { logical_op_short_circuit && { ! avr-*-* } } || { m68k*-*-* mmix*-*-* bfin*-*-* v850*-*-* moxie*-*-* cris*-*-* m32c*-*-* fr30*-*-* mcore*-*-* powerpc*-*-* xtensa*-*-* arc*-*-* mips*-*-* } } } } } */ /* { dg-options "-O2 -g -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target mips*-*-* avr-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */ int t (int a, int b, int c) { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 3ddc92e..8ffd1c4 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8184,6 +8184,24 @@ proc check_effective_target_logical_op_short_circuit {} { return 0 } +# Return 1 if the target supports -mbranch-cost=N option. + +proc check_effective_target_branch_cost {} { + if { [ istarget arm*-*-*] + || [istarget avr*-*-*] + || [istarget epiphany*-*-*] + || [istarget frv*-*-*] + || [istarget i?86-*-linux*] || [istarget x86_64-*-linux*] + || [istarget mips*-*-*] + || [istarget s390*-*-*] + || [istarget riscv*-*-*] + || [istarget sh*-*-*] + || [istarget spu*-*-*] } { + return 1 + } + return 0 +} + # Record that dg-final test TEST requires convential compilation. proc force_conventional_output_for { test } {