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

Unified Diff: unittest/AssemblerX8632/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/AssemblerX8632/GPRArith.cpp
diff --git a/unittest/AssemblerX8632/GPRArith.cpp b/unittest/AssemblerX8632/GPRArith.cpp
index 6ca27ace641c25b6a89f35c8dc8db997016cc0fd..e4683f39980962ba3861c31dbb39b021cada5774 100644
--- a/unittest/AssemblerX8632/GPRArith.cpp
+++ b/unittest/AssemblerX8632/GPRArith.cpp
@@ -126,13 +126,14 @@ TEST_F(AssemblerX8632Test, Lea) {
do { \
static constexpr char TestString[] = \
"(" #Base ", " #BaseValue ", " #Dst ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
if (GPRRegister::Encoded_Reg_##Base != GPRRegister::Encoded_Reg_esp && \
GPRRegister::Encoded_Reg_##Base != GPRRegister::Encoded_Reg_ebp) { \
__ mov(IceType_i32, GPRRegister::Encoded_Reg_##Base, \
Immediate(BaseValue)); \
} \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst, \
- Address(GPRRegister::Encoded_Reg_##Base, Disp)); \
+ Address(GPRRegister::Encoded_Reg_##Base, Disp, Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
ASSERT_EQ(test.Base() + (Disp), test.Dst()) << TestString << " with Disp " \
@@ -145,16 +146,21 @@ TEST_F(AssemblerX8632Test, Lea) {
static constexpr char TestString[] = \
"(" #Index ", " #IndexValue ", " #Dst0 ", " #Dst1 ", " #Dst2 \
", " #Dst3 ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
__ mov(IceType_i32, GPRRegister::Encoded_Reg_##Index, \
Immediate(IndexValue)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst0, \
- Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_1, Disp)); \
+ Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_1, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst1, \
- Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_2, Disp)); \
+ Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_2, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst2, \
- Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_4, Disp)); \
+ Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_4, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst3, \
- Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_8, Disp)); \
+ Address(GPRRegister::Encoded_Reg_##Index, Traits::TIMES_8, Disp, \
+ Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
ASSERT_EQ((test.Index() << Traits::TIMES_1) + (Disp), test.Dst0()) \
@@ -174,6 +180,7 @@ TEST_F(AssemblerX8632Test, Lea) {
static constexpr char TestString[] = \
"(" #Base ", " #BaseValue ", " #Index ", " #IndexValue ", " #Dst0 \
", " #Dst1 ", " #Dst2 ", " #Dst3 ")"; \
+ static constexpr AssemblerFixup *Fixup = nullptr; \
if (GPRRegister::Encoded_Reg_##Base != GPRRegister::Encoded_Reg_esp && \
GPRRegister::Encoded_Reg_##Base != GPRRegister::Encoded_Reg_ebp) { \
__ mov(IceType_i32, GPRRegister::Encoded_Reg_##Base, \
@@ -186,16 +193,20 @@ TEST_F(AssemblerX8632Test, Lea) {
} \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst0, \
Address(GPRRegister::Encoded_Reg_##Base, \
- GPRRegister::Encoded_Reg_##Index, Traits::TIMES_1, Disp)); \
+ GPRRegister::Encoded_Reg_##Index, Traits::TIMES_1, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst1, \
Address(GPRRegister::Encoded_Reg_##Base, \
- GPRRegister::Encoded_Reg_##Index, Traits::TIMES_2, Disp)); \
+ GPRRegister::Encoded_Reg_##Index, Traits::TIMES_2, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst2, \
Address(GPRRegister::Encoded_Reg_##Base, \
- GPRRegister::Encoded_Reg_##Index, Traits::TIMES_4, Disp)); \
+ GPRRegister::Encoded_Reg_##Index, Traits::TIMES_4, Disp, \
+ Fixup)); \
__ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst3, \
Address(GPRRegister::Encoded_Reg_##Base, \
- GPRRegister::Encoded_Reg_##Index, Traits::TIMES_8, Disp)); \
+ GPRRegister::Encoded_Reg_##Index, Traits::TIMES_8, Disp, \
+ Fixup)); \
AssembledTest test = assemble(); \
test.run(); \
uint32_t ExpectedIndexValue = test.Index(); \
@@ -286,8 +297,8 @@ TEST_F(AssemblerX8632LowLevelTest, 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