From: Uros Bizjak Date: Mon, 23 Jul 2012 06:50:45 +0000 (+0200) Subject: i386.c (ix86_avoid_lea_for_addr): Prevent zero-extended addresses here ... X-Git-Tag: releases/gcc-4.8.0~4334 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78aaa514d54c9257dec1869e01aed679b983f46d;p=thirdparty%2Fgcc.git i386.c (ix86_avoid_lea_for_addr): Prevent zero-extended addresses here ... * config/i386/i386.c (ix86_avoid_lea_for_addr): Prevent zero-extended addresses here ... (ix86_avoid_lea_for_add): ... not here. From-SVN: r189768 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ede99f6c68e2..2b04ab700c46 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -24,7 +24,7 @@ * config/i386/i386.c (ix86_decompose_address): Allow SImode subreg of an address. (ix86_print_operand_address): Handle SImode subreg of an address. - (ix86_avoid_lea_for_add): Reject zero-extended addresses for now. + (ix86_avoid_lea_for_addr): Reject zero-extended addresses for now. 2012-07-22 Hans-Peter Nilsson diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5770ed26aa2b..06ef5dba3b13 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16864,11 +16864,6 @@ ix86_avoid_lea_for_add (rtx insn, rtx operands[]) unsigned int regno1 = true_regnum (operands[1]); unsigned int regno2 = true_regnum (operands[2]); - /* FIXME: Handle zero-extended addresses. */ - if (GET_CODE (operands[1]) == ZERO_EXTEND - || GET_CODE (operands[1]) == AND) - return false; - /* Check if we need to optimize. */ if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun)) return false; @@ -16921,6 +16916,11 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[]) struct ix86_address parts; int ok; + /* FIXME: Handle zero-extended addresses. */ + if (GET_CODE (operands[1]) == ZERO_EXTEND + || GET_CODE (operands[1]) == AND) + return false; + /* Check we need to optimize. */ if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun)) return false; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 7f5814dfeec7..f559ff215361 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -5450,6 +5450,30 @@ DONE; }) +(define_insn_and_split "*lea" + [(set (match_operand:SWI48 0 "register_operand" "=r") + (match_operand:SWI48 1 "lea_address_operand" "p"))] + "" +{ + rtx addr = operands[1]; + + if (GET_CODE (addr) == SUBREG) + return "lea{l}\t{%E1, %0|%0, %E1}"; + else if (GET_CODE (addr) == ZERO_EXTEND + || GET_CODE (addr) == AND) + return "lea{l}\t{%E1, %k0|%k0, %E1}"; + else + return "lea{}\t{%E1, %0|%0, %E1}"; +} + "reload_completed && ix86_avoid_lea_for_addr (insn, operands)" + [(const_int 0)] +{ + ix86_split_lea_for_addr (operands, mode); + DONE; +} + [(set_attr "type" "lea") + (set_attr "mode" "")]) + ;; Add instructions (define_expand "add3" @@ -5508,30 +5532,6 @@ [(set_attr "type" "alu") (set_attr "mode" "QI")]) -(define_insn_and_split "*lea" - [(set (match_operand:SWI48 0 "register_operand" "=r") - (match_operand:SWI48 1 "lea_address_operand" "p"))] - "" -{ - rtx addr = operands[1]; - - if (GET_CODE (addr) == SUBREG) - return "lea{l}\t{%E1, %0|%0, %E1}"; - else if (GET_CODE (addr) == ZERO_EXTEND - || GET_CODE (addr) == AND) - return "lea{l}\t{%E1, %k0|%k0, %E1}"; - else - return "lea{}\t{%E1, %0|%0, %E1}"; -} - "reload_completed && ix86_avoid_lea_for_addr (insn, operands)" - [(const_int 0)] -{ - ix86_split_lea_for_addr (operands, mode); - DONE; -} - [(set_attr "type" "lea") - (set_attr "mode" "")]) - (define_insn "*add_1" [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r,r") (plus:SWI48