Chromium Code Reviews

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 470593002: Unify MachineType and RepType. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Forgot a RepresentationOf() in arm64. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index edac9750434a484017d3920b16cfe2fa0757b562..84255e69c4128852ca249e6c06388acf522555fe 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -11,6 +11,9 @@
#if V8_TURBOFAN_TARGET
+#define CHECK_UINT32_EQ(x, y) \
Michael Starzinger 2014/08/13 15:40:05 *sigh*
Benedikt Meurer 2014/08/13 19:42:07 CheckEqualsHelper for unsigned.
titzer 2014/08/14 07:50:18 I tried that. C++ doesn't like ambiguous overloads
+ CHECK_EQ(static_cast<int32_t>(x), static_cast<int32_t>(y))
+
using namespace v8::internal;
using namespace v8::internal::compiler;
@@ -41,7 +44,7 @@ static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) {
case 6:
return m->Int32Constant(0x01234567);
case 7:
- return m->Load(kMachineWord32, m->PointerConstant(NULL));
+ return m->Load(mInt32, m->PointerConstant(NULL));
default:
return NULL;
}
@@ -66,7 +69,7 @@ TEST(CodeGenInt32Binop) {
for (int i = 0; ops[i] != NULL; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 8; k++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32);
Node* a = Int32Input(&m, j);
Node* b = Int32Input(&m, k);
m.Return(m.NewNode(ops[i], a, b));
@@ -218,7 +221,7 @@ static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node* cond_node,
TEST(RunDiamondPhiConst) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
int false_val = 0xFF666;
int true_val = 0x00DDD;
Node* true_node = m.Int32Constant(true_val);
@@ -230,7 +233,7 @@ TEST(RunDiamondPhiConst) {
TEST(RunDiamondPhiNumber) {
- RawMachineAssemblerTester<Object*> m(kMachineWord32);
+ RawMachineAssemblerTester<Object*> m(mInt32);
double false_val = -11.1;
double true_val = 200.1;
Node* true_node = m.NumberConstant(true_val);
@@ -242,7 +245,7 @@ TEST(RunDiamondPhiNumber) {
TEST(RunDiamondPhiString) {
- RawMachineAssemblerTester<Object*> m(kMachineWord32);
+ RawMachineAssemblerTester<Object*> m(mInt32);
const char* false_val = "false";
const char* true_val = "true";
Node* true_node = m.StringConstant(true_val);
@@ -254,8 +257,7 @@ TEST(RunDiamondPhiString) {
TEST(RunDiamondPhiParam) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32, mInt32);
BuildDiamondPhi(&m, m.Parameter(0), m.Parameter(1), m.Parameter(2));
int32_t c1 = 0x260cb75a;
int32_t c2 = 0xcd3e9c8b;
@@ -293,8 +295,7 @@ TEST(RunLoopPhiConst) {
TEST(RunLoopPhiParam) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32, mInt32);
MLabel blocka, blockb;
MLabel* end = m.Exit();
@@ -492,7 +493,7 @@ TEST(RunLoadInt32) {
RawMachineAssemblerTester<int32_t> m;
int32_t p1 = 0; // loads directly from this location.
- m.Return(m.LoadFromPointer(&p1, kMachineWord32));
+ m.Return(m.LoadFromPointer(&p1, mInt32));
FOR_INT32_INPUTS(i) {
p1 = *i;
@@ -512,7 +513,7 @@ TEST(RunLoadInt32Offset) {
int32_t offset = offsets[i];
byte* pointer = reinterpret_cast<byte*>(&p1) - offset;
// generate load [#base + #index]
- m.Return(m.LoadFromPointer(pointer, kMachineWord32, offset));
+ m.Return(m.LoadFromPointer(pointer, mInt32, offset));
FOR_INT32_INPUTS(j) {
p1 = *j;
@@ -533,10 +534,9 @@ TEST(RunLoadStoreFloat64Offset) {
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
- Node* load = m.Load(kMachineFloat64, m.PointerConstant(from),
- m.Int32Constant(offset));
- m.Store(kMachineFloat64, m.PointerConstant(to), m.Int32Constant(offset),
- load);
+ Node* load =
+ m.Load(mFloat64, m.PointerConstant(from), m.Int32Constant(offset));
+ m.Store(mFloat64, m.PointerConstant(to), m.Int32Constant(offset), load);
m.Return(m.Int32Constant(magic));
FOR_FLOAT64_INPUTS(j) {
@@ -567,8 +567,7 @@ TEST(RunInt32AddP) {
TEST(RunInt32AddAndWord32SarP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Int32Add(m.Parameter(0),
m.Word32Sar(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -582,8 +581,7 @@ TEST(RunInt32AddAndWord32SarP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mUint32, mUint32);
m.Return(m.Int32Add(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_INT32_INPUTS(i) {
@@ -601,8 +599,7 @@ TEST(RunInt32AddAndWord32SarP) {
TEST(RunInt32AddAndWord32ShlP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Int32Add(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -616,8 +613,7 @@ TEST(RunInt32AddAndWord32ShlP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mUint32, mUint32);
m.Return(m.Int32Add(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_INT32_INPUTS(i) {
@@ -635,8 +631,7 @@ TEST(RunInt32AddAndWord32ShlP) {
TEST(RunInt32AddAndWord32ShrP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Int32Add(m.Parameter(0),
m.Word32Shr(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -650,8 +645,7 @@ TEST(RunInt32AddAndWord32ShrP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Int32Add(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_UINT32_INPUTS(i) {
@@ -671,7 +665,7 @@ TEST(RunInt32AddInBranch) {
static const int32_t constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -689,7 +683,7 @@ TEST(RunInt32AddInBranch) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -707,7 +701,7 @@ TEST(RunInt32AddInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -717,14 +711,14 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -734,8 +728,8 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -744,8 +738,7 @@ TEST(RunInt32AddInBranch) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Add(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1),
@@ -786,47 +779,47 @@ TEST(RunInt32AddInBranch) {
TEST(RunInt32AddInComparison) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i + *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Constant(0), m.Int32Add(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i + *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i + *j) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(*i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*j + *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*j + *i) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -835,8 +828,7 @@ TEST(RunInt32AddInComparison) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Word32Equal(
m.Int32Add(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
@@ -870,15 +862,14 @@ TEST(RunInt32AddInComparison) {
TEST(RunInt32SubP) {
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
m.Return(m.Int32Sub(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- // Use uint32_t because signed overflow is UB in C.
- int expected = static_cast<int32_t>(*i - *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = static_cast<int32_t>(*i - *j);
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -887,23 +878,21 @@ TEST(RunInt32SubP) {
TEST(RunInt32SubImm) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t expected = static_cast<int32_t>(*i - *j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = *i - *j;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)));
FOR_UINT32_INPUTS(j) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t expected = static_cast<int32_t>(*j - *i);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = *j - *i;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -912,14 +901,12 @@ TEST(RunInt32SubImm) {
TEST(RunInt32SubAndWord32SarP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Int32Sub(m.Parameter(0),
m.Word32Sar(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- // Use uint32_t because signed overflow is UB in C.
int32_t expected = *i - (*j >> shift);
CHECK_EQ(expected, m.Call(*i, *j, shift));
}
@@ -927,14 +914,12 @@ TEST(RunInt32SubAndWord32SarP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mUint32, mUint32);
m.Return(m.Int32Sub(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_INT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- // Use uint32_t because signed overflow is UB in C.
int32_t expected = (*i >> shift) - *k;
CHECK_EQ(expected, m.Call(*i, shift, *k));
}
@@ -946,14 +931,12 @@ TEST(RunInt32SubAndWord32SarP) {
TEST(RunInt32SubAndWord32ShlP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Int32Sub(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- // Use uint32_t because signed overflow is UB in C.
int32_t expected = *i - (*j << shift);
CHECK_EQ(expected, m.Call(*i, *j, shift));
}
@@ -961,8 +944,7 @@ TEST(RunInt32SubAndWord32ShlP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mUint32, mUint32);
m.Return(m.Int32Sub(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_INT32_INPUTS(i) {
@@ -980,8 +962,7 @@ TEST(RunInt32SubAndWord32ShlP) {
TEST(RunInt32SubAndWord32ShrP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Int32Sub(m.Parameter(0),
m.Word32Shr(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -989,14 +970,13 @@ TEST(RunInt32SubAndWord32ShrP) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
int32_t expected = *i - (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ CHECK_UINT32_EQ(expected, m.Call(*i, *j, shift));
}
}
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Int32Sub(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_UINT32_INPUTS(i) {
@@ -1016,7 +996,7 @@ TEST(RunInt32SubInBranch) {
static const int constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -1034,7 +1014,7 @@ TEST(RunInt32SubInBranch) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -1052,7 +1032,7 @@ TEST(RunInt32SubInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -1069,7 +1049,7 @@ TEST(RunInt32SubInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -1089,8 +1069,7 @@ TEST(RunInt32SubInBranch) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Sub(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1),
@@ -1131,47 +1110,47 @@ TEST(RunInt32SubInBranch) {
TEST(RunInt32SubInComparison) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i - *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Constant(0), m.Int32Sub(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i - *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i - *j) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*j - *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*j - *i) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -1180,8 +1159,7 @@ TEST(RunInt32SubInComparison) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
m.Return(m.Word32Equal(
m.Int32Sub(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1), m.Parameter(2))),
@@ -1227,12 +1205,12 @@ TEST(RunInt32MulP) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Int32Mul(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int expected = static_cast<int32_t>(*i * *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = *i * *j;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -1242,21 +1220,21 @@ TEST(RunInt32MulP) {
TEST(RunInt32MulImm) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Int32Mul(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(*i * *j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = *i * *j;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(*i)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(*j * *i);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = *j * *i;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -1265,8 +1243,7 @@ TEST(RunInt32MulImm) {
TEST(RunInt32MulAndInt32AddP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32, mInt32);
m.Return(
m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2))));
FOR_INT32_INPUTS(i) {
@@ -1282,8 +1259,7 @@ TEST(RunInt32MulAndInt32AddP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32, mInt32);
m.Return(
m.Int32Add(m.Int32Mul(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
FOR_INT32_INPUTS(i) {
@@ -1319,8 +1295,7 @@ TEST(RunInt32MulAndInt32AddP) {
TEST(RunInt32MulAndInt32SubP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mInt32);
m.Return(
m.Int32Sub(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -1532,25 +1507,25 @@ TEST(RunWord32AndP) {
TEST(RunWord32AndAndWord32ShlP) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Shl(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i << (*j & 0x1f);
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Shl(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i << (0x1f & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -1560,25 +1535,25 @@ TEST(RunWord32AndAndWord32ShlP) {
TEST(RunWord32AndAndWord32ShrP) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Shr(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i >> (*j & 0x1f);
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Shr(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i >> (0x1f & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -1592,8 +1567,8 @@ TEST(RunWord32AndAndWord32SarP) {
bt.AddReturn(
m.Word32Sar(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f))));
FOR_INT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i >> (*j & 0x1f);
+ FOR_INT32_INPUTS(j) {
+ int32_t expected = *i >> (*j & 0x1f);
CHECK_EQ(expected, bt.call(*i, *j));
}
}
@@ -1604,7 +1579,7 @@ TEST(RunWord32AndAndWord32SarP) {
bt.AddReturn(
m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1)));
FOR_INT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(j) {
uint32_t expected = *i >> (0x1f & *j);
CHECK_EQ(expected, bt.call(*i, *j));
}
@@ -1616,21 +1591,21 @@ TEST(RunWord32AndAndWord32SarP) {
TEST(RunWord32AndImm) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32And(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i & *j;
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32And(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i & ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -1641,7 +1616,7 @@ TEST(RunWord32AndInBranch) {
static const int constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -1659,7 +1634,7 @@ TEST(RunWord32AndInBranch) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -1677,7 +1652,7 @@ TEST(RunWord32AndInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -1694,7 +1669,7 @@ TEST(RunWord32AndInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
@@ -1715,8 +1690,7 @@ TEST(RunWord32AndInBranch) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32And(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1),
@@ -1757,47 +1731,47 @@ TEST(RunWord32AndInBranch) {
TEST(RunWord32AndInComparison) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i & *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Constant(0), m.Word32And(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i & *j) == 0;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i & *j) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(*i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*j & *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*j & *i) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -1807,34 +1781,34 @@ TEST(RunWord32AndInComparison) {
TEST(RunWord32OrP) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Or(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Or(bt.param0, m.Word32Not(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Or(m.Word32Not(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = ~(*i) | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -1844,21 +1818,21 @@ TEST(RunWord32OrP) {
TEST(RunWord32OrImm) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | *j;
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Or(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -1878,8 +1852,8 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(constant));
m.Bind(&blockb);
bt.AddReturn(m.Int32Constant(0 - constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, bt.call(*i, *j));
}
@@ -1896,16 +1870,16 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(constant));
m.Bind(&blockb);
bt.AddReturn(m.Int32Constant(0 - constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
{
- FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ FOR_INT32_INPUTS(i) {
+ RawMachineAssemblerTester<int32_t> m(mInt32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -1914,15 +1888,15 @@ TEST(RunWord32OrInBranch) {
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(j) {
int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(*j));
}
}
}
{
- FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ FOR_INT32_INPUTS(i) {
+ RawMachineAssemblerTester<int32_t> m(mInt32);
MLabel blocka, blockb;
m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -1931,7 +1905,7 @@ TEST(RunWord32OrInBranch) {
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(j) {
int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(*j));
}
@@ -1942,8 +1916,7 @@ TEST(RunWord32OrInBranch) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Or(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1),
@@ -1984,7 +1957,7 @@ TEST(RunWord32OrInBranch) {
TEST(RunWord32OrInComparison) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
@@ -1996,7 +1969,7 @@ TEST(RunWord32OrInComparison) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Constant(0), m.Word32Or(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
@@ -2008,23 +1981,23 @@ TEST(RunWord32OrInComparison) {
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i | *j) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(*i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*j | *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*j | *i) == 0;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -2034,22 +2007,22 @@ TEST(RunWord32OrInComparison) {
TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
m.Return(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Xor(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = *i ^ *j;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
@@ -2057,9 +2030,9 @@ TEST(RunWord32XorP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(m.Word32Xor(bt.param0, m.Word32Not(bt.param1)));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ ~(*j);
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
+ int32_t expected = *i ^ ~(*j);
CHECK_EQ(expected, bt.call(*i, *j));
}
}
@@ -2068,20 +2041,20 @@ TEST(RunWord32XorP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(m.Word32Xor(m.Word32Not(bt.param0), bt.param1));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = ~(*i) ^ *j;
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
+ int32_t expected = ~(*i) ^ *j;
CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Xor(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i ^ ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -2089,10 +2062,10 @@ TEST(RunWord32XorP) {
TEST(RunWord32XorInBranch) {
- static const int constant = 987654321;
+ static const uint32_t constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Word32Xor(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -2103,14 +2076,14 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Word32Xor(bt.param0, bt.param1), m.Int32Constant(0)),
@@ -2121,14 +2094,14 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, bt.call(*i, *j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
m.Int32Constant(0)),
@@ -2138,14 +2111,14 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
@@ -2156,8 +2129,8 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
@@ -2166,8 +2139,7 @@ TEST(RunWord32XorInBranch) {
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < ARRAY_SIZE(shops); n++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mInt32, mUint32);
MLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Xor(m.Parameter(0),
m.NewNode(shops[n], m.Parameter(1),
@@ -2208,22 +2180,22 @@ TEST(RunWord32XorInBranch) {
TEST(RunWord32ShlP) {
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j << shift;
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Shl(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = *i << shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift));
}
}
}
@@ -2233,22 +2205,22 @@ TEST(RunWord32ShlP) {
TEST(RunWord32ShrP) {
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<uint32_t> m(mUint32);
m.Return(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j >> shift;
- CHECK_EQ(expected, m.Call(*j));
+ CHECK_UINT32_EQ(expected, m.Call(*j));
}
}
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Word32Shr(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = *i >> shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift));
}
}
CHECK_EQ(0x00010000, bt.call(0x80000000, 15));
@@ -2259,7 +2231,7 @@ TEST(RunWord32ShrP) {
TEST(RunWord32SarP) {
{
FOR_INT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
m.Return(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)));
FOR_INT32_INPUTS(j) {
int32_t expected = *j >> shift;
@@ -2283,9 +2255,9 @@ TEST(RunWord32SarP) {
TEST(RunWord32NotP) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
m.Return(m.Word32Not(m.Parameter(0)));
- FOR_UINT32_INPUTS(i) {
+ FOR_INT32_INPUTS(i) {
int expected = ~(*i);
CHECK_EQ(expected, m.Call(*i));
}
@@ -2293,7 +2265,7 @@ TEST(RunWord32NotP) {
TEST(RunInt32NegP) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
m.Return(m.Int32Neg(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
int expected = -*i;
@@ -2304,8 +2276,7 @@ TEST(RunInt32NegP) {
TEST(RunWord32EqualAndWord32SarP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32, mUint32);
m.Return(m.Word32Equal(m.Parameter(0),
m.Word32Sar(m.Parameter(1), m.Parameter(2))));
FOR_INT32_INPUTS(i) {
@@ -2318,8 +2289,7 @@ TEST(RunWord32EqualAndWord32SarP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mUint32, mInt32);
m.Return(m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_INT32_INPUTS(i) {
@@ -2336,8 +2306,7 @@ TEST(RunWord32EqualAndWord32SarP) {
TEST(RunWord32EqualAndWord32ShlP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Word32Equal(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -2350,8 +2319,7 @@ TEST(RunWord32EqualAndWord32ShlP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_UINT32_INPUTS(i) {
@@ -2368,8 +2336,7 @@ TEST(RunWord32EqualAndWord32ShlP) {
TEST(RunWord32EqualAndWord32ShrP) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Word32Equal(m.Parameter(0),
m.Word32Shr(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
@@ -2382,8 +2349,7 @@ TEST(RunWord32EqualAndWord32ShrP) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
- kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32, mUint32, mUint32);
m.Return(m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
FOR_UINT32_INPUTS(i) {
@@ -2400,8 +2366,7 @@ TEST(RunWord32EqualAndWord32ShrP) {
TEST(RunDeadNodes) {
for (int i = 0; true; i++) {
- RawMachineAssemblerTester<int32_t> m(i == 5 ? kMachineWord32
- : kMachineLast);
+ RawMachineAssemblerTester<int32_t> m(i == 5 ? mInt32 : mNone);
int constant = 0x55 + i;
switch (i) {
case 0:
@@ -2417,7 +2382,7 @@ TEST(RunDeadNodes) {
m.PointerConstant(&constant);
break;
case 4:
- m.LoadFromPointer(&constant, kMachineWord32);
+ m.LoadFromPointer(&constant, mInt32);
break;
case 5:
m.Parameter(0);
@@ -2451,7 +2416,7 @@ TEST(RunDeadInt32Binops) {
NULL};
for (int i = 0; ops[i] != NULL; i++) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32);
int constant = 0x55555 + i;
m.NewNode(ops[i], m.Parameter(0), m.Parameter(1));
m.Return(m.Int32Constant(constant));
@@ -2490,12 +2455,13 @@ static void RunLoadImmIndex(MachineType rep) {
TEST(RunLoadImmIndex) {
- RunLoadImmIndex<int8_t, uint8_t>(kMachineWord8);
- RunLoadImmIndex<int16_t, uint16_t>(kMachineWord16);
- RunLoadImmIndex<int32_t, uint32_t>(kMachineWord32);
- RunLoadImmIndex<int32_t*, int32_t*>(kMachineTagged);
+ RunLoadImmIndex<int8_t, uint8_t>(mInt8);
+ RunLoadImmIndex<int16_t, uint16_t>(mInt16);
+ RunLoadImmIndex<int32_t, uint32_t>(mInt32);
+ RunLoadImmIndex<int32_t*, int32_t*>(mAnyTagged);
- // TODO(titzer): test kMachineFloat64 loads
+ // TODO(titzer): test rBit loads
+ // TODO(titzer): test mFloat64 loads
// TODO(titzer): test various indexing modes.
}
@@ -2530,11 +2496,11 @@ static void RunLoadStore(MachineType rep) {
TEST(RunLoadStore) {
- RunLoadStore<int8_t>(kMachineWord8);
- RunLoadStore<int16_t>(kMachineWord16);
- RunLoadStore<int32_t>(kMachineWord32);
- RunLoadStore<void*>(kMachineTagged);
- RunLoadStore<double>(kMachineFloat64);
+ RunLoadStore<int8_t>(mInt8);
+ RunLoadStore<int16_t>(mInt16);
+ RunLoadStore<int32_t>(mInt32);
+ RunLoadStore<void*>(mAnyTagged);
+ RunLoadStore<double>(mFloat64);
}
@@ -2566,7 +2532,7 @@ TEST(RunFloat64Binop) {
Node* binop = m.NewNode(ops[i], a, b);
Node* base = m.PointerConstant(&result);
Node* zero = m.Int32Constant(0);
- m.Store(kMachineFloat64, base, zero, binop);
+ m.Store(mFloat64, base, zero, binop);
m.Return(m.Int32Constant(i + j));
CHECK_EQ(i + j, m.Call());
}
@@ -2627,9 +2593,9 @@ TEST(RunFloat64SubImm1) {
FOR_FLOAT64_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- Node* t0 = m.LoadFromPointer(&input, kMachineFloat64);
+ Node* t0 = m.LoadFromPointer(&input, mFloat64);
Node* t1 = m.Float64Sub(m.Float64Constant(*i), t0);
- m.StoreToPointer(&output, kMachineFloat64, t1);
+ m.StoreToPointer(&output, mFloat64, t1);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(j) {
input = *j;
@@ -2647,9 +2613,9 @@ TEST(RunFloat64SubImm2) {
FOR_FLOAT64_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- Node* t0 = m.LoadFromPointer(&input, kMachineFloat64);
+ Node* t0 = m.LoadFromPointer(&input, mFloat64);
Node* t1 = m.Float64Sub(t0, m.Float64Constant(*i));
- m.StoreToPointer(&output, kMachineFloat64, t1);
+ m.StoreToPointer(&output, mFloat64, t1);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(j) {
input = *j;
@@ -2684,11 +2650,10 @@ TEST(RunFloat64MulAndFloat64AddP) {
{
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
- Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
- Node* c = m.LoadFromPointer(&input_c, kMachineFloat64);
- m.StoreToPointer(&output, kMachineFloat64,
- m.Float64Add(m.Float64Mul(a, b), c));
+ Node* a = m.LoadFromPointer(&input_a, mFloat64);
+ Node* b = m.LoadFromPointer(&input_b, mFloat64);
+ Node* c = m.LoadFromPointer(&input_c, mFloat64);
+ m.StoreToPointer(&output, mFloat64, m.Float64Add(m.Float64Mul(a, b), c));
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
@@ -2706,11 +2671,10 @@ TEST(RunFloat64MulAndFloat64AddP) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
- Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
- Node* c = m.LoadFromPointer(&input_c, kMachineFloat64);
- m.StoreToPointer(&output, kMachineFloat64,
- m.Float64Add(a, m.Float64Mul(b, c)));
+ Node* a = m.LoadFromPointer(&input_a, mFloat64);
+ Node* b = m.LoadFromPointer(&input_b, mFloat64);
+ Node* c = m.LoadFromPointer(&input_c, mFloat64);
+ m.StoreToPointer(&output, mFloat64, m.Float64Add(a, m.Float64Mul(b, c)));
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
@@ -2736,11 +2700,10 @@ TEST(RunFloat64MulAndFloat64SubP) {
double output = 0.0;
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
- Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
- Node* c = m.LoadFromPointer(&input_c, kMachineFloat64);
- m.StoreToPointer(&output, kMachineFloat64,
- m.Float64Sub(a, m.Float64Mul(b, c)));
+ Node* a = m.LoadFromPointer(&input_a, mFloat64);
+ Node* b = m.LoadFromPointer(&input_b, mFloat64);
+ Node* c = m.LoadFromPointer(&input_c, mFloat64);
+ m.StoreToPointer(&output, mFloat64, m.Float64Sub(a, m.Float64Mul(b, c)));
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
@@ -2766,9 +2729,9 @@ TEST(RunFloat64MulImm) {
{
FOR_FLOAT64_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- Node* t0 = m.LoadFromPointer(&input, kMachineFloat64);
+ Node* t0 = m.LoadFromPointer(&input, mFloat64);
Node* t1 = m.Float64Mul(m.Float64Constant(*i), t0);
- m.StoreToPointer(&output, kMachineFloat64, t1);
+ m.StoreToPointer(&output, mFloat64, t1);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(j) {
input = *j;
@@ -2781,9 +2744,9 @@ TEST(RunFloat64MulImm) {
{
FOR_FLOAT64_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- Node* t0 = m.LoadFromPointer(&input, kMachineFloat64);
+ Node* t0 = m.LoadFromPointer(&input, mFloat64);
Node* t1 = m.Float64Mul(t0, m.Float64Constant(*i));
- m.StoreToPointer(&output, kMachineFloat64, t1);
+ m.StoreToPointer(&output, mFloat64, t1);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(j) {
input = *j;
@@ -2833,8 +2796,7 @@ TEST(RunChangeInt32ToFloat64_A) {
double result = 0;
Node* convert = m.ChangeInt32ToFloat64(m.Int32Constant(magic));
- m.Store(kMachineFloat64, m.PointerConstant(&result), m.Int32Constant(0),
- convert);
+ m.Store(mFloat64, m.PointerConstant(&result), m.Int32Constant(0), convert);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -2843,12 +2805,11 @@ TEST(RunChangeInt32ToFloat64_A) {
TEST(RunChangeInt32ToFloat64_B) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
double output = 0;
Node* convert = m.ChangeInt32ToFloat64(m.Parameter(0));
- m.Store(kMachineFloat64, m.PointerConstant(&output), m.Int32Constant(0),
- convert);
+ m.Store(mFloat64, m.PointerConstant(&output), m.Int32Constant(0), convert);
m.Return(m.Parameter(0));
FOR_INT32_INPUTS(i) {
@@ -2860,12 +2821,11 @@ TEST(RunChangeInt32ToFloat64_B) {
TEST(RunChangeUint32ToFloat64_B) {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
double output = 0;
Node* convert = m.ChangeUint32ToFloat64(m.Parameter(0));
- m.Store(kMachineFloat64, m.PointerConstant(&output), m.Int32Constant(0),
- convert);
+ m.Store(mFloat64, m.PointerConstant(&output), m.Int32Constant(0), convert);
m.Return(m.Parameter(0));
FOR_UINT32_INPUTS(i) {
@@ -2882,7 +2842,7 @@ TEST(RunChangeFloat64ToInt32_A) {
double input = 11.1;
int32_t result = 0;
- m.Store(kMachineWord32, m.PointerConstant(&result), m.Int32Constant(0),
+ m.Store(mInt32, m.PointerConstant(&result), m.Int32Constant(0),
m.ChangeFloat64ToInt32(m.Float64Constant(input)));
m.Return(m.Int32Constant(magic));
@@ -2896,11 +2856,9 @@ TEST(RunChangeFloat64ToInt32_B) {
double input = 0;
int32_t output = 0;
- Node* load =
- m.Load(kMachineFloat64, m.PointerConstant(&input), m.Int32Constant(0));
+ Node* load = m.Load(mFloat64, m.PointerConstant(&input), m.Int32Constant(0));
Node* convert = m.ChangeFloat64ToInt32(load);
- m.Store(kMachineWord32, m.PointerConstant(&output), m.Int32Constant(0),
- convert);
+ m.Store(mInt32, m.PointerConstant(&output), m.Int32Constant(0), convert);
m.Return(convert);
{
@@ -2938,11 +2896,9 @@ TEST(RunChangeFloat64ToUint32_B) {
double input = 0;
int32_t output = 0;
- Node* load =
- m.Load(kMachineFloat64, m.PointerConstant(&input), m.Int32Constant(0));
+ Node* load = m.Load(mFloat64, m.PointerConstant(&input), m.Int32Constant(0));
Node* convert = m.ChangeFloat64ToUint32(load);
- m.Store(kMachineWord32, m.PointerConstant(&output), m.Int32Constant(0),
- convert);
+ m.Store(mInt32, m.PointerConstant(&output), m.Int32Constant(0), convert);
m.Return(convert);
{
@@ -2985,12 +2941,12 @@ TEST(RunChangeFloat64ToInt32_spilled) {
Node* input_node[kNumInputs];
for (int i = 0; i < kNumInputs; i++) {
- input_node[i] = m.Load(kMachineFloat64, m.PointerConstant(&input),
- m.Int32Constant(i * 8));
+ input_node[i] =
+ m.Load(mFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
}
for (int i = 0; i < kNumInputs; i++) {
- m.Store(kMachineWord32, m.PointerConstant(&result), m.Int32Constant(i * 4),
+ m.Store(mInt32, m.PointerConstant(&result), m.Int32Constant(i * 4),
m.ChangeFloat64ToInt32(input_node[i]));
}
@@ -3066,7 +3022,7 @@ TEST(RunDoubleDiamond) {
m.Goto(&end);
m.Bind(&end);
Node* phi = m.Phi(k2, k1);
- m.Store(kMachineFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+ m.Store(mFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -3092,7 +3048,7 @@ TEST(RunRefDiamond) {
m.Goto(&end);
m.Bind(&end);
Node* phi = m.Phi(k2, k1);
- m.Store(kMachineTagged, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+ m.Store(mAnyTagged, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -3123,10 +3079,8 @@ TEST(RunDoubleRefDiamond) {
m.Bind(&end);
Node* dphi = m.Phi(d2, d1);
Node* rphi = m.Phi(r2, r1);
- m.Store(kMachineFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0),
- dphi);
- m.Store(kMachineTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
- rphi);
+ m.Store(mFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi);
+ m.Store(mAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0), rphi);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -3168,10 +3122,8 @@ TEST(RunDoubleRefDoubleDiamond) {
Node* dphi2 = m.Phi(d1, dphi1);
Node* rphi2 = m.Phi(r1, rphi1);
- m.Store(kMachineFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0),
- dphi2);
- m.Store(kMachineTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0),
- rphi2);
+ m.Store(mFloat64, m.PointerConstant(&dbuffer), m.Int32Constant(0), dphi2);
+ m.Store(mAnyTagged, m.PointerConstant(&rbuffer), m.Int32Constant(0), rphi2);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -3199,7 +3151,7 @@ TEST(RunDoubleLoopPhi) {
m.Bind(&body);
m.Goto(&header);
m.Bind(&end);
- m.Store(kMachineFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
+ m.Store(mFloat64, m.PointerConstant(&buffer), m.Int32Constant(0), phi);
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -3280,14 +3232,14 @@ TEST(RunAddTree) {
int32_t inputs[] = {11, 12, 13, 14, 15, 16, 17, 18};
Node* base = m.PointerConstant(inputs);
- Node* n0 = m.Load(kMachineWord32, base, m.Int32Constant(0 * sizeof(int32_t)));
- Node* n1 = m.Load(kMachineWord32, base, m.Int32Constant(1 * sizeof(int32_t)));
- Node* n2 = m.Load(kMachineWord32, base, m.Int32Constant(2 * sizeof(int32_t)));
- Node* n3 = m.Load(kMachineWord32, base, m.Int32Constant(3 * sizeof(int32_t)));
- Node* n4 = m.Load(kMachineWord32, base, m.Int32Constant(4 * sizeof(int32_t)));
- Node* n5 = m.Load(kMachineWord32, base, m.Int32Constant(5 * sizeof(int32_t)));
- Node* n6 = m.Load(kMachineWord32, base, m.Int32Constant(6 * sizeof(int32_t)));
- Node* n7 = m.Load(kMachineWord32, base, m.Int32Constant(7 * sizeof(int32_t)));
+ Node* n0 = m.Load(mInt32, base, m.Int32Constant(0 * sizeof(int32_t)));
+ Node* n1 = m.Load(mInt32, base, m.Int32Constant(1 * sizeof(int32_t)));
+ Node* n2 = m.Load(mInt32, base, m.Int32Constant(2 * sizeof(int32_t)));
+ Node* n3 = m.Load(mInt32, base, m.Int32Constant(3 * sizeof(int32_t)));
+ Node* n4 = m.Load(mInt32, base, m.Int32Constant(4 * sizeof(int32_t)));
+ Node* n5 = m.Load(mInt32, base, m.Int32Constant(5 * sizeof(int32_t)));
+ Node* n6 = m.Load(mInt32, base, m.Int32Constant(6 * sizeof(int32_t)));
+ Node* n7 = m.Load(mInt32, base, m.Int32Constant(7 * sizeof(int32_t)));
Node* i1 = m.Int32Add(n0, n1);
Node* i2 = m.Int32Add(n2, n3);
@@ -3325,7 +3277,7 @@ TEST(RunCallSeven) {
call_direct ? m.PointerConstant(function_address)
: m.LoadFromPointer(&function_address,
MachineOperatorBuilder::pointer_rep());
- m.Return(m.CallC(function, kMachineWord32, arg_types, args, 0));
+ m.Return(m.CallC(function, mInt32, arg_types, args, 0));
CHECK_EQ(7, m.Call());
}
@@ -3338,14 +3290,14 @@ TEST(RunCallUnaryMinus) {
void* function_address =
reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&UnaryMinus));
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
Node* args[] = {m.Parameter(0)};
- MachineType arg_types[] = {kMachineWord32};
+ MachineType arg_types[] = {mInt32};
Node* function =
call_direct ? m.PointerConstant(function_address)
: m.LoadFromPointer(&function_address,
MachineOperatorBuilder::pointer_rep());
- m.Return(m.CallC(function, kMachineWord32, arg_types, args, 1));
+ m.Return(m.CallC(function, mInt32, arg_types, args, 1));
FOR_INT32_INPUTS(i) {
int a = *i;
@@ -3361,14 +3313,14 @@ TEST(RunCallAPlusTwoB) {
void* function_address =
reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&APlusTwoB));
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32);
Node* args[] = {m.Parameter(0), m.Parameter(1)};
- MachineType arg_types[] = {kMachineWord32, kMachineWord32};
+ MachineType arg_types[] = {mInt32, mInt32};
Node* function =
call_direct ? m.PointerConstant(function_address)
: m.LoadFromPointer(&function_address,
MachineOperatorBuilder::pointer_rep());
- m.Return(m.CallC(function, kMachineWord32, arg_types, args, 2));
+ m.Return(m.CallC(function, mInt32, arg_types, args, 2));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
@@ -3398,9 +3350,9 @@ static int Float64CompareHelper(RawMachineAssemblerTester<int32_t>* m,
CHECK(x < y);
bool load_a = node_type / 2 == 1;
bool load_b = node_type % 2 == 1;
- Node* a = load_a ? m->Load(kMachineFloat64, m->PointerConstant(&buffer[0]))
+ Node* a = load_a ? m->Load(mFloat64, m->PointerConstant(&buffer[0]))
: m->Float64Constant(x);
- Node* b = load_b ? m->Load(kMachineFloat64, m->PointerConstant(&buffer[1]))
+ Node* b = load_b ? m->Load(mFloat64, m->PointerConstant(&buffer[1]))
: m->Float64Constant(y);
Node* cmp = NULL;
bool expected = false;
@@ -3528,8 +3480,8 @@ TEST(RunFloat64Equal) {
double input_b = 0.0;
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
- Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
+ Node* a = m.LoadFromPointer(&input_a, mFloat64);
+ Node* b = m.LoadFromPointer(&input_b, mFloat64);
m.Return(m.Float64Equal(a, b));
CompareWrapper cmp(IrOpcode::kFloat64Equal);
@@ -3549,8 +3501,8 @@ TEST(RunFloat64LessThan) {
double input_b = 0.0;
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
- Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
+ Node* a = m.LoadFromPointer(&input_a, mFloat64);
+ Node* b = m.LoadFromPointer(&input_b, mFloat64);
m.Return(m.Float64LessThan(a, b));
CompareWrapper cmp(IrOpcode::kFloat64LessThan);
@@ -3599,8 +3551,8 @@ static void LoadStoreTruncation() {
TEST(RunLoadStoreTruncation) {
- LoadStoreTruncation<int8_t, kMachineWord8>();
- LoadStoreTruncation<int16_t, kMachineWord16>();
+ LoadStoreTruncation<int8_t, mInt8>();
+ LoadStoreTruncation<int16_t, mInt16>();
}
@@ -3676,7 +3628,7 @@ TEST(RunTestIntPtrArithmetic) {
Node* output = m.PointerConstant(&outputs[kInputSize - 1]);
Node* elem_size = m.ConvertInt32ToIntPtr(m.Int32Constant(sizeof(inputs[0])));
for (int i = 0; i < kInputSize; i++) {
- m.Store(kMachineWord32, output, m.Load(kMachineWord32, input));
+ m.Store(mInt32, output, m.Load(mInt32, input));
input = m.IntPtrAdd(input, elem_size);
output = m.IntPtrSub(output, elem_size);
}
@@ -3717,7 +3669,7 @@ TEST(RunTestInt32RotateRightP) {
TEST(RunTestInt32RotateRightImm) {
FOR_INPUTS(uint32_t, ror, i) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
Node* value = m.Parameter(0);
m.Return(m.Word32Or(m.Word32Shr(value, m.Int32Constant(*i)),
m.Word32Shl(value, m.Int32Constant(32 - *i))));
@@ -3725,7 +3677,7 @@ TEST(RunTestInt32RotateRightImm) {
std::bind2nd(std::ptr_fun(&rotr32), *i));
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mUint32);
Node* value = m.Parameter(0);
m.Return(m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - *i)),
m.Word32Shr(value, m.Int32Constant(*i))));
@@ -3748,7 +3700,7 @@ TEST(RunSpillLotsOfThings) {
accs[i] = acc;
}
for (int i = 0; i < kInputSize; i++) {
- m.StoreToPointer(&outputs[i], kMachineWord32, accs[i]);
+ m.StoreToPointer(&outputs[i], mInt32, accs[i]);
}
m.Return(one);
m.Call();
@@ -3761,7 +3713,7 @@ TEST(RunSpillLotsOfThings) {
TEST(RunSpillConstantsAndParameters) {
static const int kInputSize = 1000;
static const int32_t kBase = 987;
- RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32, mInt32);
int32_t outputs[kInputSize];
Node* csts[kInputSize];
Node* accs[kInputSize];
@@ -3774,7 +3726,7 @@ TEST(RunSpillConstantsAndParameters) {
accs[i] = acc;
}
for (int i = 0; i < kInputSize; i++) {
- m.StoreToPointer(&outputs[i], kMachineWord32, accs[i]);
+ m.StoreToPointer(&outputs[i], mInt32, accs[i]);
}
m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1))));
FOR_INT32_INPUTS(i) {
@@ -3795,7 +3747,7 @@ TEST(RunSpillConstantsAndParameters) {
TEST(RunNewSpaceConstantsInPhi) {
- RawMachineAssemblerTester<Object*> m(kMachineWord32);
+ RawMachineAssemblerTester<Object*> m(mInt32);
Isolate* isolate = CcTest::i_isolate();
Handle<HeapNumber> true_val = isolate->factory()->NewHeapNumber(11.2);
@@ -3837,10 +3789,10 @@ TEST(RunSpillLotsOfThingsWithCall) {
void* func = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&Seven));
Node** args = NULL;
MachineType* arg_types = NULL;
- m.CallC(m.PointerConstant(func), kMachineWord32, arg_types, args, 0);
+ m.CallC(m.PointerConstant(func), mInt32, arg_types, args, 0);
}
for (int i = 0; i < kInputSize; i++) {
- m.StoreToPointer(&outputs[i], kMachineWord32, accs[i]);
+ m.StoreToPointer(&outputs[i], mInt32, accs[i]);
}
m.Return(one);
m.Call();
@@ -3875,7 +3827,7 @@ TEST(RunInt32AddWithOverflowP) {
Node* add = m.Int32AddWithOverflow(bt.param0, bt.param1);
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
bt.AddReturn(ovf);
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
@@ -3892,11 +3844,11 @@ TEST(RunInt32AddWithOverflowImm) {
int32_t actual_val = -1, expected_val = 0;
FOR_INT32_INPUTS(i) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
Node* add = m.Int32AddWithOverflow(m.Int32Constant(*i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
int expected_ovf = sadd_overflow(*i, *j, &expected_val);
@@ -3905,11 +3857,11 @@ TEST(RunInt32AddWithOverflowImm) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(*i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
int expected_ovf = sadd_overflow(*i, *j, &expected_val);
@@ -3923,7 +3875,7 @@ TEST(RunInt32AddWithOverflowImm) {
m.Int32AddWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
int expected_ovf = sadd_overflow(*i, *j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
@@ -3946,8 +3898,8 @@ TEST(RunInt32AddWithOverflowInBranchP) {
m.Bind(&blockb);
Node* val = m.Projection(0, add);
bt.AddReturn(val);
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
int32_t expected;
if (sadd_overflow(*i, *j, &expected)) expected = constant;
CHECK_EQ(expected, bt.call(*i, *j));
@@ -3963,7 +3915,7 @@ TEST(RunInt32SubWithOverflowP) {
Node* add = m.Int32SubWithOverflow(bt.param0, bt.param1);
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
bt.AddReturn(ovf);
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
@@ -3980,11 +3932,11 @@ TEST(RunInt32SubWithOverflowImm) {
int32_t actual_val = -1, expected_val = 0;
FOR_INT32_INPUTS(i) {
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
Node* add = m.Int32SubWithOverflow(m.Int32Constant(*i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
int expected_ovf = ssub_overflow(*i, *j, &expected_val);
@@ -3993,11 +3945,11 @@ TEST(RunInt32SubWithOverflowImm) {
}
}
{
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ RawMachineAssemblerTester<int32_t> m(mInt32);
Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(*i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
int expected_ovf = ssub_overflow(*j, *i, &expected_val);
@@ -4011,7 +3963,7 @@ TEST(RunInt32SubWithOverflowImm) {
m.Int32SubWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
- m.StoreToPointer(&actual_val, kMachineWord32, val);
+ m.StoreToPointer(&actual_val, mInt32, val);
m.Return(ovf);
int expected_ovf = ssub_overflow(*i, *j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
@@ -4034,8 +3986,8 @@ TEST(RunInt32SubWithOverflowInBranchP) {
m.Bind(&blockb);
Node* val = m.Projection(0, sub);
bt.AddReturn(val);
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
int32_t expected;
if (ssub_overflow(*i, *j, &expected)) expected = constant;
CHECK_EQ(expected, bt.call(*i, *j));

Powered by Google App Engine