From d0b2266a7747f97b6eebe8b9de064d735b568ef2 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 24 May 2015 00:32:31 +0000 Subject: [PATCH] always define HAVE_lo_sum gcc/ChangeLog: 2015-05-23 Trevor Saunders * combine.c (find_split_point): Check the value of HAVE_lo_sum instead of if it is defined. (combine_simplify_rtx): Likewise. * lra-constraints.c (process_address_1): Likewise. * config/darwin.c: Adjust. * genconfig.c (main): Always define HAVE_lo_sum. From-SVN: r223619 --- gcc/ChangeLog | 9 ++++++ gcc/combine.c | 10 ++---- gcc/config/darwin.c | 3 +- gcc/genconfig.c | 2 ++ gcc/lra-constraints.c | 72 +++++++++++++++++++++---------------------- 5 files changed, 51 insertions(+), 45 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ce162822a6..360f01370b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-05-23 Trevor Saunders + + * combine.c (find_split_point): Check the value of HAVE_lo_sum + instead of if it is defined. + (combine_simplify_rtx): Likewise. + * lra-constraints.c (process_address_1): Likewise. + * config/darwin.c: Adjust. + * genconfig.c (main): Always define HAVE_lo_sum. + 2015-05-23 Prathamesh Kulkarni * genmatch.c (parser::parse_operation): Reject expanding operator-list inside 'for'. diff --git a/gcc/combine.c b/gcc/combine.c index 0817af2a2a3..73d141edc07 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4785,11 +4785,10 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src) return find_split_point (&SUBREG_REG (x), insn, false); case MEM: -#ifdef HAVE_lo_sum /* If we have (mem (const ..)) or (mem (symbol_ref ...)), split it using LO_SUM and HIGH. */ - if (GET_CODE (XEXP (x, 0)) == CONST - || GET_CODE (XEXP (x, 0)) == SYMBOL_REF) + if (HAVE_lo_sum && (GET_CODE (XEXP (x, 0)) == CONST + || GET_CODE (XEXP (x, 0)) == SYMBOL_REF)) { machine_mode address_mode = get_address_mode (x); @@ -4799,7 +4798,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src) XEXP (x, 0))); return &XEXP (XEXP (x, 0), 0); } -#endif /* If we have a PLUS whose second operand is a constant and the address is not valid, perhaps will can split it up using @@ -5857,16 +5855,14 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest, SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0)); break; -#ifdef HAVE_lo_sum case LO_SUM: /* Convert (lo_sum (high FOO) FOO) to FOO. This is necessary so we can add in an offset. find_split_point will split this address up again if it doesn't match. */ - if (GET_CODE (XEXP (x, 0)) == HIGH + if (HAVE_lo_sum && GET_CODE (XEXP (x, 0)) == HIGH && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1))) return XEXP (x, 1); break; -#endif case PLUS: /* (plus (xor (and (const_int pow2 - 1)) ) <-c>) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5ea7088478a..ea7eec112fb 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -149,8 +149,7 @@ int generating_for_darwin_version ; section * darwin_sections[NUM_DARWIN_SECTIONS]; /* While we transition to using in-tests instead of ifdef'd code. */ -#ifndef HAVE_lo_sum -#define HAVE_lo_sum 0 +#if !HAVE_lo_sum #define gen_macho_high(a,b) (a) #define gen_macho_low(a,b,c) (a) #endif diff --git a/gcc/genconfig.c b/gcc/genconfig.c index 7237dedee56..a0a834a83c7 100644 --- a/gcc/genconfig.c +++ b/gcc/genconfig.c @@ -360,6 +360,8 @@ main (int argc, char **argv) if (have_lo_sum_flag) printf ("#define HAVE_lo_sum 1\n"); + else + printf ("#define HAVE_lo_sum 0\n"); if (have_rotate_flag) printf ("#define HAVE_rotate 1\n"); diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index c0f29956edd..a8d082022f8 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2962,42 +2962,42 @@ process_address_1 (int nop, bool check_only_p, rtx addr = *ad.inner; new_reg = lra_create_new_reg (Pmode, NULL_RTX, cl, "addr"); -#ifdef HAVE_lo_sum - { - rtx_insn *insn; - rtx_insn *last = get_last_insn (); - - /* addr => lo_sum (new_base, addr), case (2) above. */ - insn = emit_insn (gen_rtx_SET - (new_reg, - gen_rtx_HIGH (Pmode, copy_rtx (addr)))); - code = recog_memoized (insn); - if (code >= 0) - { - *ad.inner = gen_rtx_LO_SUM (Pmode, new_reg, addr); - if (! valid_address_p (ad.mode, *ad.outer, ad.as)) - { - /* Try to put lo_sum into register. */ - insn = emit_insn (gen_rtx_SET - (new_reg, - gen_rtx_LO_SUM (Pmode, new_reg, addr))); - code = recog_memoized (insn); - if (code >= 0) - { - *ad.inner = new_reg; - if (! valid_address_p (ad.mode, *ad.outer, ad.as)) - { - *ad.inner = addr; - code = -1; - } - } - - } - } - if (code < 0) - delete_insns_since (last); - } -#endif + if (HAVE_lo_sum) + { + rtx_insn *insn; + rtx_insn *last = get_last_insn (); + + /* addr => lo_sum (new_base, addr), case (2) above. */ + insn = emit_insn (gen_rtx_SET + (new_reg, + gen_rtx_HIGH (Pmode, copy_rtx (addr)))); + code = recog_memoized (insn); + if (code >= 0) + { + *ad.inner = gen_rtx_LO_SUM (Pmode, new_reg, addr); + if (! valid_address_p (ad.mode, *ad.outer, ad.as)) + { + /* Try to put lo_sum into register. */ + insn = emit_insn (gen_rtx_SET + (new_reg, + gen_rtx_LO_SUM (Pmode, new_reg, addr))); + code = recog_memoized (insn); + if (code >= 0) + { + *ad.inner = new_reg; + if (! valid_address_p (ad.mode, *ad.outer, ad.as)) + { + *ad.inner = addr; + code = -1; + } + } + + } + } + if (code < 0) + delete_insns_since (last); + } + if (code < 0) { /* addr => new_base, case (2) above. */ -- 2.30.2