diff options
author | Martin Jambor <mjambor@suse.cz> | 2017-07-31 14:43:24 +0200 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2017-07-31 14:43:24 +0200 |
commit | b32f12dece884f1fa0f04c643a77105aff6ce8bc (patch) | |
tree | cdab5f10806561fc198f907299b0e55eb5701ef0 /gcc/rtlanal.c | |
parent | 166bec868d991fdf71f9a66f994e5977fcab4aa2 (diff) | |
parent | a168a775e93ec31ae743ad282d8e60fa1c116891 (diff) | |
download | gcc-gcn.tar.gz |
Merge branch 'master' into gcngcn
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index bf4183e793d..9bfae8cb9b0 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -5263,23 +5263,41 @@ insn_rtx_cost (rtx pat, bool speed) int i, cost; rtx set; - /* Extract the single set rtx from the instruction pattern. - We can't use single_set since we only have the pattern. */ + /* Extract the single set rtx from the instruction pattern. We + can't use single_set since we only have the pattern. We also + consider PARALLELs of a normal set and a single comparison. In + that case we use the cost of the non-comparison SET operation, + which is most-likely to be the real cost of this operation. */ if (GET_CODE (pat) == SET) set = pat; else if (GET_CODE (pat) == PARALLEL) { set = NULL_RTX; + rtx comparison = NULL_RTX; + for (i = 0; i < XVECLEN (pat, 0); i++) { rtx x = XVECEXP (pat, 0, i); if (GET_CODE (x) == SET) { - if (set) - return 0; - set = x; + if (GET_CODE (SET_SRC (x)) == COMPARE) + { + if (comparison) + return 0; + comparison = x; + } + else + { + if (set) + return 0; + set = x; + } } } + + if (!set && comparison) + set = comparison; + if (!set) return 0; } |