From 4dd7c283b095c8595c2d4458629c3b4df0d5d3e9 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 28 Jul 2015 19:59:40 +0000 Subject: [PATCH] gcc/ * 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 | 10 ++++++++++ gcc/emit-rtl.c | 7 ++++--- gcc/optabs.c | 6 ++---- gcc/rtlanal.c | 10 ++++++---- gcc/simplify-rtx.c | 10 ++++++---- gcc/target-insns.def | 2 ++ 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d94dfce..f7740ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2015-07-28 Richard Sandiford + * 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 + * target-insns.def (eh_return): New targetm instruction pattern. * except.c (expand_eh_return): Use it instead of HAVE_*/gen_* interface. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ed2b30b..caa33b8 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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); diff --git a/gcc/optabs.c b/gcc/optabs.c index c27e244..c527d8c 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 0bba878..a9246fa 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -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 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 4332a42..e2f34c4 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -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; diff --git a/gcc/target-insns.def b/gcc/target-insns.def index df76a6e..3f4fe8e 100644 --- a/gcc/target-insns.def +++ b/gcc/target-insns.def @@ -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)) -- 2.7.4