+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.
|| 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);
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);
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,
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
{
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,
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
}
}
-#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. */
|| (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;
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. */
|| (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;
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))
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))