Handle WORD_REGISTER_OPERATIONS when reloading (subreg (reg))
authorMatthew Fortune <matthew.fortune@imgtec.com>
Mon, 20 Feb 2017 12:06:56 +0000 (12:06 +0000)
committerMatthew Fortune <mpf@gcc.gnu.org>
Mon, 20 Feb 2017 12:06:56 +0000 (12:06 +0000)
gcc/
PR target/78660
* lra-constraints.c (curr_insn_transform): Handle
WORD_REGISTER_OPERATIONS requirements when reloading SUBREGs.

From-SVN: r245598

gcc/ChangeLog
gcc/lra-constraints.c

index f72bb1c0cfe01897c3b87c2f8e39abfebff6894c..9dc6b58a0adf49a95df5055711abb75e9a112ca8 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-20  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       PR target/78660
+       * lra-constraints.c (curr_insn_transform): Handle
+       WORD_REGISTER_OPERATIONS requirements when reloading SUBREGs.
+
 2017-02-19  Uros Bizjak  <ubizjak@gmail.com>
 
        Revert:
index 0098a7585e8e40cbd108291f2c60b81497b59a41..62947e36c97f079be384e21d7f5258a0a3cf778a 100644 (file)
@@ -4130,7 +4130,15 @@ curr_insn_transform (bool check_only_p)
                          && (goal_alt[i] == NO_REGS
                              || (simplify_subreg_regno
                                  (ira_class_hard_regs[goal_alt[i]][0],
-                                  GET_MODE (reg), byte, mode) >= 0)))))
+                                  GET_MODE (reg), byte, mode) >= 0)))
+                     /* WORD_REGISTER_OPERATIONS targets require the register
+                        to be reloaded when the outer mode is strictly
+                        narrower than the inner mode.  Note: It may be
+                        necessary to always reload the inner mode here but it
+                        requires further investigation.  */
+                     || (GET_MODE_PRECISION (mode)
+                         < GET_MODE_PRECISION (GET_MODE (reg))
+                         && WORD_REGISTER_OPERATIONS)))
                {
                  if (type == OP_OUT)
                    type = OP_INOUT;