regcprop.c (maybe_mode_change): Avoid creating copies of the stack pointer.
authorJeff Law <law@redhat.com>
Tue, 18 Apr 2017 15:00:43 +0000 (09:00 -0600)
committerJeff Law <law@gcc.gnu.org>
Tue, 18 Apr 2017 15:00:43 +0000 (09:00 -0600)
* regcprop.c (maybe_mode_change): Avoid creating copies of the
stack pointer.

Revert:
2017-04-13  Jeff Law  <law@redhat.com>
* config/mips.mips.md (zero_extendsidi2): Do not allow SP to appear
in operands[1] if it is a MEM and TARGET_MIPS16 is active.

From-SVN: r246970

gcc/ChangeLog
gcc/config/mips/mips.md
gcc/regcprop.c

index 1ff66847754facfd303becf9e5a1c387151ebd06..8da35cc67e3d3533f0302ebe987a664a784f0bd7 100644 (file)
@@ -1,3 +1,13 @@
+2017-04-18  Jeff Law  <law@redhat.com>
+
+       * regcprop.c (maybe_mode_change): Avoid creating copies of the
+       stack pointer.
+
+       Revert:
+       2017-04-13  Jeff Law  <law@redhat.com>
+       * config/mips.mips.md (zero_extendsidi2): Do not allow SP to appear
+       in operands[1] if it is a MEM and TARGET_MIPS16 is active.
+
 2017-04-18  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/79453
index dd5e1e77436f8880ea2f703a5f43aa7aef203256..7acf00d0451d82c906fb5a86ece521d3c9ee6fc6 100644 (file)
 (define_insn_and_split "*zero_extendsidi2"
   [(set (match_operand:DI 0 "register_operand" "=d,d")
         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))]
-  "TARGET_64BIT && !ISA_HAS_EXT_INS
-   && !(TARGET_MIPS16
-        && MEM_P (operands[1])
-        && reg_mentioned_p (stack_pointer_rtx, operands[1]))"
+  "TARGET_64BIT && !ISA_HAS_EXT_INS"
   "@
    #
    lwu\t%0,%1"
 (define_insn "*zero_extendsidi2_dext"
   [(set (match_operand:DI 0 "register_operand" "=d,d")
         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))]
-  "TARGET_64BIT && ISA_HAS_EXT_INS
-   && !(TARGET_MIPS16
-        && MEM_P (operands[1])
-        && reg_mentioned_p (stack_pointer_rtx, operands[1]))"
+  "TARGET_64BIT && ISA_HAS_EXT_INS"
   "@
    dext\t%0,%1,0,32
    lwu\t%0,%1"
index ddc6252f53a50f3c1e75dbd2bd4fc50119d54f1e..367d85a7e242e9765767dcdd29080bd1fde3eb84 100644 (file)
@@ -396,6 +396,13 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode,
       && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
     return NULL_RTX;
 
+  /* Avoid creating multiple copies of the stack pointer.  Some ports
+     assume there is one and only one stack pointer.
+
+     It's unclear if we need to do the same for other special registers.  */
+  if (regno == STACK_POINTER_REGNUM)
+    return NULL_RTX;
+
   if (orig_mode == new_mode)
     return gen_raw_REG (new_mode, regno);
   else if (mode_change_ok (orig_mode, new_mode, regno))