This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][AArch64] Fix operand costing logic for MINUS
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, James Greenhalgh <james dot greenhalgh at arm dot com>
- Date: Mon, 27 Apr 2015 14:24:28 +0100
- Subject: [PATCH][AArch64] Fix operand costing logic for MINUS
- Authentication-results: sourceware.org; auth=none
Hi all,
This fixes a case in aarch64 costs where we forgot
to account for one of the operands in the MINUS case.
This is important to get right as the mult synthesis code
can ask for the cost of a shift+sub operation and put the
shift part in any of the MINUS operands, expecting the cost function to
break it down into a separate shift operation if the
two cannot be combined.
Bootstrapped and tested on aarch64.
Ok for trunk?
Thanks,
Kyrill
2015-04-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs, MINUS):
Properly account for both operand costs in simple case.
commit 4859566692e4b9195b975632ed105b9c4b6ab765
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Mon Mar 2 10:18:22 2015 +0000
[AArch64] Properly cost both operands of MINUS.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7ffa7ee..5a3f887 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5844,7 +5844,8 @@ cost_minus:
return true;
}
- *cost += rtx_cost (new_op1, MINUS, 1, speed);
+ *cost += rtx_cost (new_op1, MINUS, 1, speed)
+ + rtx_cost (op0, MINUS, 0, speed);
if (speed)
{