aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2012-07-23 08:50:45 +0200
committerUros Bizjak <uros@gcc.gnu.org>2012-07-23 08:50:45 +0200
commit78aaa514d54c9257dec1869e01aed679b983f46d (patch)
treec3051bc5d980a193c5247bc688c42119b2e8e4ce /gcc
parent0abcd2ef510140d44653f6f4a4eb28db2306e3c2 (diff)
downloadgcc-78aaa514d54c9257dec1869e01aed679b983f46d.zip
gcc-78aaa514d54c9257dec1869e01aed679b983f46d.tar.gz
gcc-78aaa514d54c9257dec1869e01aed679b983f46d.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog2
-rw-r--r--gcc/config/i386/i386.c10
-rw-r--r--gcc/config/i386/i386.md48
3 files changed, 30 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ede99f6..2b04ab7 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 <hp@axis.com>
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5770ed2..06ef5db 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 7f5814d..f559ff2 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -5450,6 +5450,30 @@
DONE;
})
+(define_insn_and_split "*lea<mode>"
+ [(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{<imodesuffix>}\t{%E1, %0|%0, %E1}";
+}
+ "reload_completed && ix86_avoid_lea_for_addr (insn, operands)"
+ [(const_int 0)]
+{
+ ix86_split_lea_for_addr (operands, <MODE>mode);
+ DONE;
+}
+ [(set_attr "type" "lea")
+ (set_attr "mode" "<MODE>")])
+
;; Add instructions
(define_expand "add<mode>3"
@@ -5508,30 +5532,6 @@
[(set_attr "type" "alu")
(set_attr "mode" "QI")])
-(define_insn_and_split "*lea<mode>"
- [(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{<imodesuffix>}\t{%E1, %0|%0, %E1}";
-}
- "reload_completed && ix86_avoid_lea_for_addr (insn, operands)"
- [(const_int 0)]
-{
- ix86_split_lea_for_addr (operands, <MODE>mode);
- DONE;
-}
- [(set_attr "type" "lea")
- (set_attr "mode" "<MODE>")])
-
(define_insn "*add<mode>_1"
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r,r")
(plus:SWI48