OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1517 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1518 for (size_t i = 0; i < 128; ++i) { | 1518 for (size_t i = 0; i < 128; ++i) { |
1519 int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt(); | 1519 int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt(); |
1520 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, z, 0); | 1520 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, z, 0); |
1521 CHECK_EQ(bits::SignedMulHighAndAdd32(x, y, z), r); | 1521 CHECK_EQ(bits::SignedMulHighAndAdd32(x, y, z), r); |
1522 USE(dummy); | 1522 USE(dummy); |
1523 } | 1523 } |
1524 } | 1524 } |
1525 | 1525 |
1526 | 1526 |
1527 TEST(smmls) { | |
1528 CcTest::InitializeVM(); | |
1529 Isolate* const isolate = CcTest::i_isolate(); | |
1530 HandleScope scope(isolate); | |
1531 RandomNumberGenerator* const rng = isolate->random_number_generator(); | |
1532 Assembler assm(isolate, nullptr, 0); | |
1533 __ smmls(r1, r1, r2, r3); | |
1534 __ str(r1, MemOperand(r0)); | |
1535 __ bx(lr); | |
1536 CodeDesc desc; | |
1537 assm.GetCode(&desc); | |
1538 Handle<Code> code = isolate->factory()->NewCode( | |
1539 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | |
1540 #ifdef OBJECT_PRINT | |
1541 code->Print(std::cout); | |
1542 #endif | |
1543 F3 f = FUNCTION_CAST<F3>(code->entry()); | |
1544 for (size_t i = 0; i < 128; ++i) { | |
1545 int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt(); | |
1546 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, z, 0); | |
1547 CHECK_EQ(bits::SignedMulHighAndSub32(x, y, z), r); | |
1548 USE(dummy); | |
1549 } | |
1550 } | |
1551 | |
1552 | |
1553 TEST(smmul) { | 1527 TEST(smmul) { |
1554 CcTest::InitializeVM(); | 1528 CcTest::InitializeVM(); |
1555 Isolate* const isolate = CcTest::i_isolate(); | 1529 Isolate* const isolate = CcTest::i_isolate(); |
1556 HandleScope scope(isolate); | 1530 HandleScope scope(isolate); |
1557 RandomNumberGenerator* const rng = isolate->random_number_generator(); | 1531 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
1558 Assembler assm(isolate, nullptr, 0); | 1532 Assembler assm(isolate, nullptr, 0); |
1559 __ smmul(r1, r1, r2); | 1533 __ smmul(r1, r1, r2); |
1560 __ str(r1, MemOperand(r0)); | 1534 __ str(r1, MemOperand(r0)); |
1561 __ bx(lr); | 1535 __ bx(lr); |
1562 CodeDesc desc; | 1536 CodeDesc desc; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 assm.GetCode(&desc); | 1614 assm.GetCode(&desc); |
1641 Handle<Code> code = isolate->factory()->NewCode( | 1615 Handle<Code> code = isolate->factory()->NewCode( |
1642 desc, Code::ComputeFlags(Code::STUB), code_object); | 1616 desc, Code::ComputeFlags(Code::STUB), code_object); |
1643 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1617 F1 f = FUNCTION_CAST<F1>(code->entry()); |
1644 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); | 1618 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); |
1645 ::printf("f() = %d\n", res); | 1619 ::printf("f() = %d\n", res); |
1646 CHECK_EQ(42, res); | 1620 CHECK_EQ(42, res); |
1647 } | 1621 } |
1648 | 1622 |
1649 #undef __ | 1623 #undef __ |
OLD | NEW |