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

Unified Diff: unittest/AssemblerX8664/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/AssemblerX8664/Locked.cpp
diff --git a/unittest/AssemblerX8664/Locked.cpp b/unittest/AssemblerX8664/Locked.cpp
index 086bd04732b14126d51a625b810df7be00554b33..982ad4a489364409c2291a8d7c5b82c7f4ee4eea 100644
--- a/unittest/AssemblerX8664/Locked.cpp
+++ b/unittest/AssemblerX8664/Locked.cpp
@@ -201,18 +201,18 @@ TEST_F(AssemblerX8664Test, Xadd) {
TEST_F(AssemblerX8664LowLevelTest, 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), Encoded_GPR_r14(),
- NotLocked);
+ __ xadd(IceType_i8, Address(0x1FF00, Fixup), Encoded_GPR_r14(), NotLocked);
static constexpr uint8_t ByteCountNotLocked8 = 8;
ASSERT_EQ(ByteCountNotLocked8, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountNotLocked8>(codeBytes(), 0x44, 0x0F, 0xC0,
0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ xadd(IceType_i8, Address::Absolute(0x1FF00), Encoded_GPR_r14(), Locked);
+ __ xadd(IceType_i8, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked8 = 1 + ByteCountNotLocked8;
ASSERT_EQ(ByteCountLocked8, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked8>(
@@ -221,15 +221,14 @@ TEST_F(AssemblerX8664LowLevelTest, Xadd) {
}
{
- __ xadd(IceType_i16, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
- NotLocked);
+ __ xadd(IceType_i16, Address(0x1FF00, Fixup), Encoded_GPR_r14(), NotLocked);
static constexpr uint8_t ByteCountNotLocked16 = 9;
ASSERT_EQ(ByteCountNotLocked16, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountNotLocked16>(
codeBytes(), 0x66, 0x44, 0x0F, 0xC1, 0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ xadd(IceType_i16, Address::Absolute(0x1FF00), Encoded_GPR_r14(), Locked);
+ __ xadd(IceType_i16, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked16 = 1 + ByteCountNotLocked16;
ASSERT_EQ(ByteCountLocked16, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked16>(codeBytes(), 0x66, 0xF0, 0x44,
@@ -239,15 +238,14 @@ TEST_F(AssemblerX8664LowLevelTest, Xadd) {
}
{
- __ xadd(IceType_i32, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
- NotLocked);
+ __ xadd(IceType_i32, Address(0x1FF00, Fixup), Encoded_GPR_r14(), NotLocked);
static constexpr uint8_t ByteCountNotLocked32 = 8;
ASSERT_EQ(ByteCountNotLocked32, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountNotLocked32>(
codeBytes(), 0x44, 0x0F, 0xC1, 0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ xadd(IceType_i32, Address::Absolute(0x1FF00), Encoded_GPR_r14(), Locked);
+ __ xadd(IceType_i32, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked32 = 1 + ByteCountNotLocked32;
ASSERT_EQ(ByteCountLocked32, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked32>(
@@ -327,16 +325,17 @@ TEST_F(AssemblerX8664Test, Cmpxchg8b) {
TEST_F(AssemblerX8664LowLevelTest, 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());
ASSERT_TRUE(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());
ASSERT_TRUE(verifyBytes<ByteCountLocked>(codeBytes(), 0xF0, 0x0F, 0xC7, 0x0D,
@@ -433,10 +432,11 @@ TEST_F(AssemblerX8664Test, Cmpxchg) {
TEST_F(AssemblerX8664LowLevelTest, 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), Encoded_GPR_r14(),
+ __ cmpxchg(IceType_i8, Address(0x1FF00, Fixup), Encoded_GPR_r14(),
NotLocked);
static constexpr uint8_t ByteCountNotLocked8 = 8;
ASSERT_EQ(ByteCountNotLocked8, codeBytesSize());
@@ -444,8 +444,7 @@ TEST_F(AssemblerX8664LowLevelTest, Cmpxchg) {
0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ cmpxchg(IceType_i8, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
- Locked);
+ __ cmpxchg(IceType_i8, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked8 = 1 + ByteCountNotLocked8;
ASSERT_EQ(ByteCountLocked8, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked8>(
@@ -454,7 +453,7 @@ TEST_F(AssemblerX8664LowLevelTest, Cmpxchg) {
}
{
- __ cmpxchg(IceType_i16, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
+ __ cmpxchg(IceType_i16, Address(0x1FF00, Fixup), Encoded_GPR_r14(),
NotLocked);
static constexpr uint8_t ByteCountNotLocked16 = 9;
ASSERT_EQ(ByteCountNotLocked16, codeBytesSize());
@@ -462,8 +461,7 @@ TEST_F(AssemblerX8664LowLevelTest, Cmpxchg) {
codeBytes(), 0x66, 0x44, 0x0F, 0xB1, 0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ cmpxchg(IceType_i16, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
- Locked);
+ __ cmpxchg(IceType_i16, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked16 = 1 + ByteCountNotLocked16;
ASSERT_EQ(ByteCountLocked16, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked16>(codeBytes(), 0x66, 0xF0, 0x44,
@@ -473,7 +471,7 @@ TEST_F(AssemblerX8664LowLevelTest, Cmpxchg) {
}
{
- __ cmpxchg(IceType_i32, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
+ __ cmpxchg(IceType_i32, Address(0x1FF00, Fixup), Encoded_GPR_r14(),
NotLocked);
static constexpr uint8_t ByteCountNotLocked32 = 8;
ASSERT_EQ(ByteCountNotLocked32, codeBytesSize());
@@ -481,8 +479,7 @@ TEST_F(AssemblerX8664LowLevelTest, Cmpxchg) {
codeBytes(), 0x44, 0x0F, 0xB1, 0x35, 0x00, 0xFF, 0x01, 0x00));
reset();
- __ cmpxchg(IceType_i32, Address::Absolute(0x1FF00), Encoded_GPR_r14(),
- Locked);
+ __ cmpxchg(IceType_i32, Address(0x1FF00, Fixup), Encoded_GPR_r14(), Locked);
static constexpr uint8_t ByteCountLocked32 = 1 + ByteCountNotLocked32;
ASSERT_EQ(ByteCountLocked32, codeBytesSize());
ASSERT_TRUE(verifyBytes<ByteCountLocked32>(

Powered by Google App Engine
This is Rietveld 408576698