[AArch64 costs 13/18] Improve costs for div/mod 77/41177/1
authorjgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 May 2014 09:12:14 +0000 (09:12 +0000)
committerNikolai Bozhenov <n.bozhenov@samsung.com>
Thu, 11 Jun 2015 11:06:47 +0000 (14:06 +0300)
git cherry-pick 8065e8b

gcc/

* config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for
DIV/MOD.

Change-Id: Idb71f224c1d67da03c9b74c9d1ce28a53c09f0f7
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210505 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index de89b7e..6e0bd0a 100644 (file)
@@ -1,4 +1,10 @@
-2014-03-16  James Greenhalgh  <james.greenhalgh@arm.com>
+2014-05-16  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.
+
+2014-05-16  James Greenhalgh  <james.greenhalgh@arm.com>
            Philipp Tomsich  <philipp.tomsich@theobroma-systems.com>
 
        * config/aarch64/aarch64.c (aarch64_rtx_arith_op_extract_p): New.
index f687194..8b56228 100644 (file)
@@ -5408,7 +5408,6 @@ cost_minus:
 
     case MOD:
     case UMOD:
-      *cost = COSTS_N_INSNS (2);
       if (speed)
        {
          if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
@@ -5425,15 +5424,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.  */