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

Unified Diff: unittest/AssemblerX8632/Locked.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/Locked.cpp
diff --git a/unittest/AssemblerX8632/Locked.cpp b/unittest/AssemblerX8632/Locked.cpp
index 9be0f940788a7fc09e10f943605b281b1f7dd325..a2d393a51a31ba9fb00de2227322a769cf55798a 100644
--- a/unittest/AssemblerX8632/Locked.cpp
+++ b/unittest/AssemblerX8632/Locked.cpp
@@ -197,19 +197,20 @@ TEST_F(AssemblerX8632Test, Xadd) {
TEST_F(AssemblerX8632LowLevelTest, Xadd) {
static constexpr bool NotLocked = false;
static constexpr bool Locked = true;
+ static constexpr AssemblerFixup *Fixup = nullptr;
// Ensures that xadd emits a lock prefix accordingly.
{
- __ xadd(IceType_i8, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, NotLocked);
+ __ xadd(IceType_i8, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ NotLocked);
static constexpr uint8_t ByteCountNotLocked8 = 7;
ASSERT_EQ(ByteCountNotLocked8, codeBytesSize());
verifyBytes<ByteCountNotLocked8>(codeBytes(), 0x0F, 0xC0, 0x35, 0x00, 0xFF,
0x01, 0x00);
reset();
- __ xadd(IceType_i8, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, Locked);
+ __ xadd(IceType_i8, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ Locked);
static constexpr uint8_t ByteCountLocked8 = 1 + ByteCountNotLocked8;
ASSERT_EQ(ByteCountLocked8, codeBytesSize());
verifyBytes<ByteCountLocked8>(codeBytes(), 0xF0, 0x0F, 0xC0, 0x35, 0x00,
@@ -218,16 +219,16 @@ TEST_F(AssemblerX8632LowLevelTest, Xadd) {
}
{
- __ xadd(IceType_i16, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, NotLocked);
+ __ xadd(IceType_i16, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ NotLocked);
static constexpr uint8_t ByteCountNotLocked16 = 8;
ASSERT_EQ(ByteCountNotLocked16, codeBytesSize());
verifyBytes<ByteCountNotLocked16>(codeBytes(), 0x66, 0x0F, 0xC1, 0x35, 0x00,
0xFF, 0x01, 0x00);
reset();
- __ xadd(IceType_i16, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, Locked);
+ __ xadd(IceType_i16, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ Locked);
static constexpr uint8_t ByteCountLocked16 = 1 + ByteCountNotLocked16;
ASSERT_EQ(ByteCountLocked16, codeBytesSize());
verifyBytes<ByteCountLocked16>(codeBytes(), 0x66, 0xF0, 0x0F, 0xC1, 0x35,
@@ -236,16 +237,16 @@ TEST_F(AssemblerX8632LowLevelTest, Xadd) {
}
{
- __ xadd(IceType_i32, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, NotLocked);
+ __ xadd(IceType_i32, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ NotLocked);
static constexpr uint8_t ByteCountNotLocked32 = 7;
ASSERT_EQ(ByteCountNotLocked32, codeBytesSize());
verifyBytes<ByteCountNotLocked32>(codeBytes(), 0x0F, 0xC1, 0x35, 0x00, 0xFF,
0x01, 0x00);
reset();
- __ xadd(IceType_i32, Address::Absolute(0x1FF00),
- GPRRegister::Encoded_Reg_esi, Locked);
+ __ xadd(IceType_i32, Address(0x1FF00, Fixup), GPRRegister::Encoded_Reg_esi,
+ Locked);
static constexpr uint8_t ByteCountLocked32 = 1 + ByteCountNotLocked32;
ASSERT_EQ(ByteCountLocked32, codeBytesSize());
verifyBytes<ByteCountLocked32>(codeBytes(), 0xF0, 0x0F, 0xC1, 0x35, 0x00,
@@ -305,16 +306,17 @@ TEST_F(AssemblerX8632Test, Cmpxchg8b) {
TEST_F(AssemblerX8632LowLevelTest, Cmpxchg8b) {
static constexpr bool NotLocked = false;
static constexpr bool Locked = true;
+ static constexpr AssemblerFixup *Fixup = nullptr;
// Ensures that cmpxchg8b emits a lock prefix accordingly.
- __ cmpxchg8b(Address::Absolute(0x1FF00), NotLocked);
+ __ cmpxchg8b(Address(0x1FF00, Fixup), NotLocked);
static constexpr uint8_t ByteCountNotLocked = 7;
ASSERT_EQ(ByteCountNotLocked, codeBytesSize());
verifyBytes<ByteCountNotLocked>(codeBytes(), 0x0F, 0xC7, 0x0D, 0x00, 0xFF,
0x01, 0x00);
reset();
- __ cmpxchg8b(Address::Absolute(0x1FF00), Locked);
+ __ cmpxchg8b(Address(0x1FF00, Fixup), Locked);
static constexpr uint8_t ByteCountLocked = 1 + ByteCountNotLocked;
ASSERT_EQ(ByteCountLocked, codeBytesSize());
verifyBytes<ByteCountLocked>(codeBytes(), 0xF0, 0x0F, 0xC7, 0x0D, 0x00, 0xFF,
@@ -397,10 +399,11 @@ TEST_F(AssemblerX8632Test, Cmpxchg) {
TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
static constexpr bool NotLocked = false;
static constexpr bool Locked = true;
+ static constexpr AssemblerFixup *Fixup = nullptr;
// Ensures that cmpxchg emits a lock prefix accordingly.
{
- __ cmpxchg(IceType_i8, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i8, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, NotLocked);
static constexpr uint8_t ByteCountNotLocked8 = 7;
ASSERT_EQ(ByteCountNotLocked8, codeBytesSize());
@@ -408,7 +411,7 @@ TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
0x01, 0x00);
reset();
- __ cmpxchg(IceType_i8, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i8, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, Locked);
static constexpr uint8_t ByteCountLocked8 = 1 + ByteCountNotLocked8;
ASSERT_EQ(ByteCountLocked8, codeBytesSize());
@@ -418,7 +421,7 @@ TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
}
{
- __ cmpxchg(IceType_i16, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i16, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, NotLocked);
static constexpr uint8_t ByteCountNotLocked16 = 8;
ASSERT_EQ(ByteCountNotLocked16, codeBytesSize());
@@ -426,7 +429,7 @@ TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
0xFF, 0x01, 0x00);
reset();
- __ cmpxchg(IceType_i16, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i16, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, Locked);
static constexpr uint8_t ByteCountLocked16 = 1 + ByteCountNotLocked16;
ASSERT_EQ(ByteCountLocked16, codeBytesSize());
@@ -436,7 +439,7 @@ TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
}
{
- __ cmpxchg(IceType_i32, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i32, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, NotLocked);
static constexpr uint8_t ByteCountNotLocked32 = 7;
ASSERT_EQ(ByteCountNotLocked32, codeBytesSize());
@@ -444,7 +447,7 @@ TEST_F(AssemblerX8632LowLevelTest, Cmpxchg) {
0x01, 0x00);
reset();
- __ cmpxchg(IceType_i32, Address::Absolute(0x1FF00),
+ __ cmpxchg(IceType_i32, Address(0x1FF00, Fixup),
GPRRegister::Encoded_Reg_esi, Locked);
static constexpr uint8_t ByteCountLocked32 = 1 + ByteCountNotLocked32;
ASSERT_EQ(ByteCountLocked32, codeBytesSize());

Powered by Google App Engine
This is Rietveld 408576698