[NDS32] Adjust register move cost for graywolf cpu.
authorKito Cheng <kito.cheng@gmail.com>
Sun, 20 May 2018 07:31:55 +0000 (07:31 +0000)
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>
Sun, 20 May 2018 07:31:55 +0000 (07:31 +0000)
gcc/
* config/nds32/nds32.c (nds32_register_move_cost): Take garywolf cpu
into consideration.

Co-Authored-By: Chung-Ju Wu <jasonwucj@gmail.com>
From-SVN: r260412

gcc/ChangeLog
gcc/config/nds32/nds32.c

index 63e5c66865981ce22a9d44cf707187ed7bddb26b..d76ff7d01c559b69eea99a129031fb6266053ab6 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-20  Kito Cheng  <kito.cheng@gmail.com>
+           Chung-Ju Wu  <jasonwucj@gmail.com>
+
+       * config/nds32/nds32.c (nds32_register_move_cost): Take garywolf cpu
+       into consideration.
+
 2018-05-20  Kito Cheng  <kito.cheng@gmail.com>
            Chung-Ju Wu  <jasonwucj@gmail.com>
 
index ac67ba43de3a9d1a276fc1c1f201b13d15d479b5..649e6f4b4dbabb7e70bc4e8ce18b79b78cac81fd 100644 (file)
@@ -3005,13 +3005,33 @@ nds32_canonicalize_comparison (int *code,
 /* Describing Relative Costs of Operations.  */
 
 static int
-nds32_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
+nds32_register_move_cost (machine_mode mode,
                          reg_class_t from,
                          reg_class_t to)
 {
+  /* In garywolf cpu, FPR to GPR is chaper than other cpu.  */
+  if (TARGET_PIPELINE_GRAYWOLF)
+    {
+      if (GET_MODE_SIZE (mode) == 8)
+       {
+         /* DPR to GPR.  */
+         if (from == FP_REGS && to != FP_REGS)
+           return 3;
+         /* GPR to DPR.  */
+         if (from != FP_REGS && to == FP_REGS)
+           return 2;
+       }
+      else
+       {
+         if ((from == FP_REGS && to != FP_REGS)
+             || (from != FP_REGS && to == FP_REGS))
+           return 2;
+       }
+    }
+
   if ((from == FP_REGS && to != FP_REGS)
       || (from != FP_REGS && to == FP_REGS))
-    return 9;
+    return 3;
   else if (from == HIGH_REGS || to == HIGH_REGS)
     return optimize_size ? 6 : 2;
   else