diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2009-10-28 09:54:01 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2009-10-28 09:54:01 +0000 |
commit | 533d4b998d2161784cc6601bd71901ca0ddb14cc (patch) | |
tree | 57ac75653d612f2a822e2d3d5ed0f3dc05876f42 /gcc | |
parent | 42663bf1945195d1ead30d226010badbdb009bdb (diff) | |
download | gcc-533d4b998d2161784cc6601bd71901ca0ddb14cc.zip gcc-533d4b998d2161784cc6601bd71901ca0ddb14cc.tar.gz gcc-533d4b998d2161784cc6601bd71901ca0ddb14cc.tar.bz2 |
expmed.c (emit_store_flag): Check costs before transforming to the opposite representation.
2009-10-28 Paolo Bonzini <bonzini@gnu.org>
* expmed.c (emit_store_flag): Check costs before
transforming to the opposite representation.
From-SVN: r153647
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expmed.c | 24 |
2 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3312ddf..63353b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2009-10-28 Paolo Bonzini <bonzini@gnu.org> + * expmed.c (emit_store_flag): Check costs before + transforming to the opposite representation. + +2009-10-28 Paolo Bonzini <bonzini@gnu.org> + * config/sh/sh.md (cbranchfp4_media): Remove hack extending cstore result to DImode. diff --git a/gcc/expmed.c b/gcc/expmed.c index 12370d0..8a5cf50 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5498,9 +5498,13 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1, || (! HONOR_NANS (mode) && (code == LTGT || code == UNEQ)) || (! HONOR_SNANS (mode) && (code == EQ || code == NE)))) { + int want_add = ((STORE_FLAG_VALUE == 1 && normalizep == -1) + || (STORE_FLAG_VALUE == -1 && normalizep == 1)); + /* For the reverse comparison, use either an addition or a XOR. */ - if ((STORE_FLAG_VALUE == 1 && normalizep == -1) - || (STORE_FLAG_VALUE == -1 && normalizep == 1)) + if (want_add + && rtx_cost (GEN_INT (normalizep), PLUS, + optimize_insn_for_speed_p ()) == 0) { tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, STORE_FLAG_VALUE, target_mode); @@ -5509,7 +5513,9 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1, GEN_INT (normalizep), target, 0, OPTAB_WIDEN); } - else + else if (!want_add + && rtx_cost (trueval, XOR, + optimize_insn_for_speed_p ()) == 0) { tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, normalizep, target_mode); @@ -5596,9 +5602,13 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1, && GET_MODE_SIZE (mode) < UNITS_PER_WORD && op1 == const0_rtx)) { + int want_add = ((STORE_FLAG_VALUE == 1 && normalizep == -1) + || (STORE_FLAG_VALUE == -1 && normalizep == 1)); + /* Again, for the reverse comparison, use either an addition or a XOR. */ - if ((STORE_FLAG_VALUE == 1 && normalizep == -1) - || (STORE_FLAG_VALUE == -1 && normalizep == 1)) + if (want_add + && rtx_cost (GEN_INT (normalizep), PLUS, + optimize_insn_for_speed_p ()) == 0) { tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, STORE_FLAG_VALUE, target_mode); @@ -5606,7 +5616,9 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1, tem = expand_binop (target_mode, add_optab, tem, GEN_INT (normalizep), target, 0, OPTAB_WIDEN); } - else + else if (!want_add + && rtx_cost (trueval, XOR, + optimize_insn_for_speed_p ()) == 0) { tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0, normalizep, target_mode); |