| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 t.a = 1.5e22; | 400 t.a = 1.5e22; |
| 401 t.b = 2.75e11; | 401 t.b = 2.75e11; |
| 402 t.c = 17.17; | 402 t.c = 17.17; |
| 403 t.d = -2.75e11; | 403 t.d = -2.75e11; |
| 404 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 404 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 405 USE(dummy); | 405 USE(dummy); |
| 406 | 406 |
| 407 CHECK_EQ(2.75e11, t.a); | 407 CHECK_EQ(2.75e11, t.a); |
| 408 CHECK_EQ(2.75e11, t.b); | 408 CHECK_EQ(2.75e11, t.b); |
| 409 CHECK_EQ(1.5e22, t.c); | 409 CHECK_EQ(1.5e22, t.c); |
| 410 CHECK_EQ(0xffffffffc25001d1L, t.high); | 410 CHECK_EQ(static_cast<int64_t>(0xffffffffc25001d1L), t.high); |
| 411 CHECK_EQ(0xffffffffbf800000L, t.low); | 411 CHECK_EQ(static_cast<int64_t>(0xffffffffbf800000L), t.low); |
| 412 } | 412 } |
| 413 | 413 |
| 414 | 414 |
| 415 TEST(MIPS5) { | 415 TEST(MIPS5) { |
| 416 // Test conversions between doubles and integers. | 416 // Test conversions between doubles and integers. |
| 417 CcTest::InitializeVM(); | 417 CcTest::InitializeVM(); |
| 418 Isolate* isolate = CcTest::i_isolate(); | 418 Isolate* isolate = CcTest::i_isolate(); |
| 419 HandleScope scope(isolate); | 419 HandleScope scope(isolate); |
| 420 | 420 |
| 421 typedef struct { | 421 typedef struct { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 CodeDesc desc; | 531 CodeDesc desc; |
| 532 assm.GetCode(&desc); | 532 assm.GetCode(&desc); |
| 533 Handle<Code> code = isolate->factory()->NewCode( | 533 Handle<Code> code = isolate->factory()->NewCode( |
| 534 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 534 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 535 F3 f = FUNCTION_CAST<F3>(code->entry()); | 535 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 536 t.ui = 0x11223344; | 536 t.ui = 0x11223344; |
| 537 t.si = 0x99aabbcc; | 537 t.si = 0x99aabbcc; |
| 538 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 538 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 539 USE(dummy); | 539 USE(dummy); |
| 540 | 540 |
| 541 CHECK_EQ(0x11223344, t.r1); | 541 CHECK_EQ(static_cast<int32_t>(0x11223344), t.r1); |
| 542 CHECK_EQ(0x3344, t.r2); | 542 CHECK_EQ(static_cast<int32_t>(0x3344), t.r2); |
| 543 CHECK_EQ(0xffffbbcc, t.r3); | 543 CHECK_EQ(static_cast<int32_t>(0xffffbbcc), t.r3); |
| 544 CHECK_EQ(0x0000bbcc, t.r4); | 544 CHECK_EQ(static_cast<int32_t>(0x0000bbcc), t.r4); |
| 545 CHECK_EQ(0xffffffcc, t.r5); | 545 CHECK_EQ(static_cast<int32_t>(0xffffffcc), t.r5); |
| 546 CHECK_EQ(0x3333bbcc, t.r6); | 546 CHECK_EQ(static_cast<int32_t>(0x3333bbcc), t.r6); |
| 547 } | 547 } |
| 548 | 548 |
| 549 | 549 |
| 550 TEST(MIPS7) { | 550 TEST(MIPS7) { |
| 551 // Test floating point compare and branch instructions. | 551 // Test floating point compare and branch instructions. |
| 552 CcTest::InitializeVM(); | 552 CcTest::InitializeVM(); |
| 553 Isolate* isolate = CcTest::i_isolate(); | 553 Isolate* isolate = CcTest::i_isolate(); |
| 554 HandleScope scope(isolate); | 554 HandleScope scope(isolate); |
| 555 | 555 |
| 556 typedef struct { | 556 typedef struct { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 __ nop(); | 705 __ nop(); |
| 706 | 706 |
| 707 CodeDesc desc; | 707 CodeDesc desc; |
| 708 assm.GetCode(&desc); | 708 assm.GetCode(&desc); |
| 709 Handle<Code> code = isolate->factory()->NewCode( | 709 Handle<Code> code = isolate->factory()->NewCode( |
| 710 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 710 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 711 F3 f = FUNCTION_CAST<F3>(code->entry()); | 711 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 712 t.input = 0x12345678; | 712 t.input = 0x12345678; |
| 713 Object* dummy = CALL_GENERATED_CODE(f, &t, 0x0, 0, 0, 0); | 713 Object* dummy = CALL_GENERATED_CODE(f, &t, 0x0, 0, 0, 0); |
| 714 USE(dummy); | 714 USE(dummy); |
| 715 CHECK_EQ(0x81234567, t.result_rotr_4); | 715 CHECK_EQ(static_cast<int32_t>(0x81234567), t.result_rotr_4); |
| 716 CHECK_EQ(0x78123456, t.result_rotr_8); | 716 CHECK_EQ(static_cast<int32_t>(0x78123456), t.result_rotr_8); |
| 717 CHECK_EQ(0x67812345, t.result_rotr_12); | 717 CHECK_EQ(static_cast<int32_t>(0x67812345), t.result_rotr_12); |
| 718 CHECK_EQ(0x56781234, t.result_rotr_16); | 718 CHECK_EQ(static_cast<int32_t>(0x56781234), t.result_rotr_16); |
| 719 CHECK_EQ(0x45678123, t.result_rotr_20); | 719 CHECK_EQ(static_cast<int32_t>(0x45678123), t.result_rotr_20); |
| 720 CHECK_EQ(0x34567812, t.result_rotr_24); | 720 CHECK_EQ(static_cast<int32_t>(0x34567812), t.result_rotr_24); |
| 721 CHECK_EQ(0x23456781, t.result_rotr_28); | 721 CHECK_EQ(static_cast<int32_t>(0x23456781), t.result_rotr_28); |
| 722 | 722 |
| 723 CHECK_EQ(0x81234567, t.result_rotrv_4); | 723 CHECK_EQ(static_cast<int32_t>(0x81234567), t.result_rotrv_4); |
| 724 CHECK_EQ(0x78123456, t.result_rotrv_8); | 724 CHECK_EQ(static_cast<int32_t>(0x78123456), t.result_rotrv_8); |
| 725 CHECK_EQ(0x67812345, t.result_rotrv_12); | 725 CHECK_EQ(static_cast<int32_t>(0x67812345), t.result_rotrv_12); |
| 726 CHECK_EQ(0x56781234, t.result_rotrv_16); | 726 CHECK_EQ(static_cast<int32_t>(0x56781234), t.result_rotrv_16); |
| 727 CHECK_EQ(0x45678123, t.result_rotrv_20); | 727 CHECK_EQ(static_cast<int32_t>(0x45678123), t.result_rotrv_20); |
| 728 CHECK_EQ(0x34567812, t.result_rotrv_24); | 728 CHECK_EQ(static_cast<int32_t>(0x34567812), t.result_rotrv_24); |
| 729 CHECK_EQ(0x23456781, t.result_rotrv_28); | 729 CHECK_EQ(static_cast<int32_t>(0x23456781), t.result_rotrv_28); |
| 730 } | 730 } |
| 731 | 731 |
| 732 | 732 |
| 733 TEST(MIPS9) { | 733 TEST(MIPS9) { |
| 734 // Test BRANCH improvements. | 734 // Test BRANCH improvements. |
| 735 CcTest::InitializeVM(); | 735 CcTest::InitializeVM(); |
| 736 Isolate* isolate = CcTest::i_isolate(); | 736 Isolate* isolate = CcTest::i_isolate(); |
| 737 HandleScope scope(isolate); | 737 HandleScope scope(isolate); |
| 738 | 738 |
| 739 MacroAssembler assm(isolate, NULL, 0); | 739 MacroAssembler assm(isolate, NULL, 0); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 assm.GetCode(&desc); | 831 assm.GetCode(&desc); |
| 832 Handle<Code> code = isolate->factory()->NewCode( | 832 Handle<Code> code = isolate->factory()->NewCode( |
| 833 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 833 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 834 F3 f = FUNCTION_CAST<F3>(code->entry()); | 834 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 835 t.a = 2.147483647e9; // 0x7fffffff -> 0x41DFFFFFFFC00000 as double. | 835 t.a = 2.147483647e9; // 0x7fffffff -> 0x41DFFFFFFFC00000 as double. |
| 836 t.b_long_hi = 0x000000ff; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. | 836 t.b_long_hi = 0x000000ff; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. |
| 837 t.b_long_lo = 0x00ff00ff; | 837 t.b_long_lo = 0x00ff00ff; |
| 838 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 838 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 839 USE(dummy); | 839 USE(dummy); |
| 840 | 840 |
| 841 CHECK_EQ(0x41DFFFFF, t.dbl_exp); | 841 CHECK_EQ(static_cast<int32_t>(0x41DFFFFF), t.dbl_exp); |
| 842 CHECK_EQ(0xFFC00000, t.dbl_mant); | 842 CHECK_EQ(static_cast<int32_t>(0xFFC00000), t.dbl_mant); |
| 843 CHECK_EQ(0, t.long_hi); | 843 CHECK_EQ(0, t.long_hi); |
| 844 CHECK_EQ(0x7fffffff, t.long_lo); | 844 CHECK_EQ(static_cast<int32_t>(0x7fffffff), t.long_lo); |
| 845 CHECK_EQ(2.147483647e9, t.a_converted); | 845 CHECK_EQ(2.147483647e9, t.a_converted); |
| 846 | 846 |
| 847 // 0xFF00FF00FF -> 1.095233372415e12. | 847 // 0xFF00FF00FF -> 1.095233372415e12. |
| 848 CHECK_EQ(1.095233372415e12, t.b); | 848 CHECK_EQ(1.095233372415e12, t.b); |
| 849 CHECK_EQ(0xFF00FF00FF, t.b_long_as_int64); | 849 CHECK_EQ(static_cast<int64_t>(0xFF00FF00FF), t.b_long_as_int64); |
| 850 } | 850 } |
| 851 } | 851 } |
| 852 | 852 |
| 853 | 853 |
| 854 TEST(MIPS11) { | 854 TEST(MIPS11) { |
| 855 // Do not run test on MIPS64r6, as these instructions are removed. | 855 // Do not run test on MIPS64r6, as these instructions are removed. |
| 856 if (kArchVariant != kMips64r6) { | 856 if (kArchVariant != kMips64r6) { |
| 857 // Test LWL, LWR, SWL and SWR instructions. | 857 // Test LWL, LWR, SWL and SWR instructions. |
| 858 CcTest::InitializeVM(); | 858 CcTest::InitializeVM(); |
| 859 Isolate* isolate = CcTest::i_isolate(); | 859 Isolate* isolate = CcTest::i_isolate(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 assm.GetCode(&desc); | 966 assm.GetCode(&desc); |
| 967 Handle<Code> code = isolate->factory()->NewCode( | 967 Handle<Code> code = isolate->factory()->NewCode( |
| 968 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 968 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 969 F3 f = FUNCTION_CAST<F3>(code->entry()); | 969 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 970 t.reg_init = 0xaabbccdd; | 970 t.reg_init = 0xaabbccdd; |
| 971 t.mem_init = 0x11223344; | 971 t.mem_init = 0x11223344; |
| 972 | 972 |
| 973 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 973 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 974 USE(dummy); | 974 USE(dummy); |
| 975 | 975 |
| 976 CHECK_EQ(0x44bbccdd, t.lwl_0); | 976 CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_0); |
| 977 CHECK_EQ(0x3344ccdd, t.lwl_1); | 977 CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_1); |
| 978 CHECK_EQ(0x223344dd, t.lwl_2); | 978 CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_2); |
| 979 CHECK_EQ(0x11223344, t.lwl_3); | 979 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_3); |
| 980 | 980 |
| 981 CHECK_EQ(0x11223344, t.lwr_0); | 981 CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_0); |
| 982 CHECK_EQ(0xaa112233, t.lwr_1); | 982 CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_1); |
| 983 CHECK_EQ(0xaabb1122, t.lwr_2); | 983 CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_2); |
| 984 CHECK_EQ(0xaabbcc11, t.lwr_3); | 984 CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_3); |
| 985 | 985 |
| 986 CHECK_EQ(0x112233aa, t.swl_0); | 986 CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_0); |
| 987 CHECK_EQ(0x1122aabb, t.swl_1); | 987 CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_1); |
| 988 CHECK_EQ(0x11aabbcc, t.swl_2); | 988 CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_2); |
| 989 CHECK_EQ(0xaabbccdd, t.swl_3); | 989 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_3); |
| 990 | 990 |
| 991 CHECK_EQ(0xaabbccdd, t.swr_0); | 991 CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_0); |
| 992 CHECK_EQ(0xbbccdd44, t.swr_1); | 992 CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_1); |
| 993 CHECK_EQ(0xccdd3344, t.swr_2); | 993 CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_2); |
| 994 CHECK_EQ(0xdd223344, t.swr_3); | 994 CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_3); |
| 995 } | 995 } |
| 996 } | 996 } |
| 997 | 997 |
| 998 | 998 |
| 999 TEST(MIPS12) { | 999 TEST(MIPS12) { |
| 1000 CcTest::InitializeVM(); | 1000 CcTest::InitializeVM(); |
| 1001 Isolate* isolate = CcTest::i_isolate(); | 1001 Isolate* isolate = CcTest::i_isolate(); |
| 1002 HandleScope scope(isolate); | 1002 HandleScope scope(isolate); |
| 1003 | 1003 |
| 1004 typedef struct { | 1004 typedef struct { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 t.r1 = 0x1111111111111111; | 1367 t.r1 = 0x1111111111111111; |
| 1368 t.r2 = 0x2222222222222222; | 1368 t.r2 = 0x2222222222222222; |
| 1369 t.r3 = 0x3333333333333333; | 1369 t.r3 = 0x3333333333333333; |
| 1370 t.r4 = 0x4444444444444444; | 1370 t.r4 = 0x4444444444444444; |
| 1371 t.r5 = 0x5555555555555555; | 1371 t.r5 = 0x5555555555555555; |
| 1372 t.r6 = 0x6666666666666666; | 1372 t.r6 = 0x6666666666666666; |
| 1373 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 1373 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 1374 USE(dummy); | 1374 USE(dummy); |
| 1375 | 1375 |
| 1376 // Unsigned data, 32 & 64. | 1376 // Unsigned data, 32 & 64. |
| 1377 CHECK_EQ(0x1111111144332211L, t.r1); | 1377 CHECK_EQ(static_cast<int64_t>(0x1111111144332211L), t.r1); |
| 1378 CHECK_EQ(0x0000000000002211L, t.r2); | 1378 CHECK_EQ(static_cast<int64_t>(0x0000000000002211L), t.r2); |
| 1379 | 1379 |
| 1380 // Signed data, 32 & 64. | 1380 // Signed data, 32 & 64. |
| 1381 CHECK_EQ(0x33333333ffffbbccL, t.r3); | 1381 CHECK_EQ(static_cast<int64_t>(0x33333333ffffbbccL), t.r3); |
| 1382 CHECK_EQ(0xffffffff0000bbccL, t.r4); | 1382 CHECK_EQ(static_cast<int64_t>(0xffffffff0000bbccL), t.r4); |
| 1383 | 1383 |
| 1384 // Signed data, 32 & 64. | 1384 // Signed data, 32 & 64. |
| 1385 CHECK_EQ(0x55555555ffffffccL, t.r5); | 1385 CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r5); |
| 1386 CHECK_EQ(0x000000003333bbccL, t.r6); | 1386 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 #undef __ | 1389 #undef __ |
| OLD | NEW |