This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[AArch64 costs 13/18] Improve costs for div/mod
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: richard dot earnshaw at arm dot com, marcus dot shawcroft at arm dot com, philipp dot tomsich at theobroma-systems dot com
- Date: Thu, 27 Mar 2014 17:33:37 +0000
- Subject: [AArch64 costs 13/18] Improve costs for div/mod
- Authentication-results: sourceware.org; auth=none
- References: <1395941622-22926-1-git-send-email-james dot greenhalgh at arm dot com>
Hi,
Now DIV/MOD.
Tested in series on aarch64-none-elf.
OK for stage 1?
Thanks,
James
---
2014-03-27 James Greenhalgh <james.greenhalgh@arm.com>
Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for
DIV/MOD.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 338f6b3..c6f1ac5 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5423,7 +5423,6 @@ cost_minus:
case MOD:
case UMOD:
- *cost = COSTS_N_INSNS (2);
if (speed)
{
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
@@ -5440,15 +5439,15 @@ cost_minus:
case DIV:
case UDIV:
- *cost = COSTS_N_INSNS (1);
+ case SQRT:
if (speed)
{
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- *cost += extra_cost->mult[GET_MODE (x) == DImode].idiv;
- else if (GET_MODE (x) == DFmode)
- *cost += extra_cost->fp[1].div;
- else if (GET_MODE (x) == SFmode)
- *cost += extra_cost->fp[0].div;
+ if (GET_MODE_CLASS (mode) == MODE_INT)
+ /* There is no integer SQRT, so only DIV and UDIV can get
+ here. */
+ *cost += extra_cost->mult[mode == DImode].idiv;
+ else
+ *cost += extra_cost->fp[mode == DFmode].div;
}
return false; /* All arguments need to be in registers. */