diff options
author | Jeff Law <law@redhat.com> | 2020-11-23 13:06:11 -0700 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2020-11-23 13:06:11 -0700 |
commit | f80565da33598c4dbc70ea9c83272ed6bfff7a0d (patch) | |
tree | fb3c9af25bc1472fbe66253e09eb2995c835a441 /gcc/config/h8300 | |
parent | 53a90650663e59948f86505660604b5769cf808c (diff) | |
download | gcc-f80565da33598c4dbc70ea9c83272ed6bfff7a0d.zip gcc-f80565da33598c4dbc70ea9c83272ed6bfff7a0d.tar.gz gcc-f80565da33598c4dbc70ea9c83272ed6bfff7a0d.tar.bz2 |
Adjust rtx_costs for h8300
So the primary purpose of this patch is to make it easier to write tests for
removal of useless test/compare insns on the H8.
In simplest terms the costing model in the H8 port tends to encourage changing
something like:
x = y + 4;
if (x == 0)
into:
x = y + 4;
if (y == -4)
This is a marginal de-optimization on the H8. So fixing it makes the code
ever-so-slightly better in isolation. Fixing this also improves redundant
test/compare elimination and makes writing tests for redundant test/compare
elimination far easier.
gcc/
* config/h8300/h8300.c (h8300_rtx_costs): Handle the various
comparison rtx codes too.
Diffstat (limited to 'gcc/config/h8300')
-rw-r--r-- | gcc/config/h8300/h8300.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 1982e26..09e9cbf 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1199,6 +1199,16 @@ h8300_rtx_costs (rtx x, machine_mode mode ATTRIBUTE_UNUSED, int outer_code, return true; case COMPARE: + case NE: + case EQ: + case GE: + case GT: + case LE: + case LT: + case GEU: + case GTU: + case LEU: + case LTU: if (XEXP (x, 1) == const0_rtx) *total = 0; return false; |