gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Jul 2015 19:59:40 +0000 (19:59 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Jul 2015 19:59:40 +0000 (19:59 +0000)
* target-insns.def (can_extend, ptr_extend): New targetm instruction
patterns.
* optabs.c (can_extend_p): Use them instead of HAVE_*/gen_* interface.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
* emit-rtl.c (set_reg_attrs_from_value): Likewise.
* rtlanal.c (nonzero_bits1): Likewise.
(num_sign_bit_copies1): Likewise.

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

gcc/ChangeLog
gcc/emit-rtl.c
gcc/optabs.c
gcc/rtlanal.c
gcc/simplify-rtx.c
gcc/target-insns.def

index d94dfce..f7740ba 100644 (file)
@@ -1,5 +1,15 @@
 2015-07-28  Richard Sandiford  <richard.sandiford@arm.com>
 
+       * target-insns.def (can_extend, ptr_extend): New targetm instruction
+       patterns.
+       * optabs.c (can_extend_p): Use them instead of HAVE_*/gen_* interface.
+       * simplify-rtx.c (simplify_unary_operation_1): Likewise.
+       * emit-rtl.c (set_reg_attrs_from_value): Likewise.
+       * rtlanal.c (nonzero_bits1): Likewise.
+       (num_sign_bit_copies1): Likewise.
+
+2015-07-28  Richard Sandiford  <richard.sandiford@arm.com>
+
        * target-insns.def (eh_return): New targetm instruction pattern.
        * except.c (expand_eh_return): Use it instead of HAVE_*/gen_*
        interface.
index ed2b30b..caa33b8 100644 (file)
@@ -1159,9 +1159,10 @@ set_reg_attrs_from_value (rtx reg, rtx x)
         || GET_CODE (x) == TRUNCATE
         || (GET_CODE (x) == SUBREG && subreg_lowpart_p (x)))
     {
-#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
-      if ((GET_CODE (x) == SIGN_EXTEND && POINTERS_EXTEND_UNSIGNED)
-         || (GET_CODE (x) != SIGN_EXTEND && ! POINTERS_EXTEND_UNSIGNED))
+#if defined(POINTERS_EXTEND_UNSIGNED)
+      if (((GET_CODE (x) == SIGN_EXTEND && POINTERS_EXTEND_UNSIGNED)
+          || (GET_CODE (x) != SIGN_EXTEND && ! POINTERS_EXTEND_UNSIGNED))
+         && !targetm.have_ptr_extend ())
        can_be_reg_pointer = false;
 #endif
       x = XEXP (x, 0);
index c27e244..c527d8c 100644 (file)
@@ -4851,10 +4851,8 @@ can_extend_p (machine_mode to_mode, machine_mode from_mode,
              int unsignedp)
 {
   convert_optab tab;
-#ifdef HAVE_ptr_extend
-  if (unsignedp < 0)
-    return CODE_FOR_ptr_extend;
-#endif
+  if (unsignedp < 0 && targetm.have_ptr_extend ())
+    return targetm.code_for_ptr_extend;
 
   tab = unsignedp ? zext_optab : sext_optab;
   return convert_optab_handler (tab, to_mode, from_mode);
index 0bba878..a9246fa 100644 (file)
@@ -4278,7 +4278,7 @@ nonzero_bits1 (const_rtx x, machine_mode mode, const_rtx known_x,
   switch (code)
     {
     case REG:
-#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
+#if defined(POINTERS_EXTEND_UNSIGNED)
       /* If pointers extend unsigned and this is a pointer in Pmode, say that
         all the bits above ptr_mode are known to be zero.  */
       /* As we do not know which address space the pointer is referring to,
@@ -4286,7 +4286,8 @@ nonzero_bits1 (const_rtx x, machine_mode mode, const_rtx known_x,
         or address modes depending on the address space.  */
       if (target_default_pointer_address_modes_p ()
          && POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode
-         && REG_POINTER (x))
+         && REG_POINTER (x)
+         && !targetm.have_ptr_extend ())
        nonzero &= GET_MODE_MASK (ptr_mode);
 #endif
 
@@ -4785,7 +4786,7 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode, const_rtx known_x,
     {
     case REG:
 
-#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
+#if defined(POINTERS_EXTEND_UNSIGNED)
       /* If pointers extend signed and this is a pointer in Pmode, say that
         all the bits above ptr_mode are known to be sign bit copies.  */
       /* As we do not know which address space the pointer is referring to,
@@ -4793,7 +4794,8 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode, const_rtx known_x,
         or address modes depending on the address space.  */
       if (target_default_pointer_address_modes_p ()
          && ! POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode
-         && mode == Pmode && REG_POINTER (x))
+         && mode == Pmode && REG_POINTER (x)
+         && !targetm.have_ptr_extend ())
        return GET_MODE_PRECISION (Pmode) - GET_MODE_PRECISION (ptr_mode) + 1;
 #endif
 
index 4332a42..e2f34c4 100644 (file)
@@ -1431,7 +1431,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
            }
        }
 
-#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
+#if defined(POINTERS_EXTEND_UNSIGNED)
       /* As we do not know which address space the pointer is referring to,
         we can do this only if the target does not support different pointer
         or address modes depending on the address space.  */
@@ -1442,7 +1442,8 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
              || (GET_CODE (op) == SUBREG
                  && REG_P (SUBREG_REG (op))
                  && REG_POINTER (SUBREG_REG (op))
-                 && GET_MODE (SUBREG_REG (op)) == Pmode)))
+                 && GET_MODE (SUBREG_REG (op)) == Pmode))
+         && !targetm.have_ptr_extend ())
        return convert_memory_address (Pmode, op);
 #endif
       break;
@@ -1552,7 +1553,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
                                     GET_MODE (SUBREG_REG (op)));
        }
 
-#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
+#if defined(POINTERS_EXTEND_UNSIGNED)
       /* As we do not know which address space the pointer is referring to,
         we can do this only if the target does not support different pointer
         or address modes depending on the address space.  */
@@ -1563,7 +1564,8 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
              || (GET_CODE (op) == SUBREG
                  && REG_P (SUBREG_REG (op))
                  && REG_POINTER (SUBREG_REG (op))
-                 && GET_MODE (SUBREG_REG (op)) == Pmode)))
+                 && GET_MODE (SUBREG_REG (op)) == Pmode))
+         && !targetm.have_ptr_extend ())
        return convert_memory_address (Pmode, op);
 #endif
       break;
index df76a6e..3f4fe8e 100644 (file)
@@ -34,6 +34,7 @@ DEF_TARGET_INSN (allocate_stack, (rtx x0, rtx x1))
 DEF_TARGET_INSN (builtin_longjmp, (rtx x0))
 DEF_TARGET_INSN (builtin_setjmp_receiver, (rtx x0))
 DEF_TARGET_INSN (builtin_setjmp_setup, (rtx x0))
+DEF_TARGET_INSN (can_extend, (rtx x0, rtx x1))
 DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1))
 DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4))
 DEF_TARGET_INSN (check_stack, (rtx x0))
@@ -58,6 +59,7 @@ DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (probe_stack, (rtx x0))
 DEF_TARGET_INSN (probe_stack_address, (rtx x0))
 DEF_TARGET_INSN (prologue, (void))
+DEF_TARGET_INSN (ptr_extend, (rtx x0, rtx x1))
 DEF_TARGET_INSN (restore_stack_block, (rtx x0, rtx x1))
 DEF_TARGET_INSN (restore_stack_function, (rtx x0, rtx x1))
 DEF_TARGET_INSN (restore_stack_nonlocal, (rtx x0, rtx x1))