aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2018-11-03 14:12:44 -0400
committerSandra Loosemore <sandra@gcc.gnu.org>2018-11-03 14:12:44 -0400
commit2eae232fc5a21f533ab7042475de7d6906248d14 (patch)
tree9b27591c63fb419a97dfbeffca2b69a0eab218b8 /gcc/config
parentb15ed67b3d103397393ebf07c92b0b3188d191cd (diff)
downloadgcc-2eae232fc5a21f533ab7042475de7d6906248d14.zip
gcc-2eae232fc5a21f533ab7042475de7d6906248d14.tar.gz
gcc-2eae232fc5a21f533ab7042475de7d6906248d14.tar.bz2
re PR target/87079 (nios2 optimization for size - case of regression relatively to 5.3.0)
2018-11-03 Sandra Loosemore <sandra@codesourcery.com> PR target/87079 gcc/ * config/nios2/nios2.c (nios2_rtx_costs): Recognize <mul>sidi3 pattern. gcc/testsuite/ * gcc.target/nios2/pr87079-1.c: New. * gcc.target/nios2/pr87079-2.c: New. From-SVN: r265770
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/nios2/nios2.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index 78d5858..e266924 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -1539,6 +1539,19 @@ nios2_rtx_costs (rtx x, machine_mode mode,
*total = COSTS_N_INSNS (2); /* Latency adjustment. */
else
*total = COSTS_N_INSNS (1);
+ if (TARGET_HAS_MULX && GET_MODE (x) == DImode)
+ {
+ enum rtx_code c0 = GET_CODE (XEXP (x, 0));
+ enum rtx_code c1 = GET_CODE (XEXP (x, 1));
+ if ((c0 == SIGN_EXTEND && c1 == SIGN_EXTEND)
+ || (c0 == ZERO_EXTEND && c1 == ZERO_EXTEND))
+ /* This is the <mul>sidi3 pattern, which expands into 4 insns,
+ 2 multiplies and 2 moves. */
+ {
+ *total = *total * 2 + COSTS_N_INSNS (2);
+ return true;
+ }
+ }
return false;
}