Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: gcc/config/i386/i386.md

Issue 10386087: Replace rip lea with eip (Closed) Base URL: http://git.chromium.org/native_client/nacl-gcc.git@master
Patch Set: Handle all cases handled by print_operand_address_parts Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/config/i386/i386.md
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 8dc1bdde0c8f1285b4ac072bceec79f67f0c0fe5..08211e76377a70e2ddd318702e08fbafb856681c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2415,6 +2415,30 @@
return "#";
case TYPE_LEA:
+ if (TARGET_NACL)
eaeltsin 2012/05/11 12:33:31 As this check is used twice, can you please move i
+ {
+ struct ix86_address parts;
+ rtx symbol = NULL;
+ int ok;
+
+ ok = ix86_lea_decompose_address (operands[1], &parts);
+ gcc_assert (ok);
+
+ if (!parts.base && !parts.index)
+ {
+ symbol = parts.disp;
+ if (GET_CODE (symbol) == CONST
+ && GET_CODE (XEXP (symbol, 0)) == PLUS
+ && CONST_INT_P (XEXP (XEXP (symbol, 0), 1)))
+ symbol = XEXP (XEXP (symbol, 0), 0);
+ }
+ if ((parts.base &&
+ (REGNO (parts.base) == SP_REG || REGNO (parts.base) == BP_REG)) ||
+ (symbol &&
+ (GET_CODE (symbol) == SYMBOL_REF ||
+ GET_CODE (symbol) == LABEL_REF)))
+ return "lea{l}\t{%a1, %k0|%k0, %a1}";
+ }
return "lea{q}\t{%a1, %0|%0, %a1}";
default:
@@ -6011,16 +6035,26 @@
if (TARGET_NACL)
{
struct ix86_address parts;
+ rtx symbol = NULL;
int ok;
ok = ix86_lea_decompose_address (operands[1], &parts);
gcc_assert (ok);
- if (parts.base)
+ if (!parts.base && !parts.index)
{
- if (REGNO (parts.base) == SP_REG || REGNO (parts.base) == BP_REG)
- return "lea{l}\t{%Z1, %k0|%k0, %Z1}";
+ symbol = parts.disp;
+ if (GET_CODE (symbol) == CONST
+ && GET_CODE (XEXP (symbol, 0)) == PLUS
+ && CONST_INT_P (XEXP (XEXP (symbol, 0), 1)))
+ symbol = XEXP (XEXP (symbol, 0), 0);
}
+ if ((parts.base &&
+ (REGNO (parts.base) == SP_REG || REGNO (parts.base) == BP_REG)) ||
+ (symbol &&
+ (GET_CODE (symbol) == SYMBOL_REF ||
+ GET_CODE (symbol) == LABEL_REF)))
+ return "lea{l}\t{%Z1, %k0|%k0, %Z1}";
}
return "lea{q}\t{%Z1, %0|%0, %Z1}";
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698