Commit f92a5631 authored by titzer's avatar titzer Committed by Commit bot

[test] Add test for RunLoadImmIndex<float> and RunLoadImmIndex<double>.

R=jarin@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1694183002

Cr-Commit-Position: refs/heads/master@{#33987}
parent e0129d0f
...@@ -3533,7 +3533,7 @@ static void RunLoadImmIndex(MachineType rep) { ...@@ -3533,7 +3533,7 @@ static void RunLoadImmIndex(MachineType rep) {
const int kNumElems = 3; const int kNumElems = 3;
Type buffer[kNumElems]; Type buffer[kNumElems];
// initialize the buffer with raw data. // initialize the buffer with some raw data.
byte* raw = reinterpret_cast<byte*>(buffer); byte* raw = reinterpret_cast<byte*>(buffer);
for (size_t i = 0; i < sizeof(buffer); i++) { for (size_t i = 0; i < sizeof(buffer); i++) {
raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA); raw[i] = static_cast<byte>((i + sizeof(buffer)) ^ 0xAA);
...@@ -3542,14 +3542,14 @@ static void RunLoadImmIndex(MachineType rep) { ...@@ -3542,14 +3542,14 @@ static void RunLoadImmIndex(MachineType rep) {
// Test with various large and small offsets. // Test with various large and small offsets.
for (int offset = -1; offset <= 200000; offset *= -5) { for (int offset = -1; offset <= 200000; offset *= -5) {
for (int i = 0; i < kNumElems; i++) { for (int i = 0; i < kNumElems; i++) {
RawMachineAssemblerTester<Type> m; BufferedRawMachineAssemblerTester<Type> m;
Node* base = m.PointerConstant(buffer - offset); Node* base = m.PointerConstant(buffer - offset);
Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0]));
m.Return(m.Load(rep, base, index)); m.Return(m.Load(rep, base, index));
Type expected = buffer[i]; volatile Type expected = buffer[i];
Type actual = m.Call(); volatile Type actual = m.Call();
CHECK(expected == actual); CHECK_EQ(expected, actual);
} }
} }
} }
...@@ -3563,9 +3563,11 @@ TEST(RunLoadImmIndex) { ...@@ -3563,9 +3563,11 @@ TEST(RunLoadImmIndex) {
RunLoadImmIndex<int32_t>(MachineType::Int32()); RunLoadImmIndex<int32_t>(MachineType::Int32());
RunLoadImmIndex<uint32_t>(MachineType::Uint32()); RunLoadImmIndex<uint32_t>(MachineType::Uint32());
RunLoadImmIndex<int32_t*>(MachineType::AnyTagged()); RunLoadImmIndex<int32_t*>(MachineType::AnyTagged());
RunLoadImmIndex<float>(MachineType::Float32());
// TODO(titzer): test kRepBit loads RunLoadImmIndex<double>(MachineType::Float64());
// TODO(titzer): test MachineType::Float64() loads if (kPointerSize == 8) {
RunLoadImmIndex<int64_t>(MachineType::Int64());
}
// TODO(titzer): test various indexing modes. // TODO(titzer): test various indexing modes.
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment