summaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-07-05 09:17:02 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-07-05 13:33:00 +0000
commited3800bb37f706a0d308230e100106ae50c2bad9 (patch)
tree443ebf04138dd7e6a33f1ddb23a5434ce3b53d18 /gcc/config/arm
parentf83d498336b6609abc5606f7763fdfb4fb19c720 (diff)
downloadgcc-ed3800bb37f706a0d308230e100106ae50c2bad9.tar.gz
gcc/
Backport from trunk r248953. 2017-06-07 Tamar Christina <tamar.christina@arm.com> * config/aarch64/aarch64.c (aarch64_rtx_costs): Make sdiv more expensive than udiv. Remove floating point cases from mod. gcc/testsuite/ Backport from trunk r248953. 2017-06-07 Tamar Christina <tamar.christina@arm.com> * gcc.target/aarch64/sdiv_costs_1.c: New. gcc/ Backport from trunk r249062. 2017-06-09 Tamar Christina <tamar.christina@arm.com> * config/arm/arm.c (arm_rtx_costs_internal): Make sdiv more expensive than udiv. gcc/testsuite/ Backport from trunk r249062. 2017-06-09 Tamar Christina <tamar.christina@arm.com> * gcc.target/arm/sdiv_costs_1.c: New. Change-Id: I503544ca95e8fc28ab9bb9b0060ea90fe557d2e6
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 0815a46351a..692641120be 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -9315,6 +9315,10 @@ arm_rtx_costs_internal (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost += COSTS_N_INSNS (speed_p ? extra_cost->mult[0].idiv : 0);
else
*cost = LIBCALL_COST (2);
+
+ /* Make the cost of sdiv more expensive so when both sdiv and udiv are
+ possible udiv is prefered. */
+ *cost += (code == DIV ? COSTS_N_INSNS (1) : 0);
return false; /* All arguments must be in registers. */
case MOD:
@@ -9337,7 +9341,9 @@ arm_rtx_costs_internal (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* Fall-through. */
case UMOD:
- *cost = LIBCALL_COST (2);
+ /* Make the cost of sdiv more expensive so when both sdiv and udiv are
+ possible udiv is prefered. */
+ *cost = LIBCALL_COST (2) + (code == MOD ? COSTS_N_INSNS (1) : 0);
return false; /* All arguments must be in registers. */
case ROTATE: