From 4105fe38857a36b4e604d98a7bbc888225bf187f Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Fri, 16 May 2014 09:12:14 +0000 Subject: [PATCH] [AArch64 costs 13/18] Improve costs for div/mod gcc/ * config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for DIV/MOD. Co-Authored-By: Philipp Tomsich From-SVN: r210505 --- gcc/ChangeLog | 8 +++++++- gcc/config/aarch64/aarch64.c | 15 +++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d36a3cadbc3..cdc72368632 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ -2014-03-16 James Greenhalgh +2014-05-16 James Greenhalgh + Philipp Tomsich + + * config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for + DIV/MOD. + +2014-05-16 James Greenhalgh Philipp Tomsich * config/aarch64/aarch64.c (aarch64_rtx_arith_op_extract_p): New. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 37c791df422..6c2682a80a4 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5476,7 +5476,6 @@ cost_minus: case MOD: case UMOD: - *cost = COSTS_N_INSNS (2); if (speed) { if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT) @@ -5493,15 +5492,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. */