s390.c (s390_register_move_cost): Increase costs for FPR->GPR moves.
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>
Tue, 27 Jan 2015 14:59:48 +0000 (14:59 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Tue, 27 Jan 2015 14:59:48 +0000 (14:59 +0000)
2015-01-27  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

* config/s390/s390.c (s390_register_move_cost): Increase costs for
FPR->GPR moves.

From-SVN: r220168

gcc/ChangeLog
gcc/config/s390/s390.c

index a4efbafb852b0d0f0e57978a0da849417b64956b..2ed7e80912f55e6a354f113d962c7b642f484cd5 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-27  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+       * config/s390/s390.c (s390_register_move_cost): Increase costs for
+       FPR->GPR moves.
+
 2015-01-27  Richard Biener  <rguenther@suse.de>
 
        * tree-vrp.c (update_value_range): Intersect the range with
index 6985fb77675334579095ab69f4de9fad2e185704..1cc4e4affe68ad198f001a71eb0296792848476c 100644 (file)
@@ -2407,16 +2407,29 @@ s390_float_const_zero_p (rtx value)
 /* Implement TARGET_REGISTER_MOVE_COST.  */
 
 static int
-s390_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
+s390_register_move_cost (machine_mode mode,
                          reg_class_t from, reg_class_t to)
 {
-  /* On s390, copy between fprs and gprs is expensive as long as no
-     ldgr/lgdr can be used.  */
-  if ((!TARGET_Z10 || GET_MODE_SIZE (mode) != 8)
-      && ((reg_classes_intersect_p (from, GENERAL_REGS)
-          && reg_classes_intersect_p (to, FP_REGS))
-         || (reg_classes_intersect_p (from, FP_REGS)
-             && reg_classes_intersect_p (to, GENERAL_REGS))))
+  /* On s390, copy between fprs and gprs is expensive.  */
+
+  /* It becomes somewhat faster having ldgr/lgdr.  */
+  if (TARGET_Z10 && GET_MODE_SIZE (mode) == 8)
+    {
+      /* ldgr is single cycle. */
+      if (reg_classes_intersect_p (from, GENERAL_REGS)
+         && reg_classes_intersect_p (to, FP_REGS))
+       return 1;
+      /* lgdr needs 3 cycles. */
+      if (reg_classes_intersect_p (to, GENERAL_REGS)
+         && reg_classes_intersect_p (from, FP_REGS))
+       return 3;
+    }
+
+  /* Otherwise copying is done via memory.  */
+  if ((reg_classes_intersect_p (from, GENERAL_REGS)
+       && reg_classes_intersect_p (to, FP_REGS))
+      || (reg_classes_intersect_p (from, FP_REGS)
+         && reg_classes_intersect_p (to, GENERAL_REGS)))
     return 10;
 
   return 1;