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

Unified Diff: unittest/AssemblerX8664/GPRArith.cpp

Issue 1428443002: Enhance address mode recovery (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Streamline absolute addressing support (rip-relative on x64) Created 5 years, 2 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
Index: unittest/AssemblerX8664/GPRArith.cpp
diff --git a/unittest/AssemblerX8664/GPRArith.cpp b/unittest/AssemblerX8664/GPRArith.cpp
index f5404f84118df5746d8b1068903b7a204a36a7af..ad2af880b26f6a3425e681abdbde702581a2ddaf 100644
--- a/unittest/AssemblerX8664/GPRArith.cpp
+++ b/unittest/AssemblerX8664/GPRArith.cpp
@@ -112,12 +112,13 @@ TEST_F(AssemblerX8664Test, Lea) {
do { \
static constexpr char TestString[] = \
"(" #Base ", " #BaseValue ", " #Dst ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
if (Encoded_GPR_##Base() != Encoded_GPR_esp() && \
Encoded_GPR_##Base() != Encoded_GPR_r9()) { \
__ mov(IceType_i32, Encoded_GPR_##Base(), Immediate(BaseValue)); \
} \
__ lea(IceType_i32, Encoded_GPR_##Dst(), \
- Address(Encoded_GPR_##Base(), Disp)); \
+ Address(Encoded_GPR_##Base(), Disp, Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
ASSERT_EQ(test.Base##d() + (Disp), test.Dst##d()) \
@@ -130,17 +131,18 @@ TEST_F(AssemblerX8664Test, Lea) {
static constexpr char TestString[] = \
"(" #Index ", " #IndexValue ", " #Dst0 ", " #Dst1 ", " #Dst2 \
", " #Dst3 ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
if (Encoded_GPR_##Index() != Encoded_GPR_r9()) { \
__ mov(IceType_i32, Encoded_GPR_##Index(), Immediate(IndexValue)); \
} \
__ lea(IceType_i32, Encoded_GPR_##Dst0(), \
- Address(Encoded_GPR_##Index(), Traits::TIMES_1, Disp)); \
+ Address(Encoded_GPR_##Index(), Traits::TIMES_1, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst1(), \
- Address(Encoded_GPR_##Index(), Traits::TIMES_2, Disp)); \
+ Address(Encoded_GPR_##Index(), Traits::TIMES_2, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst2(), \
- Address(Encoded_GPR_##Index(), Traits::TIMES_4, Disp)); \
+ Address(Encoded_GPR_##Index(), Traits::TIMES_4, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst3(), \
- Address(Encoded_GPR_##Index(), Traits::TIMES_8, Disp)); \
+ Address(Encoded_GPR_##Index(), Traits::TIMES_8, Disp, Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
ASSERT_EQ((test.Index##d() << Traits::TIMES_1) + (Disp), test.Dst0##d()) \
@@ -160,6 +162,7 @@ TEST_F(AssemblerX8664Test, Lea) {
static constexpr char TestString[] = \
"(" #Base ", " #BaseValue ", " #Index ", " #IndexValue ", " #Dst0 \
", " #Dst1 ", " #Dst2 ", " #Dst3 ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
if (Encoded_GPR_##Base() != Encoded_GPR_esp() && \
Encoded_GPR_##Base() != Encoded_GPR_r9()) { \
__ mov(IceType_i32, Encoded_GPR_##Base(), Immediate(BaseValue)); \
@@ -171,16 +174,16 @@ TEST_F(AssemblerX8664Test, Lea) {
\
__ lea(IceType_i32, Encoded_GPR_##Dst0(), \
Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(), \
- Traits::TIMES_1, Disp)); \
+ Traits::TIMES_1, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst1(), \
Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(), \
- Traits::TIMES_2, Disp)); \
+ Traits::TIMES_2, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst2(), \
Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(), \
- Traits::TIMES_4, Disp)); \
+ Traits::TIMES_4, Disp, Fixup)); \
__ lea(IceType_i32, Encoded_GPR_##Dst3(), \
Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(), \
- Traits::TIMES_8, Disp)); \
+ Traits::TIMES_8, Disp, Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
uint32_t ExpectedIndexValue = test.Index(); \
@@ -322,8 +325,8 @@ TEST_F(AssemblerX8664LowLevelTest, LeaAbsolute) {
#define TestLeaAbsolute(Dst, Value) \
do { \
static constexpr char TestString[] = "(" #Dst ", " #Value ")"; \
- __ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst, \
- Address(Address::ABSOLUTE, Value)); \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
+ __ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst, Address(Value, Fixup));\
static constexpr uint32_t ByteCount = 6; \
ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \
static constexpr uint8_t Opcode = 0x8D; \

Powered by Google App Engine
This is Rietveld 408576698