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

Unified Diff: test/cctest/compiler/test-run-load-store.cc

Issue 1908253007: Fix cctest/test-run-load-store for big-endian architectures. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add RunLoadStoreSignExtend64 Created 4 years, 8 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: test/cctest/compiler/test-run-load-store.cc
diff --git a/test/cctest/compiler/test-run-load-store.cc b/test/cctest/compiler/test-run-load-store.cc
index f35dc4fe2e4994c04ceca2020fb4fda5871a9cdf..6484d30a2b0902cc1f2db65e52e6a240b01c3228 100644
--- a/test/cctest/compiler/test-run-load-store.cc
+++ b/test/cctest/compiler/test-run-load-store.cc
@@ -222,11 +222,19 @@ TEST(RunLoadStore) {
#endif
}
+#if V8_TARGET_LITTLE_ENDIAN
+#define LSB(addr, bytes) addr
+#elif V8_TARGET_BIG_ENDIAN
+#define LSB(addr, bytes) reinterpret_cast<byte*>(addr + 1) - bytes
+#else
+#error "Unknown Architecture"
+#endif
+
TEST(RunLoadStoreSignExtend32) {
int32_t buffer[4];
RawMachineAssemblerTester<int32_t> m;
- Node* load8 = m.LoadFromPointer(&buffer[0], MachineType::Int8());
- Node* load16 = m.LoadFromPointer(&buffer[0], MachineType::Int16());
+ Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Int8());
+ Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16());
Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Int32());
m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8);
m.StoreToPointer(&buffer[2], MachineRepresentation::kWord32, load16);
@@ -246,8 +254,8 @@ TEST(RunLoadStoreSignExtend32) {
TEST(RunLoadStoreZeroExtend32) {
uint32_t buffer[4];
RawMachineAssemblerTester<uint32_t> m;
- Node* load8 = m.LoadFromPointer(&buffer[0], MachineType::Uint8());
- Node* load16 = m.LoadFromPointer(&buffer[0], MachineType::Uint16());
+ Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8());
+ Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16());
Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Uint32());
m.StoreToPointer(&buffer[1], MachineRepresentation::kWord32, load8);
m.StoreToPointer(&buffer[2], MachineRepresentation::kWord32, load16);
@@ -284,9 +292,9 @@ TEST(RunLoadStoreSignExtend64) {
if (true) return; // TODO(titzer): sign extension of loads to 64-bit.
int64_t buffer[5];
RawMachineAssemblerTester<int64_t> m;
- Node* load8 = m.LoadFromPointer(&buffer[0], MachineType::Int8());
- Node* load16 = m.LoadFromPointer(&buffer[0], MachineType::Int16());
- Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Int32());
+ Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Int8());
+ Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Int16());
+ Node* load32 = m.LoadFromPointer(LSB(&buffer[0], 4), MachineType::Int32());
Node* load64 = m.LoadFromPointer(&buffer[0], MachineType::Int64());
m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8);
m.StoreToPointer(&buffer[2], MachineRepresentation::kWord64, load16);
@@ -309,9 +317,9 @@ TEST(RunLoadStoreZeroExtend64) {
if (kPointerSize < 8) return;
uint64_t buffer[5];
RawMachineAssemblerTester<int64_t> m;
- Node* load8 = m.LoadFromPointer(&buffer[0], MachineType::Uint8());
- Node* load16 = m.LoadFromPointer(&buffer[0], MachineType::Uint16());
- Node* load32 = m.LoadFromPointer(&buffer[0], MachineType::Uint32());
+ Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8());
+ Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16());
+ Node* load32 = m.LoadFromPointer(LSB(&buffer[0], 4), MachineType::Uint32());
Node* load64 = m.LoadFromPointer(&buffer[0], MachineType::Uint64());
m.StoreToPointer(&buffer[1], MachineRepresentation::kWord64, load8);
m.StoreToPointer(&buffer[2], MachineRepresentation::kWord64, load16);
« 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