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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 Code::ComputeFlags(Code::STUB), | 526 Code::ComputeFlags(Code::STUB), |
527 Handle<Code>())->ToObjectChecked(); | 527 Handle<Code>())->ToObjectChecked(); |
528 CHECK(code->IsCode()); | 528 CHECK(code->IsCode()); |
529 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 529 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
530 t.ui = 0x11223344; | 530 t.ui = 0x11223344; |
531 t.si = 0x99aabbcc; | 531 t.si = 0x99aabbcc; |
532 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 532 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
533 USE(dummy); | 533 USE(dummy); |
534 | 534 |
535 CHECK_EQ(0x11223344, t.r1); | 535 CHECK_EQ(0x11223344, t.r1); |
| 536 #if __BYTE_ORDER == __LITTLE_ENDIAN |
536 CHECK_EQ(0x3344, t.r2); | 537 CHECK_EQ(0x3344, t.r2); |
537 CHECK_EQ(0xffffbbcc, t.r3); | 538 CHECK_EQ(0xffffbbcc, t.r3); |
538 CHECK_EQ(0x0000bbcc, t.r4); | 539 CHECK_EQ(0x0000bbcc, t.r4); |
539 CHECK_EQ(0xffffffcc, t.r5); | 540 CHECK_EQ(0xffffffcc, t.r5); |
540 CHECK_EQ(0x3333bbcc, t.r6); | 541 CHECK_EQ(0x3333bbcc, t.r6); |
| 542 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 543 CHECK_EQ(0x1122, t.r2); |
| 544 CHECK_EQ(0xffff99aa, t.r3); |
| 545 CHECK_EQ(0x000099aa, t.r4); |
| 546 CHECK_EQ(0xffffff99, t.r5); |
| 547 CHECK_EQ(0x99aa3333, t.r6); |
| 548 #else |
| 549 #error Unknown endianness |
| 550 #endif |
541 } | 551 } |
542 | 552 |
543 | 553 |
544 TEST(MIPS7) { | 554 TEST(MIPS7) { |
545 // Test floating point compare and branch instructions. | 555 // Test floating point compare and branch instructions. |
546 CcTest::InitializeVM(); | 556 CcTest::InitializeVM(); |
547 Isolate* isolate = CcTest::i_isolate(); | 557 Isolate* isolate = CcTest::i_isolate(); |
548 HandleScope scope(isolate); | 558 HandleScope scope(isolate); |
549 | 559 |
550 typedef struct { | 560 typedef struct { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 Code::ComputeFlags(Code::STUB), | 945 Code::ComputeFlags(Code::STUB), |
936 Handle<Code>())->ToObjectChecked(); | 946 Handle<Code>())->ToObjectChecked(); |
937 CHECK(code->IsCode()); | 947 CHECK(code->IsCode()); |
938 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 948 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
939 t.reg_init = 0xaabbccdd; | 949 t.reg_init = 0xaabbccdd; |
940 t.mem_init = 0x11223344; | 950 t.mem_init = 0x11223344; |
941 | 951 |
942 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 952 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
943 USE(dummy); | 953 USE(dummy); |
944 | 954 |
| 955 #if __BYTE_ORDER == __LITTLE_ENDIAN |
945 CHECK_EQ(0x44bbccdd, t.lwl_0); | 956 CHECK_EQ(0x44bbccdd, t.lwl_0); |
946 CHECK_EQ(0x3344ccdd, t.lwl_1); | 957 CHECK_EQ(0x3344ccdd, t.lwl_1); |
947 CHECK_EQ(0x223344dd, t.lwl_2); | 958 CHECK_EQ(0x223344dd, t.lwl_2); |
948 CHECK_EQ(0x11223344, t.lwl_3); | 959 CHECK_EQ(0x11223344, t.lwl_3); |
949 | 960 |
950 CHECK_EQ(0x11223344, t.lwr_0); | 961 CHECK_EQ(0x11223344, t.lwr_0); |
951 CHECK_EQ(0xaa112233, t.lwr_1); | 962 CHECK_EQ(0xaa112233, t.lwr_1); |
952 CHECK_EQ(0xaabb1122, t.lwr_2); | 963 CHECK_EQ(0xaabb1122, t.lwr_2); |
953 CHECK_EQ(0xaabbcc11, t.lwr_3); | 964 CHECK_EQ(0xaabbcc11, t.lwr_3); |
954 | 965 |
955 CHECK_EQ(0x112233aa, t.swl_0); | 966 CHECK_EQ(0x112233aa, t.swl_0); |
956 CHECK_EQ(0x1122aabb, t.swl_1); | 967 CHECK_EQ(0x1122aabb, t.swl_1); |
957 CHECK_EQ(0x11aabbcc, t.swl_2); | 968 CHECK_EQ(0x11aabbcc, t.swl_2); |
958 CHECK_EQ(0xaabbccdd, t.swl_3); | 969 CHECK_EQ(0xaabbccdd, t.swl_3); |
959 | 970 |
960 CHECK_EQ(0xaabbccdd, t.swr_0); | 971 CHECK_EQ(0xaabbccdd, t.swr_0); |
961 CHECK_EQ(0xbbccdd44, t.swr_1); | 972 CHECK_EQ(0xbbccdd44, t.swr_1); |
962 CHECK_EQ(0xccdd3344, t.swr_2); | 973 CHECK_EQ(0xccdd3344, t.swr_2); |
963 CHECK_EQ(0xdd223344, t.swr_3); | 974 CHECK_EQ(0xdd223344, t.swr_3); |
| 975 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 976 CHECK_EQ(0x11223344, t.lwl_0); |
| 977 CHECK_EQ(0x223344dd, t.lwl_1); |
| 978 CHECK_EQ(0x3344ccdd, t.lwl_2); |
| 979 CHECK_EQ(0x44bbccdd, t.lwl_3); |
| 980 |
| 981 CHECK_EQ(0xaabbcc11, t.lwr_0); |
| 982 CHECK_EQ(0xaabb1122, t.lwr_1); |
| 983 CHECK_EQ(0xaa112233, t.lwr_2); |
| 984 CHECK_EQ(0x11223344, t.lwr_3); |
| 985 |
| 986 CHECK_EQ(0xaabbccdd, t.swl_0); |
| 987 CHECK_EQ(0x11aabbcc, t.swl_1); |
| 988 CHECK_EQ(0x1122aabb, t.swl_2); |
| 989 CHECK_EQ(0x112233aa, t.swl_3); |
| 990 |
| 991 CHECK_EQ(0xdd223344, t.swr_0); |
| 992 CHECK_EQ(0xccdd3344, t.swr_1); |
| 993 CHECK_EQ(0xbbccdd44, t.swr_2); |
| 994 CHECK_EQ(0xaabbccdd, t.swr_3); |
| 995 #else |
| 996 #error Unknown endianness |
| 997 #endif |
964 } | 998 } |
965 | 999 |
966 | 1000 |
967 TEST(MIPS12) { | 1001 TEST(MIPS12) { |
968 CcTest::InitializeVM(); | 1002 CcTest::InitializeVM(); |
969 Isolate* isolate = CcTest::i_isolate(); | 1003 Isolate* isolate = CcTest::i_isolate(); |
970 HandleScope scope(isolate); | 1004 HandleScope scope(isolate); |
971 | 1005 |
972 typedef struct { | 1006 typedef struct { |
973 int32_t x; | 1007 int32_t x; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 Label target; | 1291 Label target; |
1258 __ beq(v0, v1, &target); | 1292 __ beq(v0, v1, &target); |
1259 __ nop(); | 1293 __ nop(); |
1260 __ bne(v0, v1, &target); | 1294 __ bne(v0, v1, &target); |
1261 __ nop(); | 1295 __ nop(); |
1262 __ bind(&target); | 1296 __ bind(&target); |
1263 __ nop(); | 1297 __ nop(); |
1264 } | 1298 } |
1265 | 1299 |
1266 #undef __ | 1300 #undef __ |
OLD | NEW |