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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 1778493004: [wasm] Int64Lowering of Int64Add on ia32 and arm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed the use of the temp register on arm. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 4179 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 4190
4191 4191
4192 TEST(RunTruncateFloat64ToFloat32) { 4192 TEST(RunTruncateFloat64ToFloat32) {
4193 BufferedRawMachineAssemblerTester<float> m(MachineType::Float64()); 4193 BufferedRawMachineAssemblerTester<float> m(MachineType::Float64());
4194 4194
4195 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); 4195 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
4196 4196
4197 FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(*i), m.Call(*i)); } 4197 FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(*i), m.Call(*i)); }
4198 } 4198 }
4199 4199
4200 int64_t ToInt64(uint32_t low, uint32_t high) {
4201 return (static_cast<int64_t>(high) << 32) | static_cast<int64_t>(low);
4202 }
4203
4204 #if V8_TARGET_ARCH_32_BIT
4205 TEST(RunInt32PairAdd) {
4206 BufferedRawMachineAssemblerTester<int32_t> m(
4207 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
4208 MachineType::Int32());
4209
4210 uint32_t high;
4211 uint32_t low;
4212
4213 Node* PairAdd = m.Int32PairAdd(m.Parameter(0), m.Parameter(1), m.Parameter(2),
4214 m.Parameter(3));
4215
4216 m.StoreToPointer(&low, MachineRepresentation::kWord32,
4217 m.Projection(0, PairAdd));
4218 m.StoreToPointer(&high, MachineRepresentation::kWord32,
4219 m.Projection(1, PairAdd));
4220 m.Return(m.Int32Constant(74));
4221
4222 FOR_INT64_INPUTS(i) {
4223 FOR_INT64_INPUTS(j) {
4224 m.Call(static_cast<int32_t>(*i & 0xffffffff),
4225 static_cast<int32_t>(*i >> 32),
4226 static_cast<int32_t>(*j & 0xffffffff),
4227 static_cast<int32_t>(*j >> 32));
4228 CHECK_EQ(*i + *j, ToInt64(low, high));
4229 }
4230 }
4231 }
4232
4233 void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) {
4234 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
4235 MachineType::Uint32());
4236
4237 uint32_t high;
4238 uint32_t low;
4239
4240 Node* PairAdd = m.Int32PairAdd(m.Parameter(a), m.Parameter(b), m.Parameter(c),
4241 m.Parameter(d));
4242
4243 m.StoreToPointer(&low, MachineRepresentation::kWord32,
4244 m.Projection(0, PairAdd));
4245 m.StoreToPointer(&high, MachineRepresentation::kWord32,
4246 m.Projection(1, PairAdd));
4247 m.Return(m.Int32Constant(74));
4248
4249 FOR_UINT32_INPUTS(i) {
4250 FOR_UINT32_INPUTS(j) {
4251 m.Call(*i, *j);
4252 uint32_t inputs[] = {*i, *j};
4253 CHECK_EQ(ToInt64(inputs[a], inputs[b]) + ToInt64(inputs[c], inputs[d]),
4254 ToInt64(low, high));
4255 }
4256 }
4257 }
4258
4259 TEST(RunInt32PairAddWithSharedInput) {
4260 TestInt32PairAddWithSharedInput(0, 0, 0, 0);
4261 TestInt32PairAddWithSharedInput(1, 0, 0, 0);
4262 TestInt32PairAddWithSharedInput(0, 1, 0, 0);
4263 TestInt32PairAddWithSharedInput(0, 0, 1, 0);
4264 TestInt32PairAddWithSharedInput(0, 0, 0, 1);
4265 TestInt32PairAddWithSharedInput(1, 1, 0, 0);
4266 }
4267 #endif
4200 4268
4201 TEST(RunDeadChangeFloat64ToInt32) { 4269 TEST(RunDeadChangeFloat64ToInt32) {
4202 RawMachineAssemblerTester<int32_t> m; 4270 RawMachineAssemblerTester<int32_t> m;
4203 const int magic = 0x88abcda4; 4271 const int magic = 0x88abcda4;
4204 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); 4272 m.ChangeFloat64ToInt32(m.Float64Constant(999.78));
4205 m.Return(m.Int32Constant(magic)); 4273 m.Return(m.Int32Constant(magic));
4206 CHECK_EQ(magic, m.Call()); 4274 CHECK_EQ(magic, m.Call());
4207 } 4275 }
4208 4276
4209 4277
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
6127 r.Goto(&merge); 6195 r.Goto(&merge);
6128 r.Bind(&merge); 6196 r.Bind(&merge);
6129 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6197 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6130 r.Return(phi); 6198 r.Return(phi);
6131 CHECK_EQ(1, r.Call(1)); 6199 CHECK_EQ(1, r.Call(1));
6132 } 6200 }
6133 6201
6134 } // namespace compiler 6202 } // namespace compiler
6135 } // namespace internal 6203 } // namespace internal
6136 } // namespace v8 6204 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698