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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 assm.GetCode(&desc); | 583 assm.GetCode(&desc); |
584 Handle<Code> code = isolate->factory()->NewCode( | 584 Handle<Code> code = isolate->factory()->NewCode( |
585 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 585 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
586 F3 f = FUNCTION_CAST<F3>(code->entry()); | 586 F3 f = FUNCTION_CAST<F3>(code->entry()); |
587 t.ui = 0x11223344; | 587 t.ui = 0x11223344; |
588 t.si = 0x99aabbcc; | 588 t.si = 0x99aabbcc; |
589 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 589 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
590 USE(dummy); | 590 USE(dummy); |
591 | 591 |
592 CHECK_EQ(static_cast<int32_t>(0x11223344), t.r1); | 592 CHECK_EQ(static_cast<int32_t>(0x11223344), t.r1); |
593 CHECK_EQ(static_cast<int32_t>(0x3344), t.r2); | 593 if (kArchEndian == kLittle) { |
594 CHECK_EQ(static_cast<int32_t>(0xffffbbcc), t.r3); | 594 CHECK_EQ(static_cast<int32_t>(0x3344), t.r2); |
595 CHECK_EQ(static_cast<int32_t>(0x0000bbcc), t.r4); | 595 CHECK_EQ(static_cast<int32_t>(0xffffbbcc), t.r3); |
596 CHECK_EQ(static_cast<int32_t>(0xffffffcc), t.r5); | 596 CHECK_EQ(static_cast<int32_t>(0x0000bbcc), t.r4); |
597 CHECK_EQ(static_cast<int32_t>(0x3333bbcc), t.r6); | 597 CHECK_EQ(static_cast<int32_t>(0xffffffcc), t.r5); |
| 598 CHECK_EQ(static_cast<int32_t>(0x3333bbcc), t.r6); |
| 599 } else { |
| 600 CHECK_EQ(static_cast<int32_t>(0x1122), t.r2); |
| 601 CHECK_EQ(static_cast<int32_t>(0xffff99aa), t.r3); |
| 602 CHECK_EQ(static_cast<int32_t>(0x000099aa), t.r4); |
| 603 CHECK_EQ(static_cast<int32_t>(0xffffff99), t.r5); |
| 604 CHECK_EQ(static_cast<int32_t>(0x99aa3333), t.r6); |
| 605 } |
598 } | 606 } |
599 | 607 |
600 | 608 |
601 TEST(MIPS7) { | 609 TEST(MIPS7) { |
602 // Test floating point compare and branch instructions. | 610 // Test floating point compare and branch instructions. |
603 CcTest::InitializeVM(); | 611 CcTest::InitializeVM(); |
604 Isolate* isolate = CcTest::i_isolate(); | 612 Isolate* isolate = CcTest::i_isolate(); |
605 HandleScope scope(isolate); | 613 HandleScope scope(isolate); |
606 | 614 |
607 typedef struct { | 615 typedef struct { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 assm.GetCode(&desc); | 1027 assm.GetCode(&desc); |
1020 Handle<Code> code = isolate->factory()->NewCode( | 1028 Handle<Code> code = isolate->factory()->NewCode( |
1021 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1029 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1022 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1030 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1023 t.reg_init = 0xaabbccdd; | 1031 t.reg_init = 0xaabbccdd; |
1024 t.mem_init = 0x11223344; | 1032 t.mem_init = 0x11223344; |
1025 | 1033 |
1026 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 1034 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
1027 USE(dummy); | 1035 USE(dummy); |
1028 | 1036 |
1029 CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_0); | 1037 if (kArchEndian == kLittle) { |
1030 CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_1); | 1038 CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_0); |
1031 CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_2); | 1039 CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_1); |
1032 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_3); | 1040 CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_2); |
| 1041 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_3); |
1033 | 1042 |
1034 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_0); | 1043 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_0); |
1035 CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_1); | 1044 CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_1); |
1036 CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_2); | 1045 CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_2); |
1037 CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_3); | 1046 CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_3); |
1038 | 1047 |
1039 CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_0); | 1048 CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_0); |
1040 CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_1); | 1049 CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_1); |
1041 CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_2); | 1050 CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_2); |
1042 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_3); | 1051 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_3); |
1043 | 1052 |
1044 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_0); | 1053 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_0); |
1045 CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_1); | 1054 CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_1); |
1046 CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_2); | 1055 CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_2); |
1047 CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_3); | 1056 CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_3); |
| 1057 } else { |
| 1058 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_0); |
| 1059 CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_1); |
| 1060 CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_2); |
| 1061 CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_3); |
| 1062 |
| 1063 CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_0); |
| 1064 CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_1); |
| 1065 CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_2); |
| 1066 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_3); |
| 1067 |
| 1068 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_0); |
| 1069 CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_1); |
| 1070 CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_2); |
| 1071 CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_3); |
| 1072 |
| 1073 CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_0); |
| 1074 CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_1); |
| 1075 CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_2); |
| 1076 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_3); |
| 1077 } |
1048 } | 1078 } |
1049 } | 1079 } |
1050 | 1080 |
1051 | 1081 |
1052 TEST(MIPS12) { | 1082 TEST(MIPS12) { |
1053 CcTest::InitializeVM(); | 1083 CcTest::InitializeVM(); |
1054 Isolate* isolate = CcTest::i_isolate(); | 1084 Isolate* isolate = CcTest::i_isolate(); |
1055 HandleScope scope(isolate); | 1085 HandleScope scope(isolate); |
1056 | 1086 |
1057 typedef struct { | 1087 typedef struct { |
(...skipping 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5457 }; | 5487 }; |
5458 | 5488 |
5459 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); | 5489 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); |
5460 for (size_t i = 0; i < nr_test_cases; ++i) { | 5490 for (size_t i = 0; i < nr_test_cases; ++i) { |
5461 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); | 5491 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); |
5462 } | 5492 } |
5463 } | 5493 } |
5464 | 5494 |
5465 | 5495 |
5466 #undef __ | 5496 #undef __ |
OLD | NEW |