| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // clang-format off | 53 // clang-format off |
| 54 | 54 |
| 55 | 55 |
| 56 #define __ assm. | 56 #define __ assm. |
| 57 | 57 |
| 58 TEST(MIPS0) { | 58 TEST(MIPS0) { |
| 59 CcTest::InitializeVM(); | 59 CcTest::InitializeVM(); |
| 60 Isolate* isolate = CcTest::i_isolate(); | 60 Isolate* isolate = CcTest::i_isolate(); |
| 61 HandleScope scope(isolate); | 61 HandleScope scope(isolate); |
| 62 | 62 |
| 63 MacroAssembler assm(isolate, NULL, 0); | 63 MacroAssembler assm(isolate, NULL, 0, true); |
| 64 | 64 |
| 65 // Addition. | 65 // Addition. |
| 66 __ addu(v0, a0, a1); | 66 __ addu(v0, a0, a1); |
| 67 __ jr(ra); | 67 __ jr(ra); |
| 68 __ nop(); | 68 __ nop(); |
| 69 | 69 |
| 70 CodeDesc desc; | 70 CodeDesc desc; |
| 71 assm.GetCode(&desc); | 71 assm.GetCode(&desc); |
| 72 Handle<Code> code = isolate->factory()->NewCode( | 72 Handle<Code> code = isolate->factory()->NewCode( |
| 73 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 73 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 74 F2 f = FUNCTION_CAST<F2>(code->entry()); | 74 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 75 int res = reinterpret_cast<int>( | 75 int res = reinterpret_cast<int>( |
| 76 CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); | 76 CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); |
| 77 CHECK_EQ(static_cast<int32_t>(0xabc), res); | 77 CHECK_EQ(static_cast<int32_t>(0xabc), res); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 TEST(MIPS1) { | 81 TEST(MIPS1) { |
| 82 CcTest::InitializeVM(); | 82 CcTest::InitializeVM(); |
| 83 Isolate* isolate = CcTest::i_isolate(); | 83 Isolate* isolate = CcTest::i_isolate(); |
| 84 HandleScope scope(isolate); | 84 HandleScope scope(isolate); |
| 85 | 85 |
| 86 MacroAssembler assm(isolate, NULL, 0); | 86 MacroAssembler assm(isolate, NULL, 0, true); |
| 87 Label L, C; | 87 Label L, C; |
| 88 | 88 |
| 89 __ mov(a1, a0); | 89 __ mov(a1, a0); |
| 90 __ li(v0, 0); | 90 __ li(v0, 0); |
| 91 __ b(&C); | 91 __ b(&C); |
| 92 __ nop(); | 92 __ nop(); |
| 93 | 93 |
| 94 __ bind(&L); | 94 __ bind(&L); |
| 95 __ addu(v0, v0, a1); | 95 __ addu(v0, v0, a1); |
| 96 __ addiu(a1, a1, -1); | 96 __ addiu(a1, a1, -1); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 112 CALL_GENERATED_CODE(isolate, f, 50, 0, 0, 0, 0)); | 112 CALL_GENERATED_CODE(isolate, f, 50, 0, 0, 0, 0)); |
| 113 CHECK_EQ(1275, res); | 113 CHECK_EQ(1275, res); |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 TEST(MIPS2) { | 117 TEST(MIPS2) { |
| 118 CcTest::InitializeVM(); | 118 CcTest::InitializeVM(); |
| 119 Isolate* isolate = CcTest::i_isolate(); | 119 Isolate* isolate = CcTest::i_isolate(); |
| 120 HandleScope scope(isolate); | 120 HandleScope scope(isolate); |
| 121 | 121 |
| 122 MacroAssembler assm(isolate, NULL, 0); | 122 MacroAssembler assm(isolate, NULL, 0, true); |
| 123 | 123 |
| 124 Label exit, error; | 124 Label exit, error; |
| 125 | 125 |
| 126 // ----- Test all instructions. | 126 // ----- Test all instructions. |
| 127 | 127 |
| 128 // Test lui, ori, and addiu, used in the li pseudo-instruction. | 128 // Test lui, ori, and addiu, used in the li pseudo-instruction. |
| 129 // This way we can then safely load registers with chosen values. | 129 // This way we can then safely load registers with chosen values. |
| 130 | 130 |
| 131 __ ori(t0, zero_reg, 0); | 131 __ ori(t0, zero_reg, 0); |
| 132 __ lui(t0, 0x1234); | 132 __ lui(t0, 0x1234); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 float fc; | 273 float fc; |
| 274 float fd; | 274 float fd; |
| 275 float fe; | 275 float fe; |
| 276 float ff; | 276 float ff; |
| 277 float fg; | 277 float fg; |
| 278 } T; | 278 } T; |
| 279 T t; | 279 T t; |
| 280 | 280 |
| 281 // Create a function that accepts &t, and loads, manipulates, and stores | 281 // Create a function that accepts &t, and loads, manipulates, and stores |
| 282 // the doubles t.a ... t.f. | 282 // the doubles t.a ... t.f. |
| 283 MacroAssembler assm(isolate, NULL, 0); | 283 MacroAssembler assm(isolate, NULL, 0, true); |
| 284 Label L, C; | 284 Label L, C; |
| 285 | 285 |
| 286 // Double precision floating point instructions. | 286 // Double precision floating point instructions. |
| 287 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); | 287 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); |
| 288 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); | 288 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); |
| 289 __ add_d(f8, f4, f6); | 289 __ add_d(f8, f4, f6); |
| 290 __ sdc1(f8, MemOperand(a0, offsetof(T, c)) ); // c = a + b. | 290 __ sdc1(f8, MemOperand(a0, offsetof(T, c)) ); // c = a + b. |
| 291 | 291 |
| 292 __ mov_d(f10, f8); // c | 292 __ mov_d(f10, f8); // c |
| 293 __ neg_d(f12, f6); // -b | 293 __ neg_d(f12, f6); // -b |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 double c; | 611 double c; |
| 612 double d; | 612 double d; |
| 613 double e; | 613 double e; |
| 614 double f; | 614 double f; |
| 615 int32_t result; | 615 int32_t result; |
| 616 } T; | 616 } T; |
| 617 T t; | 617 T t; |
| 618 | 618 |
| 619 // Create a function that accepts &t, and loads, manipulates, and stores | 619 // Create a function that accepts &t, and loads, manipulates, and stores |
| 620 // the doubles t.a ... t.f. | 620 // the doubles t.a ... t.f. |
| 621 MacroAssembler assm(isolate, NULL, 0); | 621 MacroAssembler assm(isolate, NULL, 0, true); |
| 622 Label neither_is_nan, less_than, outa_here; | 622 Label neither_is_nan, less_than, outa_here; |
| 623 | 623 |
| 624 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); | 624 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); |
| 625 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); | 625 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); |
| 626 if (!IsMipsArchVariant(kMips32r6)) { | 626 if (!IsMipsArchVariant(kMips32r6)) { |
| 627 __ c(UN, D, f4, f6); | 627 __ c(UN, D, f4, f6); |
| 628 __ bc1f(&neither_is_nan); | 628 __ bc1f(&neither_is_nan); |
| 629 } else { | 629 } else { |
| 630 __ cmp(UN, L, f2, f4, f6); | 630 __ cmp(UN, L, f2, f4, f6); |
| 631 __ bc1eqz(&neither_is_nan, f2); | 631 __ bc1eqz(&neither_is_nan, f2); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 int32_t result_rotrv_4; | 702 int32_t result_rotrv_4; |
| 703 int32_t result_rotrv_8; | 703 int32_t result_rotrv_8; |
| 704 int32_t result_rotrv_12; | 704 int32_t result_rotrv_12; |
| 705 int32_t result_rotrv_16; | 705 int32_t result_rotrv_16; |
| 706 int32_t result_rotrv_20; | 706 int32_t result_rotrv_20; |
| 707 int32_t result_rotrv_24; | 707 int32_t result_rotrv_24; |
| 708 int32_t result_rotrv_28; | 708 int32_t result_rotrv_28; |
| 709 } T; | 709 } T; |
| 710 T t; | 710 T t; |
| 711 | 711 |
| 712 MacroAssembler assm(isolate, NULL, 0); | 712 MacroAssembler assm(isolate, NULL, 0, true); |
| 713 | 713 |
| 714 // Basic word load. | 714 // Basic word load. |
| 715 __ lw(t0, MemOperand(a0, offsetof(T, input)) ); | 715 __ lw(t0, MemOperand(a0, offsetof(T, input)) ); |
| 716 | 716 |
| 717 // ROTR instruction (called through the Ror macro). | 717 // ROTR instruction (called through the Ror macro). |
| 718 __ Ror(t1, t0, 0x0004); | 718 __ Ror(t1, t0, 0x0004); |
| 719 __ Ror(t2, t0, 0x0008); | 719 __ Ror(t2, t0, 0x0008); |
| 720 __ Ror(t3, t0, 0x000c); | 720 __ Ror(t3, t0, 0x000c); |
| 721 __ Ror(t4, t0, 0x0010); | 721 __ Ror(t4, t0, 0x0010); |
| 722 __ Ror(t5, t0, 0x0014); | 722 __ Ror(t5, t0, 0x0014); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 } | 786 } |
| 787 } | 787 } |
| 788 | 788 |
| 789 | 789 |
| 790 TEST(MIPS9) { | 790 TEST(MIPS9) { |
| 791 // Test BRANCH improvements. | 791 // Test BRANCH improvements. |
| 792 CcTest::InitializeVM(); | 792 CcTest::InitializeVM(); |
| 793 Isolate* isolate = CcTest::i_isolate(); | 793 Isolate* isolate = CcTest::i_isolate(); |
| 794 HandleScope scope(isolate); | 794 HandleScope scope(isolate); |
| 795 | 795 |
| 796 MacroAssembler assm(isolate, NULL, 0); | 796 MacroAssembler assm(isolate, NULL, 0, true); |
| 797 Label exit, exit2, exit3; | 797 Label exit, exit2, exit3; |
| 798 | 798 |
| 799 __ Branch(&exit, ge, a0, Operand(zero_reg)); | 799 __ Branch(&exit, ge, a0, Operand(zero_reg)); |
| 800 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); | 800 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); |
| 801 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); | 801 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); |
| 802 | 802 |
| 803 __ bind(&exit); | 803 __ bind(&exit); |
| 804 __ bind(&exit2); | 804 __ bind(&exit2); |
| 805 __ bind(&exit3); | 805 __ bind(&exit3); |
| 806 __ jr(ra); | 806 __ jr(ra); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 typedef struct { | 1060 typedef struct { |
| 1061 int32_t x; | 1061 int32_t x; |
| 1062 int32_t y; | 1062 int32_t y; |
| 1063 int32_t y1; | 1063 int32_t y1; |
| 1064 int32_t y2; | 1064 int32_t y2; |
| 1065 int32_t y3; | 1065 int32_t y3; |
| 1066 int32_t y4; | 1066 int32_t y4; |
| 1067 } T; | 1067 } T; |
| 1068 T t; | 1068 T t; |
| 1069 | 1069 |
| 1070 MacroAssembler assm(isolate, NULL, 0); | 1070 MacroAssembler assm(isolate, NULL, 0, true); |
| 1071 | 1071 |
| 1072 __ mov(t6, fp); // Save frame pointer. | 1072 __ mov(t6, fp); // Save frame pointer. |
| 1073 __ mov(fp, a0); // Access struct T by fp. | 1073 __ mov(fp, a0); // Access struct T by fp. |
| 1074 __ lw(t0, MemOperand(a0, offsetof(T, y)) ); | 1074 __ lw(t0, MemOperand(a0, offsetof(T, y)) ); |
| 1075 __ lw(t3, MemOperand(a0, offsetof(T, y4)) ); | 1075 __ lw(t3, MemOperand(a0, offsetof(T, y4)) ); |
| 1076 | 1076 |
| 1077 __ addu(t1, t0, t3); | 1077 __ addu(t1, t0, t3); |
| 1078 __ subu(t4, t0, t3); | 1078 __ subu(t4, t0, t3); |
| 1079 __ nop(); | 1079 __ nop(); |
| 1080 __ push(t0); // These instructions disappear after opt. | 1080 __ push(t0); // These instructions disappear after opt. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 typedef struct { | 1149 typedef struct { |
| 1150 double cvt_big_out; | 1150 double cvt_big_out; |
| 1151 double cvt_small_out; | 1151 double cvt_small_out; |
| 1152 uint32_t trunc_big_out; | 1152 uint32_t trunc_big_out; |
| 1153 uint32_t trunc_small_out; | 1153 uint32_t trunc_small_out; |
| 1154 uint32_t cvt_big_in; | 1154 uint32_t cvt_big_in; |
| 1155 uint32_t cvt_small_in; | 1155 uint32_t cvt_small_in; |
| 1156 } T; | 1156 } T; |
| 1157 T t; | 1157 T t; |
| 1158 | 1158 |
| 1159 MacroAssembler assm(isolate, NULL, 0); | 1159 MacroAssembler assm(isolate, NULL, 0, true); |
| 1160 | 1160 |
| 1161 __ sw(t0, MemOperand(a0, offsetof(T, cvt_small_in))); | 1161 __ sw(t0, MemOperand(a0, offsetof(T, cvt_small_in))); |
| 1162 __ Cvt_d_uw(f10, t0, f4); | 1162 __ Cvt_d_uw(f10, t0, f4); |
| 1163 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out))); | 1163 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out))); |
| 1164 | 1164 |
| 1165 __ Trunc_uw_d(f10, f10, f4); | 1165 __ Trunc_uw_d(f10, f10, f4); |
| 1166 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out))); | 1166 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out))); |
| 1167 | 1167 |
| 1168 __ sw(t0, MemOperand(a0, offsetof(T, cvt_big_in))); | 1168 __ sw(t0, MemOperand(a0, offsetof(T, cvt_big_in))); |
| 1169 __ Cvt_d_uw(f8, t0, f4); | 1169 __ Cvt_d_uw(f8, t0, f4); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 ROUND_STRUCT_ELEMENT(round) | 1226 ROUND_STRUCT_ELEMENT(round) |
| 1227 ROUND_STRUCT_ELEMENT(floor) | 1227 ROUND_STRUCT_ELEMENT(floor) |
| 1228 ROUND_STRUCT_ELEMENT(ceil) | 1228 ROUND_STRUCT_ELEMENT(ceil) |
| 1229 ROUND_STRUCT_ELEMENT(trunc) | 1229 ROUND_STRUCT_ELEMENT(trunc) |
| 1230 ROUND_STRUCT_ELEMENT(cvt) | 1230 ROUND_STRUCT_ELEMENT(cvt) |
| 1231 } T; | 1231 } T; |
| 1232 T t; | 1232 T t; |
| 1233 | 1233 |
| 1234 #undef ROUND_STRUCT_ELEMENT | 1234 #undef ROUND_STRUCT_ELEMENT |
| 1235 | 1235 |
| 1236 MacroAssembler assm(isolate, NULL, 0); | 1236 MacroAssembler assm(isolate, NULL, 0, true); |
| 1237 | 1237 |
| 1238 // Save FCSR. | 1238 // Save FCSR. |
| 1239 __ cfc1(a1, FCSR); | 1239 __ cfc1(a1, FCSR); |
| 1240 // Disable FPU exceptions. | 1240 // Disable FPU exceptions. |
| 1241 __ ctc1(zero_reg, FCSR); | 1241 __ ctc1(zero_reg, FCSR); |
| 1242 #define RUN_ROUND_TEST(x) \ | 1242 #define RUN_ROUND_TEST(x) \ |
| 1243 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \ | 1243 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \ |
| 1244 __ x##_w_d(f0, f0); \ | 1244 __ x##_w_d(f0, f0); \ |
| 1245 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \ | 1245 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \ |
| 1246 \ | 1246 \ |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 __ nop(); | 1342 __ nop(); |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 | 1345 |
| 1346 // ----------------------mips32r6 specific tests---------------------- | 1346 // ----------------------mips32r6 specific tests---------------------- |
| 1347 TEST(seleqz_selnez) { | 1347 TEST(seleqz_selnez) { |
| 1348 if (IsMipsArchVariant(kMips32r6)) { | 1348 if (IsMipsArchVariant(kMips32r6)) { |
| 1349 CcTest::InitializeVM(); | 1349 CcTest::InitializeVM(); |
| 1350 Isolate* isolate = CcTest::i_isolate(); | 1350 Isolate* isolate = CcTest::i_isolate(); |
| 1351 HandleScope scope(isolate); | 1351 HandleScope scope(isolate); |
| 1352 MacroAssembler assm(isolate, NULL, 0); | 1352 MacroAssembler assm(isolate, NULL, 0, true); |
| 1353 | 1353 |
| 1354 typedef struct test { | 1354 typedef struct test { |
| 1355 int a; | 1355 int a; |
| 1356 int b; | 1356 int b; |
| 1357 int c; | 1357 int c; |
| 1358 int d; | 1358 int d; |
| 1359 double e; | 1359 double e; |
| 1360 double f; | 1360 double f; |
| 1361 double g; | 1361 double g; |
| 1362 double h; | 1362 double h; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 } | 1443 } |
| 1444 } | 1444 } |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 | 1447 |
| 1448 TEST(min_max) { | 1448 TEST(min_max) { |
| 1449 if (IsMipsArchVariant(kMips32r6)) { | 1449 if (IsMipsArchVariant(kMips32r6)) { |
| 1450 CcTest::InitializeVM(); | 1450 CcTest::InitializeVM(); |
| 1451 Isolate* isolate = CcTest::i_isolate(); | 1451 Isolate* isolate = CcTest::i_isolate(); |
| 1452 HandleScope scope(isolate); | 1452 HandleScope scope(isolate); |
| 1453 MacroAssembler assm(isolate, NULL, 0); | 1453 MacroAssembler assm(isolate, NULL, 0, true); |
| 1454 | 1454 |
| 1455 typedef struct test_float { | 1455 typedef struct test_float { |
| 1456 double a; | 1456 double a; |
| 1457 double b; | 1457 double b; |
| 1458 double c; | 1458 double c; |
| 1459 double d; | 1459 double d; |
| 1460 float e; | 1460 float e; |
| 1461 float f; | 1461 float f; |
| 1462 float g; | 1462 float g; |
| 1463 float h; | 1463 float h; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 } | 1520 } |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 | 1523 |
| 1524 TEST(rint_d) { | 1524 TEST(rint_d) { |
| 1525 if (IsMipsArchVariant(kMips32r6)) { | 1525 if (IsMipsArchVariant(kMips32r6)) { |
| 1526 const int kTableLength = 30; | 1526 const int kTableLength = 30; |
| 1527 CcTest::InitializeVM(); | 1527 CcTest::InitializeVM(); |
| 1528 Isolate* isolate = CcTest::i_isolate(); | 1528 Isolate* isolate = CcTest::i_isolate(); |
| 1529 HandleScope scope(isolate); | 1529 HandleScope scope(isolate); |
| 1530 MacroAssembler assm(isolate, NULL, 0); | 1530 MacroAssembler assm(isolate, NULL, 0, true); |
| 1531 | 1531 |
| 1532 typedef struct test_float { | 1532 typedef struct test_float { |
| 1533 double a; | 1533 double a; |
| 1534 double b; | 1534 double b; |
| 1535 int fcsr; | 1535 int fcsr; |
| 1536 }TestFloat; | 1536 }TestFloat; |
| 1537 | 1537 |
| 1538 TestFloat test; | 1538 TestFloat test; |
| 1539 double inputs[kTableLength] = {18446744073709551617.0, | 1539 double inputs[kTableLength] = {18446744073709551617.0, |
| 1540 4503599627370496.0, -4503599627370496.0, | 1540 4503599627370496.0, -4503599627370496.0, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 } | 1625 } |
| 1626 } | 1626 } |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 | 1629 |
| 1630 TEST(sel) { | 1630 TEST(sel) { |
| 1631 if (IsMipsArchVariant(kMips32r6)) { | 1631 if (IsMipsArchVariant(kMips32r6)) { |
| 1632 CcTest::InitializeVM(); | 1632 CcTest::InitializeVM(); |
| 1633 Isolate* isolate = CcTest::i_isolate(); | 1633 Isolate* isolate = CcTest::i_isolate(); |
| 1634 HandleScope scope(isolate); | 1634 HandleScope scope(isolate); |
| 1635 MacroAssembler assm(isolate, NULL, 0); | 1635 MacroAssembler assm(isolate, NULL, 0, true); |
| 1636 | 1636 |
| 1637 typedef struct test { | 1637 typedef struct test { |
| 1638 double dd; | 1638 double dd; |
| 1639 double ds; | 1639 double ds; |
| 1640 double dt; | 1640 double dt; |
| 1641 float fd; | 1641 float fd; |
| 1642 float fs; | 1642 float fs; |
| 1643 float ft; | 1643 float ft; |
| 1644 } Test; | 1644 } Test; |
| 1645 | 1645 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 } | 1699 } |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 | 1702 |
| 1703 TEST(rint_s) { | 1703 TEST(rint_s) { |
| 1704 if (IsMipsArchVariant(kMips32r6)) { | 1704 if (IsMipsArchVariant(kMips32r6)) { |
| 1705 const int kTableLength = 30; | 1705 const int kTableLength = 30; |
| 1706 CcTest::InitializeVM(); | 1706 CcTest::InitializeVM(); |
| 1707 Isolate* isolate = CcTest::i_isolate(); | 1707 Isolate* isolate = CcTest::i_isolate(); |
| 1708 HandleScope scope(isolate); | 1708 HandleScope scope(isolate); |
| 1709 MacroAssembler assm(isolate, NULL, 0); | 1709 MacroAssembler assm(isolate, NULL, 0, true); |
| 1710 | 1710 |
| 1711 typedef struct test_float { | 1711 typedef struct test_float { |
| 1712 float a; | 1712 float a; |
| 1713 float b; | 1713 float b; |
| 1714 int fcsr; | 1714 int fcsr; |
| 1715 }TestFloat; | 1715 }TestFloat; |
| 1716 | 1716 |
| 1717 TestFloat test; | 1717 TestFloat test; |
| 1718 float inputs[kTableLength] = {18446744073709551617.0, | 1718 float inputs[kTableLength] = {18446744073709551617.0, |
| 1719 4503599627370496.0, -4503599627370496.0, | 1719 4503599627370496.0, -4503599627370496.0, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 } | 1805 } |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 | 1808 |
| 1809 TEST(mina_maxa) { | 1809 TEST(mina_maxa) { |
| 1810 if (IsMipsArchVariant(kMips32r6)) { | 1810 if (IsMipsArchVariant(kMips32r6)) { |
| 1811 const int kTableLength = 15; | 1811 const int kTableLength = 15; |
| 1812 CcTest::InitializeVM(); | 1812 CcTest::InitializeVM(); |
| 1813 Isolate* isolate = CcTest::i_isolate(); | 1813 Isolate* isolate = CcTest::i_isolate(); |
| 1814 HandleScope scope(isolate); | 1814 HandleScope scope(isolate); |
| 1815 MacroAssembler assm(isolate, NULL, 0); | 1815 MacroAssembler assm(isolate, NULL, 0, true); |
| 1816 const double double_nan = std::numeric_limits<double>::quiet_NaN(); | 1816 const double double_nan = std::numeric_limits<double>::quiet_NaN(); |
| 1817 const float float_nan = std::numeric_limits<float>::quiet_NaN(); | 1817 const float float_nan = std::numeric_limits<float>::quiet_NaN(); |
| 1818 | 1818 |
| 1819 typedef struct test_float { | 1819 typedef struct test_float { |
| 1820 double a; | 1820 double a; |
| 1821 double b; | 1821 double b; |
| 1822 double resd; | 1822 double resd; |
| 1823 double resd1; | 1823 double resd1; |
| 1824 float c; | 1824 float c; |
| 1825 float d; | 1825 float d; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 } | 1902 } |
| 1903 } | 1903 } |
| 1904 | 1904 |
| 1905 | 1905 |
| 1906 // ----------------------mips32r2 specific tests---------------------- | 1906 // ----------------------mips32r2 specific tests---------------------- |
| 1907 TEST(trunc_l) { | 1907 TEST(trunc_l) { |
| 1908 if (IsMipsArchVariant(kMips32r2) && IsFp64Mode()) { | 1908 if (IsMipsArchVariant(kMips32r2) && IsFp64Mode()) { |
| 1909 CcTest::InitializeVM(); | 1909 CcTest::InitializeVM(); |
| 1910 Isolate* isolate = CcTest::i_isolate(); | 1910 Isolate* isolate = CcTest::i_isolate(); |
| 1911 HandleScope scope(isolate); | 1911 HandleScope scope(isolate); |
| 1912 MacroAssembler assm(isolate, NULL, 0); | 1912 MacroAssembler assm(isolate, NULL, 0, true); |
| 1913 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); | 1913 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
| 1914 typedef struct test_float { | 1914 typedef struct test_float { |
| 1915 double a; | 1915 double a; |
| 1916 float b; | 1916 float b; |
| 1917 int64_t c; // a trunc result | 1917 int64_t c; // a trunc result |
| 1918 int64_t d; // b trunc result | 1918 int64_t d; // b trunc result |
| 1919 }Test; | 1919 }Test; |
| 1920 const int kTableLength = 15; | 1920 const int kTableLength = 15; |
| 1921 double inputs_D[kTableLength] = { | 1921 double inputs_D[kTableLength] = { |
| 1922 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 1922 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 } | 1962 } |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 | 1965 |
| 1966 TEST(movz_movn) { | 1966 TEST(movz_movn) { |
| 1967 if (IsMipsArchVariant(kMips32r2)) { | 1967 if (IsMipsArchVariant(kMips32r2)) { |
| 1968 const int kTableLength = 4; | 1968 const int kTableLength = 4; |
| 1969 CcTest::InitializeVM(); | 1969 CcTest::InitializeVM(); |
| 1970 Isolate* isolate = CcTest::i_isolate(); | 1970 Isolate* isolate = CcTest::i_isolate(); |
| 1971 HandleScope scope(isolate); | 1971 HandleScope scope(isolate); |
| 1972 MacroAssembler assm(isolate, NULL, 0); | 1972 MacroAssembler assm(isolate, NULL, 0, true); |
| 1973 | 1973 |
| 1974 typedef struct test_float { | 1974 typedef struct test_float { |
| 1975 int64_t rt; | 1975 int64_t rt; |
| 1976 double a; | 1976 double a; |
| 1977 double b; | 1977 double b; |
| 1978 double bold; | 1978 double bold; |
| 1979 double b1; | 1979 double b1; |
| 1980 double bold1; | 1980 double bold1; |
| 1981 float c; | 1981 float c; |
| 1982 float d; | 1982 float d; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2091 test.srcf = inputs_S[i]; | 2091 test.srcf = inputs_S[i]; |
| 2092 | 2092 |
| 2093 for (int j = 0; j< 8; j++) { | 2093 for (int j = 0; j< 8; j++) { |
| 2094 test.cc = condition_flags[j]; | 2094 test.cc = condition_flags[j]; |
| 2095 if (test.cc == 0) { | 2095 if (test.cc == 0) { |
| 2096 test.fcsr = 1 << 23; | 2096 test.fcsr = 1 << 23; |
| 2097 } else { | 2097 } else { |
| 2098 test.fcsr = 1 << (24+condition_flags[j]); | 2098 test.fcsr = 1 << (24+condition_flags[j]); |
| 2099 } | 2099 } |
| 2100 HandleScope scope(isolate); | 2100 HandleScope scope(isolate); |
| 2101 MacroAssembler assm(isolate, NULL, 0); | 2101 MacroAssembler assm(isolate, NULL, 0, true); |
| 2102 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) ); | 2102 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) ); |
| 2103 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) ); | 2103 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) ); |
| 2104 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) ); | 2104 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) ); |
| 2105 __ cfc1(t0, FCSR); | 2105 __ cfc1(t0, FCSR); |
| 2106 __ ctc1(t1, FCSR); | 2106 __ ctc1(t1, FCSR); |
| 2107 __ li(t2, 0x0); | 2107 __ li(t2, 0x0); |
| 2108 __ mtc1(t2, f12); | 2108 __ mtc1(t2, f12); |
| 2109 __ mtc1(t2, f10); | 2109 __ mtc1(t2, f10); |
| 2110 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) ); | 2110 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) ); |
| 2111 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) ); | 2111 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) ); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 } | 2144 } |
| 2145 } | 2145 } |
| 2146 } | 2146 } |
| 2147 | 2147 |
| 2148 | 2148 |
| 2149 // ----------------------tests for all archs-------------------------- | 2149 // ----------------------tests for all archs-------------------------- |
| 2150 TEST(cvt_w_d) { | 2150 TEST(cvt_w_d) { |
| 2151 CcTest::InitializeVM(); | 2151 CcTest::InitializeVM(); |
| 2152 Isolate* isolate = CcTest::i_isolate(); | 2152 Isolate* isolate = CcTest::i_isolate(); |
| 2153 HandleScope scope(isolate); | 2153 HandleScope scope(isolate); |
| 2154 MacroAssembler assm(isolate, NULL, 0); | 2154 MacroAssembler assm(isolate, NULL, 0, true); |
| 2155 | 2155 |
| 2156 typedef struct test_float { | 2156 typedef struct test_float { |
| 2157 double a; | 2157 double a; |
| 2158 int32_t b; | 2158 int32_t b; |
| 2159 int32_t fcsr; | 2159 int32_t fcsr; |
| 2160 }Test; | 2160 }Test; |
| 2161 const int kTableLength = 24; | 2161 const int kTableLength = 24; |
| 2162 double inputs[kTableLength] = { | 2162 double inputs[kTableLength] = { |
| 2163 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2163 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| 2164 -2.1, -2.6, -2.5, -3.1, -3.6, -3.5, | 2164 -2.1, -2.6, -2.5, -3.1, -3.6, -3.5, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 CHECK_EQ(test.b, outputs[j][i]); | 2221 CHECK_EQ(test.b, outputs[j][i]); |
| 2222 } | 2222 } |
| 2223 } | 2223 } |
| 2224 } | 2224 } |
| 2225 | 2225 |
| 2226 | 2226 |
| 2227 TEST(trunc_w) { | 2227 TEST(trunc_w) { |
| 2228 CcTest::InitializeVM(); | 2228 CcTest::InitializeVM(); |
| 2229 Isolate* isolate = CcTest::i_isolate(); | 2229 Isolate* isolate = CcTest::i_isolate(); |
| 2230 HandleScope scope(isolate); | 2230 HandleScope scope(isolate); |
| 2231 MacroAssembler assm(isolate, NULL, 0); | 2231 MacroAssembler assm(isolate, NULL, 0, true); |
| 2232 | 2232 |
| 2233 typedef struct test_float { | 2233 typedef struct test_float { |
| 2234 double a; | 2234 double a; |
| 2235 float b; | 2235 float b; |
| 2236 int32_t c; // a trunc result | 2236 int32_t c; // a trunc result |
| 2237 int32_t d; // b trunc result | 2237 int32_t d; // b trunc result |
| 2238 }Test; | 2238 }Test; |
| 2239 const int kTableLength = 15; | 2239 const int kTableLength = 15; |
| 2240 double inputs_D[kTableLength] = { | 2240 double inputs_D[kTableLength] = { |
| 2241 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2241 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 CHECK_EQ(test.c, outputs[i]); | 2278 CHECK_EQ(test.c, outputs[i]); |
| 2279 CHECK_EQ(test.d, test.c); | 2279 CHECK_EQ(test.d, test.c); |
| 2280 } | 2280 } |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 | 2283 |
| 2284 TEST(round_w) { | 2284 TEST(round_w) { |
| 2285 CcTest::InitializeVM(); | 2285 CcTest::InitializeVM(); |
| 2286 Isolate* isolate = CcTest::i_isolate(); | 2286 Isolate* isolate = CcTest::i_isolate(); |
| 2287 HandleScope scope(isolate); | 2287 HandleScope scope(isolate); |
| 2288 MacroAssembler assm(isolate, NULL, 0); | 2288 MacroAssembler assm(isolate, NULL, 0, true); |
| 2289 | 2289 |
| 2290 typedef struct test_float { | 2290 typedef struct test_float { |
| 2291 double a; | 2291 double a; |
| 2292 float b; | 2292 float b; |
| 2293 int32_t c; // a trunc result | 2293 int32_t c; // a trunc result |
| 2294 int32_t d; // b trunc result | 2294 int32_t d; // b trunc result |
| 2295 }Test; | 2295 }Test; |
| 2296 const int kTableLength = 15; | 2296 const int kTableLength = 15; |
| 2297 double inputs_D[kTableLength] = { | 2297 double inputs_D[kTableLength] = { |
| 2298 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2298 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 CHECK_EQ(test.d, test.c); | 2336 CHECK_EQ(test.d, test.c); |
| 2337 } | 2337 } |
| 2338 } | 2338 } |
| 2339 | 2339 |
| 2340 | 2340 |
| 2341 TEST(round_l) { | 2341 TEST(round_l) { |
| 2342 if (IsFp64Mode()) { | 2342 if (IsFp64Mode()) { |
| 2343 CcTest::InitializeVM(); | 2343 CcTest::InitializeVM(); |
| 2344 Isolate* isolate = CcTest::i_isolate(); | 2344 Isolate* isolate = CcTest::i_isolate(); |
| 2345 HandleScope scope(isolate); | 2345 HandleScope scope(isolate); |
| 2346 MacroAssembler assm(isolate, NULL, 0); | 2346 MacroAssembler assm(isolate, NULL, 0, true); |
| 2347 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); | 2347 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
| 2348 typedef struct test_float { | 2348 typedef struct test_float { |
| 2349 double a; | 2349 double a; |
| 2350 float b; | 2350 float b; |
| 2351 int64_t c; | 2351 int64_t c; |
| 2352 int64_t d; | 2352 int64_t d; |
| 2353 }Test; | 2353 }Test; |
| 2354 const int kTableLength = 15; | 2354 const int kTableLength = 15; |
| 2355 double inputs_D[kTableLength] = { | 2355 double inputs_D[kTableLength] = { |
| 2356 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2356 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 } | 2395 } |
| 2396 } | 2396 } |
| 2397 } | 2397 } |
| 2398 | 2398 |
| 2399 | 2399 |
| 2400 TEST(sub) { | 2400 TEST(sub) { |
| 2401 const int kTableLength = 12; | 2401 const int kTableLength = 12; |
| 2402 CcTest::InitializeVM(); | 2402 CcTest::InitializeVM(); |
| 2403 Isolate* isolate = CcTest::i_isolate(); | 2403 Isolate* isolate = CcTest::i_isolate(); |
| 2404 HandleScope scope(isolate); | 2404 HandleScope scope(isolate); |
| 2405 MacroAssembler assm(isolate, NULL, 0); | 2405 MacroAssembler assm(isolate, NULL, 0, true); |
| 2406 | 2406 |
| 2407 typedef struct test_float { | 2407 typedef struct test_float { |
| 2408 float a; | 2408 float a; |
| 2409 float b; | 2409 float b; |
| 2410 float resultS; | 2410 float resultS; |
| 2411 double c; | 2411 double c; |
| 2412 double d; | 2412 double d; |
| 2413 double resultD; | 2413 double resultD; |
| 2414 }TestFloat; | 2414 }TestFloat; |
| 2415 | 2415 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 | 2468 |
| 2469 TEST(sqrt_rsqrt_recip) { | 2469 TEST(sqrt_rsqrt_recip) { |
| 2470 const int kTableLength = 4; | 2470 const int kTableLength = 4; |
| 2471 const double deltaDouble = 2E-15; | 2471 const double deltaDouble = 2E-15; |
| 2472 const float deltaFloat = 2E-7; | 2472 const float deltaFloat = 2E-7; |
| 2473 const float sqrt2_s = sqrt(2); | 2473 const float sqrt2_s = sqrt(2); |
| 2474 const double sqrt2_d = sqrt(2); | 2474 const double sqrt2_d = sqrt(2); |
| 2475 CcTest::InitializeVM(); | 2475 CcTest::InitializeVM(); |
| 2476 Isolate* isolate = CcTest::i_isolate(); | 2476 Isolate* isolate = CcTest::i_isolate(); |
| 2477 HandleScope scope(isolate); | 2477 HandleScope scope(isolate); |
| 2478 MacroAssembler assm(isolate, NULL, 0); | 2478 MacroAssembler assm(isolate, NULL, 0, true); |
| 2479 | 2479 |
| 2480 typedef struct test_float { | 2480 typedef struct test_float { |
| 2481 float a; | 2481 float a; |
| 2482 float resultS; | 2482 float resultS; |
| 2483 float resultS1; | 2483 float resultS1; |
| 2484 float resultS2; | 2484 float resultS2; |
| 2485 double c; | 2485 double c; |
| 2486 double resultD; | 2486 double resultD; |
| 2487 double resultD1; | 2487 double resultD1; |
| 2488 double resultD2; | 2488 double resultD2; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 } | 2568 } |
| 2569 } | 2569 } |
| 2570 } | 2570 } |
| 2571 | 2571 |
| 2572 | 2572 |
| 2573 TEST(neg) { | 2573 TEST(neg) { |
| 2574 const int kTableLength = 3; | 2574 const int kTableLength = 3; |
| 2575 CcTest::InitializeVM(); | 2575 CcTest::InitializeVM(); |
| 2576 Isolate* isolate = CcTest::i_isolate(); | 2576 Isolate* isolate = CcTest::i_isolate(); |
| 2577 HandleScope scope(isolate); | 2577 HandleScope scope(isolate); |
| 2578 MacroAssembler assm(isolate, NULL, 0); | 2578 MacroAssembler assm(isolate, NULL, 0, true); |
| 2579 | 2579 |
| 2580 typedef struct test_float { | 2580 typedef struct test_float { |
| 2581 float a; | 2581 float a; |
| 2582 float resultS; | 2582 float resultS; |
| 2583 double c; | 2583 double c; |
| 2584 double resultD; | 2584 double resultD; |
| 2585 }TestFloat; | 2585 }TestFloat; |
| 2586 | 2586 |
| 2587 TestFloat test; | 2587 TestFloat test; |
| 2588 double inputs_D[kTableLength] = { | 2588 double inputs_D[kTableLength] = { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 CHECK_EQ(test.resultD, outputs_D[i]); | 2621 CHECK_EQ(test.resultD, outputs_D[i]); |
| 2622 } | 2622 } |
| 2623 } | 2623 } |
| 2624 | 2624 |
| 2625 | 2625 |
| 2626 TEST(mul) { | 2626 TEST(mul) { |
| 2627 const int kTableLength = 4; | 2627 const int kTableLength = 4; |
| 2628 CcTest::InitializeVM(); | 2628 CcTest::InitializeVM(); |
| 2629 Isolate* isolate = CcTest::i_isolate(); | 2629 Isolate* isolate = CcTest::i_isolate(); |
| 2630 HandleScope scope(isolate); | 2630 HandleScope scope(isolate); |
| 2631 MacroAssembler assm(isolate, NULL, 0); | 2631 MacroAssembler assm(isolate, NULL, 0, true); |
| 2632 | 2632 |
| 2633 typedef struct test_float { | 2633 typedef struct test_float { |
| 2634 float a; | 2634 float a; |
| 2635 float b; | 2635 float b; |
| 2636 float resultS; | 2636 float resultS; |
| 2637 double c; | 2637 double c; |
| 2638 double d; | 2638 double d; |
| 2639 double resultD; | 2639 double resultD; |
| 2640 }TestFloat; | 2640 }TestFloat; |
| 2641 | 2641 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); | 2680 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); |
| 2681 } | 2681 } |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 | 2684 |
| 2685 TEST(mov) { | 2685 TEST(mov) { |
| 2686 const int kTableLength = 4; | 2686 const int kTableLength = 4; |
| 2687 CcTest::InitializeVM(); | 2687 CcTest::InitializeVM(); |
| 2688 Isolate* isolate = CcTest::i_isolate(); | 2688 Isolate* isolate = CcTest::i_isolate(); |
| 2689 HandleScope scope(isolate); | 2689 HandleScope scope(isolate); |
| 2690 MacroAssembler assm(isolate, NULL, 0); | 2690 MacroAssembler assm(isolate, NULL, 0, true); |
| 2691 | 2691 |
| 2692 typedef struct test_float { | 2692 typedef struct test_float { |
| 2693 double a; | 2693 double a; |
| 2694 double b; | 2694 double b; |
| 2695 float c; | 2695 float c; |
| 2696 float d; | 2696 float d; |
| 2697 }TestFloat; | 2697 }TestFloat; |
| 2698 | 2698 |
| 2699 TestFloat test; | 2699 TestFloat test; |
| 2700 double inputs_D[kTableLength] = { | 2700 double inputs_D[kTableLength] = { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 CHECK_EQ(test.b, outputs_D[i]); | 2734 CHECK_EQ(test.b, outputs_D[i]); |
| 2735 CHECK_EQ(test.d, outputs_S[i]); | 2735 CHECK_EQ(test.d, outputs_S[i]); |
| 2736 } | 2736 } |
| 2737 } | 2737 } |
| 2738 | 2738 |
| 2739 | 2739 |
| 2740 TEST(floor_w) { | 2740 TEST(floor_w) { |
| 2741 CcTest::InitializeVM(); | 2741 CcTest::InitializeVM(); |
| 2742 Isolate* isolate = CcTest::i_isolate(); | 2742 Isolate* isolate = CcTest::i_isolate(); |
| 2743 HandleScope scope(isolate); | 2743 HandleScope scope(isolate); |
| 2744 MacroAssembler assm(isolate, NULL, 0); | 2744 MacroAssembler assm(isolate, NULL, 0, true); |
| 2745 | 2745 |
| 2746 typedef struct test_float { | 2746 typedef struct test_float { |
| 2747 double a; | 2747 double a; |
| 2748 float b; | 2748 float b; |
| 2749 int32_t c; // a floor result | 2749 int32_t c; // a floor result |
| 2750 int32_t d; // b floor result | 2750 int32_t d; // b floor result |
| 2751 }Test; | 2751 }Test; |
| 2752 const int kTableLength = 15; | 2752 const int kTableLength = 15; |
| 2753 double inputs_D[kTableLength] = { | 2753 double inputs_D[kTableLength] = { |
| 2754 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2754 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 CHECK_EQ(test.d, test.c); | 2792 CHECK_EQ(test.d, test.c); |
| 2793 } | 2793 } |
| 2794 } | 2794 } |
| 2795 | 2795 |
| 2796 | 2796 |
| 2797 TEST(floor_l) { | 2797 TEST(floor_l) { |
| 2798 if (IsFp64Mode()) { | 2798 if (IsFp64Mode()) { |
| 2799 CcTest::InitializeVM(); | 2799 CcTest::InitializeVM(); |
| 2800 Isolate* isolate = CcTest::i_isolate(); | 2800 Isolate* isolate = CcTest::i_isolate(); |
| 2801 HandleScope scope(isolate); | 2801 HandleScope scope(isolate); |
| 2802 MacroAssembler assm(isolate, NULL, 0); | 2802 MacroAssembler assm(isolate, NULL, 0, true); |
| 2803 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); | 2803 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
| 2804 typedef struct test_float { | 2804 typedef struct test_float { |
| 2805 double a; | 2805 double a; |
| 2806 float b; | 2806 float b; |
| 2807 int64_t c; | 2807 int64_t c; |
| 2808 int64_t d; | 2808 int64_t d; |
| 2809 }Test; | 2809 }Test; |
| 2810 const int kTableLength = 15; | 2810 const int kTableLength = 15; |
| 2811 double inputs_D[kTableLength] = { | 2811 double inputs_D[kTableLength] = { |
| 2812 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2812 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2850 CHECK_EQ(test.d, test.c); | 2850 CHECK_EQ(test.d, test.c); |
| 2851 } | 2851 } |
| 2852 } | 2852 } |
| 2853 } | 2853 } |
| 2854 | 2854 |
| 2855 | 2855 |
| 2856 TEST(ceil_w) { | 2856 TEST(ceil_w) { |
| 2857 CcTest::InitializeVM(); | 2857 CcTest::InitializeVM(); |
| 2858 Isolate* isolate = CcTest::i_isolate(); | 2858 Isolate* isolate = CcTest::i_isolate(); |
| 2859 HandleScope scope(isolate); | 2859 HandleScope scope(isolate); |
| 2860 MacroAssembler assm(isolate, NULL, 0); | 2860 MacroAssembler assm(isolate, NULL, 0, true); |
| 2861 | 2861 |
| 2862 typedef struct test_float { | 2862 typedef struct test_float { |
| 2863 double a; | 2863 double a; |
| 2864 float b; | 2864 float b; |
| 2865 int32_t c; // a floor result | 2865 int32_t c; // a floor result |
| 2866 int32_t d; // b floor result | 2866 int32_t d; // b floor result |
| 2867 }Test; | 2867 }Test; |
| 2868 const int kTableLength = 15; | 2868 const int kTableLength = 15; |
| 2869 double inputs_D[kTableLength] = { | 2869 double inputs_D[kTableLength] = { |
| 2870 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2870 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2908 CHECK_EQ(test.d, test.c); | 2908 CHECK_EQ(test.d, test.c); |
| 2909 } | 2909 } |
| 2910 } | 2910 } |
| 2911 | 2911 |
| 2912 | 2912 |
| 2913 TEST(ceil_l) { | 2913 TEST(ceil_l) { |
| 2914 if (IsFp64Mode()) { | 2914 if (IsFp64Mode()) { |
| 2915 CcTest::InitializeVM(); | 2915 CcTest::InitializeVM(); |
| 2916 Isolate* isolate = CcTest::i_isolate(); | 2916 Isolate* isolate = CcTest::i_isolate(); |
| 2917 HandleScope scope(isolate); | 2917 HandleScope scope(isolate); |
| 2918 MacroAssembler assm(isolate, NULL, 0); | 2918 MacroAssembler assm(isolate, NULL, 0, true); |
| 2919 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); | 2919 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); |
| 2920 typedef struct test_float { | 2920 typedef struct test_float { |
| 2921 double a; | 2921 double a; |
| 2922 float b; | 2922 float b; |
| 2923 int64_t c; | 2923 int64_t c; |
| 2924 int64_t d; | 2924 int64_t d; |
| 2925 }Test; | 2925 }Test; |
| 2926 const int kTableLength = 15; | 2926 const int kTableLength = 15; |
| 2927 double inputs_D[kTableLength] = { | 2927 double inputs_D[kTableLength] = { |
| 2928 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, | 2928 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 float fNegSubnorm; | 3257 float fNegSubnorm; |
| 3258 float fNegZero; | 3258 float fNegZero; |
| 3259 float fPosInf; | 3259 float fPosInf; |
| 3260 float fPosNorm; | 3260 float fPosNorm; |
| 3261 float fPosSubnorm; | 3261 float fPosSubnorm; |
| 3262 float fPosZero; } T; | 3262 float fPosZero; } T; |
| 3263 T t; | 3263 T t; |
| 3264 | 3264 |
| 3265 // Create a function that accepts &t, and loads, manipulates, and stores | 3265 // Create a function that accepts &t, and loads, manipulates, and stores |
| 3266 // the doubles t.a ... t.f. | 3266 // the doubles t.a ... t.f. |
| 3267 MacroAssembler assm(isolate, NULL, 0); | 3267 MacroAssembler assm(isolate, NULL, 0, true); |
| 3268 | 3268 |
| 3269 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan))); | 3269 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan))); |
| 3270 __ class_d(f6, f4); | 3270 __ class_d(f6, f4); |
| 3271 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan))); | 3271 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan))); |
| 3272 | 3272 |
| 3273 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan))); | 3273 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan))); |
| 3274 __ class_d(f6, f4); | 3274 __ class_d(f6, f4); |
| 3275 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan))); | 3275 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan))); |
| 3276 | 3276 |
| 3277 __ ldc1(f4, MemOperand(a0, offsetof(T, dNegInf))); | 3277 __ ldc1(f4, MemOperand(a0, offsetof(T, dNegInf))); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3405 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); | 3405 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); |
| 3406 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); | 3406 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); |
| 3407 } | 3407 } |
| 3408 } | 3408 } |
| 3409 | 3409 |
| 3410 | 3410 |
| 3411 TEST(ABS) { | 3411 TEST(ABS) { |
| 3412 CcTest::InitializeVM(); | 3412 CcTest::InitializeVM(); |
| 3413 Isolate* isolate = CcTest::i_isolate(); | 3413 Isolate* isolate = CcTest::i_isolate(); |
| 3414 HandleScope scope(isolate); | 3414 HandleScope scope(isolate); |
| 3415 MacroAssembler assm(isolate, NULL, 0); | 3415 MacroAssembler assm(isolate, NULL, 0, true); |
| 3416 | 3416 |
| 3417 typedef struct test_float { | 3417 typedef struct test_float { |
| 3418 int64_t fir; | 3418 int64_t fir; |
| 3419 double a; | 3419 double a; |
| 3420 float b; | 3420 float b; |
| 3421 double fcsr; | 3421 double fcsr; |
| 3422 } TestFloat; | 3422 } TestFloat; |
| 3423 | 3423 |
| 3424 TestFloat test; | 3424 TestFloat test; |
| 3425 | 3425 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3502 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 3502 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
| 3503 CHECK_EQ(std::isnan(test.a), true); | 3503 CHECK_EQ(std::isnan(test.a), true); |
| 3504 CHECK_EQ(std::isnan(test.b), true); | 3504 CHECK_EQ(std::isnan(test.b), true); |
| 3505 } | 3505 } |
| 3506 | 3506 |
| 3507 | 3507 |
| 3508 TEST(ADD_FMT) { | 3508 TEST(ADD_FMT) { |
| 3509 CcTest::InitializeVM(); | 3509 CcTest::InitializeVM(); |
| 3510 Isolate* isolate = CcTest::i_isolate(); | 3510 Isolate* isolate = CcTest::i_isolate(); |
| 3511 HandleScope scope(isolate); | 3511 HandleScope scope(isolate); |
| 3512 MacroAssembler assm(isolate, NULL, 0); | 3512 MacroAssembler assm(isolate, NULL, 0, true); |
| 3513 | 3513 |
| 3514 typedef struct test_float { | 3514 typedef struct test_float { |
| 3515 double a; | 3515 double a; |
| 3516 double b; | 3516 double b; |
| 3517 double c; | 3517 double c; |
| 3518 float fa; | 3518 float fa; |
| 3519 float fb; | 3519 float fb; |
| 3520 float fc; | 3520 float fc; |
| 3521 } TestFloat; | 3521 } TestFloat; |
| 3522 | 3522 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3572 CHECK_EQ(std::isnan(test.c), true); | 3572 CHECK_EQ(std::isnan(test.c), true); |
| 3573 CHECK_EQ(std::isnan(test.fc), true); | 3573 CHECK_EQ(std::isnan(test.fc), true); |
| 3574 } | 3574 } |
| 3575 | 3575 |
| 3576 | 3576 |
| 3577 TEST(C_COND_FMT) { | 3577 TEST(C_COND_FMT) { |
| 3578 if ((IsMipsArchVariant(kMips32r1)) || (IsMipsArchVariant(kMips32r2))) { | 3578 if ((IsMipsArchVariant(kMips32r1)) || (IsMipsArchVariant(kMips32r2))) { |
| 3579 CcTest::InitializeVM(); | 3579 CcTest::InitializeVM(); |
| 3580 Isolate* isolate = CcTest::i_isolate(); | 3580 Isolate* isolate = CcTest::i_isolate(); |
| 3581 HandleScope scope(isolate); | 3581 HandleScope scope(isolate); |
| 3582 MacroAssembler assm(isolate, NULL, 0); | 3582 MacroAssembler assm(isolate, NULL, 0, true); |
| 3583 | 3583 |
| 3584 typedef struct test_float { | 3584 typedef struct test_float { |
| 3585 double dOp1; | 3585 double dOp1; |
| 3586 double dOp2; | 3586 double dOp2; |
| 3587 uint32_t dF; | 3587 uint32_t dF; |
| 3588 uint32_t dUn; | 3588 uint32_t dUn; |
| 3589 uint32_t dEq; | 3589 uint32_t dEq; |
| 3590 uint32_t dUeq; | 3590 uint32_t dUeq; |
| 3591 uint32_t dOlt; | 3591 uint32_t dOlt; |
| 3592 uint32_t dUlt; | 3592 uint32_t dUlt; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3783 CHECK_EQ(test.fUle, 1U); | 3783 CHECK_EQ(test.fUle, 1U); |
| 3784 } | 3784 } |
| 3785 } | 3785 } |
| 3786 | 3786 |
| 3787 | 3787 |
| 3788 TEST(CMP_COND_FMT) { | 3788 TEST(CMP_COND_FMT) { |
| 3789 if (IsMipsArchVariant(kMips32r6)) { | 3789 if (IsMipsArchVariant(kMips32r6)) { |
| 3790 CcTest::InitializeVM(); | 3790 CcTest::InitializeVM(); |
| 3791 Isolate* isolate = CcTest::i_isolate(); | 3791 Isolate* isolate = CcTest::i_isolate(); |
| 3792 HandleScope scope(isolate); | 3792 HandleScope scope(isolate); |
| 3793 MacroAssembler assm(isolate, NULL, 0); | 3793 MacroAssembler assm(isolate, NULL, 0, true); |
| 3794 | 3794 |
| 3795 typedef struct test_float { | 3795 typedef struct test_float { |
| 3796 double dOp1; | 3796 double dOp1; |
| 3797 double dOp2; | 3797 double dOp2; |
| 3798 double dF; | 3798 double dF; |
| 3799 double dUn; | 3799 double dUn; |
| 3800 double dEq; | 3800 double dEq; |
| 3801 double dUeq; | 3801 double dUeq; |
| 3802 double dOlt; | 3802 double dOlt; |
| 3803 double dUlt; | 3803 double dUlt; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3999 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse); | 3999 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse); |
| 4000 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue); | 4000 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue); |
| 4001 } | 4001 } |
| 4002 } | 4002 } |
| 4003 | 4003 |
| 4004 | 4004 |
| 4005 TEST(CVT) { | 4005 TEST(CVT) { |
| 4006 CcTest::InitializeVM(); | 4006 CcTest::InitializeVM(); |
| 4007 Isolate* isolate = CcTest::i_isolate(); | 4007 Isolate* isolate = CcTest::i_isolate(); |
| 4008 HandleScope scope(isolate); | 4008 HandleScope scope(isolate); |
| 4009 MacroAssembler assm(isolate, NULL, 0); | 4009 MacroAssembler assm(isolate, NULL, 0, true); |
| 4010 | 4010 |
| 4011 typedef struct test_float { | 4011 typedef struct test_float { |
| 4012 float cvt_d_s_in; | 4012 float cvt_d_s_in; |
| 4013 double cvt_d_s_out; | 4013 double cvt_d_s_out; |
| 4014 int32_t cvt_d_w_in; | 4014 int32_t cvt_d_w_in; |
| 4015 double cvt_d_w_out; | 4015 double cvt_d_w_out; |
| 4016 int64_t cvt_d_l_in; | 4016 int64_t cvt_d_l_in; |
| 4017 double cvt_d_l_out; | 4017 double cvt_d_l_out; |
| 4018 | 4018 |
| 4019 float cvt_l_s_in; | 4019 float cvt_l_s_in; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4245 } | 4245 } |
| 4246 CHECK_EQ(test.cvt_w_s_out, 0); | 4246 CHECK_EQ(test.cvt_w_s_out, 0); |
| 4247 CHECK_EQ(test.cvt_w_d_out, 0); | 4247 CHECK_EQ(test.cvt_w_d_out, 0); |
| 4248 } | 4248 } |
| 4249 | 4249 |
| 4250 | 4250 |
| 4251 TEST(DIV_FMT) { | 4251 TEST(DIV_FMT) { |
| 4252 CcTest::InitializeVM(); | 4252 CcTest::InitializeVM(); |
| 4253 Isolate* isolate = CcTest::i_isolate(); | 4253 Isolate* isolate = CcTest::i_isolate(); |
| 4254 HandleScope scope(isolate); | 4254 HandleScope scope(isolate); |
| 4255 MacroAssembler assm(isolate, NULL, 0); | 4255 MacroAssembler assm(isolate, NULL, 0, true); |
| 4256 | 4256 |
| 4257 typedef struct test { | 4257 typedef struct test { |
| 4258 double dOp1; | 4258 double dOp1; |
| 4259 double dOp2; | 4259 double dOp2; |
| 4260 double dRes; | 4260 double dRes; |
| 4261 float fOp1; | 4261 float fOp1; |
| 4262 float fOp2; | 4262 float fOp2; |
| 4263 float fRes; | 4263 float fRes; |
| 4264 } Test; | 4264 } Test; |
| 4265 | 4265 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4367 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 4367 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
| 4368 CHECK_EQ(true, std::isnan(test.dRes)); | 4368 CHECK_EQ(true, std::isnan(test.dRes)); |
| 4369 CHECK_EQ(true, std::isnan(test.fRes)); | 4369 CHECK_EQ(true, std::isnan(test.fRes)); |
| 4370 } | 4370 } |
| 4371 | 4371 |
| 4372 | 4372 |
| 4373 uint32_t run_align(uint32_t rs_value, uint32_t rt_value, uint8_t bp) { | 4373 uint32_t run_align(uint32_t rs_value, uint32_t rt_value, uint8_t bp) { |
| 4374 Isolate* isolate = CcTest::i_isolate(); | 4374 Isolate* isolate = CcTest::i_isolate(); |
| 4375 HandleScope scope(isolate); | 4375 HandleScope scope(isolate); |
| 4376 | 4376 |
| 4377 MacroAssembler assm(isolate, NULL, 0); | 4377 MacroAssembler assm(isolate, NULL, 0, true); |
| 4378 | 4378 |
| 4379 __ align(v0, a0, a1, bp); | 4379 __ align(v0, a0, a1, bp); |
| 4380 __ jr(ra); | 4380 __ jr(ra); |
| 4381 __ nop(); | 4381 __ nop(); |
| 4382 | 4382 |
| 4383 CodeDesc desc; | 4383 CodeDesc desc; |
| 4384 assm.GetCode(&desc); | 4384 assm.GetCode(&desc); |
| 4385 Handle<Code> code = isolate->factory()->NewCode( | 4385 Handle<Code> code = isolate->factory()->NewCode( |
| 4386 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 4386 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 4387 | 4387 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4420 } | 4420 } |
| 4421 } | 4421 } |
| 4422 } | 4422 } |
| 4423 | 4423 |
| 4424 uint32_t PC; // The program counter. | 4424 uint32_t PC; // The program counter. |
| 4425 | 4425 |
| 4426 uint32_t run_aluipc(int16_t offset) { | 4426 uint32_t run_aluipc(int16_t offset) { |
| 4427 Isolate* isolate = CcTest::i_isolate(); | 4427 Isolate* isolate = CcTest::i_isolate(); |
| 4428 HandleScope scope(isolate); | 4428 HandleScope scope(isolate); |
| 4429 | 4429 |
| 4430 MacroAssembler assm(isolate, NULL, 0); | 4430 MacroAssembler assm(isolate, NULL, 0, true); |
| 4431 | 4431 |
| 4432 __ aluipc(v0, offset); | 4432 __ aluipc(v0, offset); |
| 4433 __ jr(ra); | 4433 __ jr(ra); |
| 4434 __ nop(); | 4434 __ nop(); |
| 4435 | 4435 |
| 4436 CodeDesc desc; | 4436 CodeDesc desc; |
| 4437 assm.GetCode(&desc); | 4437 assm.GetCode(&desc); |
| 4438 Handle<Code> code = isolate->factory()->NewCode( | 4438 Handle<Code> code = isolate->factory()->NewCode( |
| 4439 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 4439 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 4440 | 4440 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4474 CHECK_EQ(expected_res, res); | 4474 CHECK_EQ(expected_res, res); |
| 4475 } | 4475 } |
| 4476 } | 4476 } |
| 4477 } | 4477 } |
| 4478 | 4478 |
| 4479 | 4479 |
| 4480 uint32_t run_auipc(int16_t offset) { | 4480 uint32_t run_auipc(int16_t offset) { |
| 4481 Isolate* isolate = CcTest::i_isolate(); | 4481 Isolate* isolate = CcTest::i_isolate(); |
| 4482 HandleScope scope(isolate); | 4482 HandleScope scope(isolate); |
| 4483 | 4483 |
| 4484 MacroAssembler assm(isolate, NULL, 0); | 4484 MacroAssembler assm(isolate, NULL, 0, true); |
| 4485 | 4485 |
| 4486 __ auipc(v0, offset); | 4486 __ auipc(v0, offset); |
| 4487 __ jr(ra); | 4487 __ jr(ra); |
| 4488 __ nop(); | 4488 __ nop(); |
| 4489 | 4489 |
| 4490 CodeDesc desc; | 4490 CodeDesc desc; |
| 4491 assm.GetCode(&desc); | 4491 assm.GetCode(&desc); |
| 4492 Handle<Code> code = isolate->factory()->NewCode( | 4492 Handle<Code> code = isolate->factory()->NewCode( |
| 4493 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 4493 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 4494 | 4494 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4528 CHECK_EQ(expected_res, res); | 4528 CHECK_EQ(expected_res, res); |
| 4529 } | 4529 } |
| 4530 } | 4530 } |
| 4531 } | 4531 } |
| 4532 | 4532 |
| 4533 | 4533 |
| 4534 uint32_t run_lwpc(int offset) { | 4534 uint32_t run_lwpc(int offset) { |
| 4535 Isolate* isolate = CcTest::i_isolate(); | 4535 Isolate* isolate = CcTest::i_isolate(); |
| 4536 HandleScope scope(isolate); | 4536 HandleScope scope(isolate); |
| 4537 | 4537 |
| 4538 MacroAssembler assm(isolate, NULL, 0); | 4538 MacroAssembler assm(isolate, NULL, 0, true); |
| 4539 | 4539 |
| 4540 // 256k instructions; 2^8k | 4540 // 256k instructions; 2^8k |
| 4541 // addiu t7, t0, 0xffff; (0x250fffff) | 4541 // addiu t7, t0, 0xffff; (0x250fffff) |
| 4542 // ... | 4542 // ... |
| 4543 // addiu t4, t0, 0x0000; (0x250c0000) | 4543 // addiu t4, t0, 0x0000; (0x250c0000) |
| 4544 uint32_t addiu_start_1 = 0x25000000; | 4544 uint32_t addiu_start_1 = 0x25000000; |
| 4545 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { | 4545 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { |
| 4546 uint32_t addiu_new = addiu_start_1 + i; | 4546 uint32_t addiu_new = addiu_start_1 + i; |
| 4547 __ dd(addiu_new); | 4547 __ dd(addiu_new); |
| 4548 } | 4548 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4604 CHECK_EQ(tc[i].expected_res, res); | 4604 CHECK_EQ(tc[i].expected_res, res); |
| 4605 } | 4605 } |
| 4606 } | 4606 } |
| 4607 } | 4607 } |
| 4608 | 4608 |
| 4609 | 4609 |
| 4610 uint32_t run_jic(int16_t offset) { | 4610 uint32_t run_jic(int16_t offset) { |
| 4611 Isolate* isolate = CcTest::i_isolate(); | 4611 Isolate* isolate = CcTest::i_isolate(); |
| 4612 HandleScope scope(isolate); | 4612 HandleScope scope(isolate); |
| 4613 | 4613 |
| 4614 MacroAssembler assm(isolate, NULL, 0); | 4614 MacroAssembler assm(isolate, NULL, 0, true); |
| 4615 | 4615 |
| 4616 Label get_program_counter, stop_execution; | 4616 Label get_program_counter, stop_execution; |
| 4617 __ push(ra); | 4617 __ push(ra); |
| 4618 __ li(v0, 0); | 4618 __ li(v0, 0); |
| 4619 __ li(t1, 0x66); | 4619 __ li(t1, 0x66); |
| 4620 | 4620 |
| 4621 __ addiu(v0, v0, 0x1); // <-- offset = -32 | 4621 __ addiu(v0, v0, 0x1); // <-- offset = -32 |
| 4622 __ addiu(v0, v0, 0x2); | 4622 __ addiu(v0, v0, 0x2); |
| 4623 __ addiu(v0, v0, 0x10); | 4623 __ addiu(v0, v0, 0x10); |
| 4624 __ addiu(v0, v0, 0x20); | 4624 __ addiu(v0, v0, 0x20); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4685 CHECK_EQ(tc[i].expected_res, res); | 4685 CHECK_EQ(tc[i].expected_res, res); |
| 4686 } | 4686 } |
| 4687 } | 4687 } |
| 4688 } | 4688 } |
| 4689 | 4689 |
| 4690 | 4690 |
| 4691 uint64_t run_beqzc(int32_t value, int32_t offset) { | 4691 uint64_t run_beqzc(int32_t value, int32_t offset) { |
| 4692 Isolate* isolate = CcTest::i_isolate(); | 4692 Isolate* isolate = CcTest::i_isolate(); |
| 4693 HandleScope scope(isolate); | 4693 HandleScope scope(isolate); |
| 4694 | 4694 |
| 4695 MacroAssembler assm(isolate, NULL, 0); | 4695 MacroAssembler assm(isolate, NULL, 0, true); |
| 4696 | 4696 |
| 4697 Label stop_execution; | 4697 Label stop_execution; |
| 4698 __ li(v0, 0); | 4698 __ li(v0, 0); |
| 4699 __ li(t1, 0x66); | 4699 __ li(t1, 0x66); |
| 4700 | 4700 |
| 4701 __ addiu(v0, v0, 0x1); // <-- offset = -32 | 4701 __ addiu(v0, v0, 0x1); // <-- offset = -32 |
| 4702 __ addiu(v0, v0, 0x2); | 4702 __ addiu(v0, v0, 0x2); |
| 4703 __ addiu(v0, v0, 0x10); | 4703 __ addiu(v0, v0, 0x10); |
| 4704 __ addiu(v0, v0, 0x20); | 4704 __ addiu(v0, v0, 0x20); |
| 4705 __ beq(v0, t1, &stop_execution); | 4705 __ beq(v0, t1, &stop_execution); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4758 CHECK_EQ(tc[i].expected_res, res); | 4758 CHECK_EQ(tc[i].expected_res, res); |
| 4759 } | 4759 } |
| 4760 } | 4760 } |
| 4761 } | 4761 } |
| 4762 | 4762 |
| 4763 | 4763 |
| 4764 uint32_t run_jialc(int16_t offset) { | 4764 uint32_t run_jialc(int16_t offset) { |
| 4765 Isolate* isolate = CcTest::i_isolate(); | 4765 Isolate* isolate = CcTest::i_isolate(); |
| 4766 HandleScope scope(isolate); | 4766 HandleScope scope(isolate); |
| 4767 | 4767 |
| 4768 MacroAssembler assm(isolate, NULL, 0); | 4768 MacroAssembler assm(isolate, NULL, 0, true); |
| 4769 | 4769 |
| 4770 Label main_block, get_program_counter; | 4770 Label main_block, get_program_counter; |
| 4771 __ push(ra); | 4771 __ push(ra); |
| 4772 __ li(v0, 0); | 4772 __ li(v0, 0); |
| 4773 __ beq(v0, v0, &main_block); | 4773 __ beq(v0, v0, &main_block); |
| 4774 __ nop(); | 4774 __ nop(); |
| 4775 | 4775 |
| 4776 // Block 1 | 4776 // Block 1 |
| 4777 __ addiu(v0, v0, 0x1); // <-- offset = -40 | 4777 __ addiu(v0, v0, 0x1); // <-- offset = -40 |
| 4778 __ addiu(v0, v0, 0x2); | 4778 __ addiu(v0, v0, 0x2); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4850 CHECK_EQ(tc[i].expected_res, res); | 4850 CHECK_EQ(tc[i].expected_res, res); |
| 4851 } | 4851 } |
| 4852 } | 4852 } |
| 4853 } | 4853 } |
| 4854 | 4854 |
| 4855 | 4855 |
| 4856 uint64_t run_addiupc(int32_t imm19) { | 4856 uint64_t run_addiupc(int32_t imm19) { |
| 4857 Isolate* isolate = CcTest::i_isolate(); | 4857 Isolate* isolate = CcTest::i_isolate(); |
| 4858 HandleScope scope(isolate); | 4858 HandleScope scope(isolate); |
| 4859 | 4859 |
| 4860 MacroAssembler assm(isolate, NULL, 0); | 4860 MacroAssembler assm(isolate, NULL, 0, true); |
| 4861 | 4861 |
| 4862 __ addiupc(v0, imm19); | 4862 __ addiupc(v0, imm19); |
| 4863 __ jr(ra); | 4863 __ jr(ra); |
| 4864 __ nop(); | 4864 __ nop(); |
| 4865 | 4865 |
| 4866 CodeDesc desc; | 4866 CodeDesc desc; |
| 4867 assm.GetCode(&desc); | 4867 assm.GetCode(&desc); |
| 4868 Handle<Code> code = isolate->factory()->NewCode( | 4868 Handle<Code> code = isolate->factory()->NewCode( |
| 4869 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 4869 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 4870 | 4870 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4904 CHECK_EQ(expected_res, res); | 4904 CHECK_EQ(expected_res, res); |
| 4905 } | 4905 } |
| 4906 } | 4906 } |
| 4907 } | 4907 } |
| 4908 | 4908 |
| 4909 | 4909 |
| 4910 int32_t run_bc(int32_t offset) { | 4910 int32_t run_bc(int32_t offset) { |
| 4911 Isolate* isolate = CcTest::i_isolate(); | 4911 Isolate* isolate = CcTest::i_isolate(); |
| 4912 HandleScope scope(isolate); | 4912 HandleScope scope(isolate); |
| 4913 | 4913 |
| 4914 MacroAssembler assm(isolate, NULL, 0); | 4914 MacroAssembler assm(isolate, NULL, 0, true); |
| 4915 | 4915 |
| 4916 Label continue_1, stop_execution; | 4916 Label continue_1, stop_execution; |
| 4917 __ push(ra); | 4917 __ push(ra); |
| 4918 __ li(v0, 0); | 4918 __ li(v0, 0); |
| 4919 __ li(t8, 0); | 4919 __ li(t8, 0); |
| 4920 __ li(t9, 2); // A condition for stopping execution. | 4920 __ li(t9, 2); // A condition for stopping execution. |
| 4921 | 4921 |
| 4922 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 | 4922 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 |
| 4923 for (int32_t i = -100; i <= -11; ++i) { | 4923 for (int32_t i = -100; i <= -11; ++i) { |
| 4924 __ dd(instruction_addiu); | 4924 __ dd(instruction_addiu); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4985 CHECK_EQ(tc[i].expected_res, res); | 4985 CHECK_EQ(tc[i].expected_res, res); |
| 4986 } | 4986 } |
| 4987 } | 4987 } |
| 4988 } | 4988 } |
| 4989 | 4989 |
| 4990 | 4990 |
| 4991 int32_t run_balc(int32_t offset) { | 4991 int32_t run_balc(int32_t offset) { |
| 4992 Isolate* isolate = CcTest::i_isolate(); | 4992 Isolate* isolate = CcTest::i_isolate(); |
| 4993 HandleScope scope(isolate); | 4993 HandleScope scope(isolate); |
| 4994 | 4994 |
| 4995 MacroAssembler assm(isolate, NULL, 0); | 4995 MacroAssembler assm(isolate, NULL, 0, true); |
| 4996 | 4996 |
| 4997 Label continue_1, stop_execution; | 4997 Label continue_1, stop_execution; |
| 4998 __ push(ra); | 4998 __ push(ra); |
| 4999 __ li(v0, 0); | 4999 __ li(v0, 0); |
| 5000 __ li(t8, 0); | 5000 __ li(t8, 0); |
| 5001 __ li(t9, 2); // A condition for stopping execution. | 5001 __ li(t9, 2); // A condition for stopping execution. |
| 5002 | 5002 |
| 5003 __ beq(t8, t8, &continue_1); | 5003 __ beq(t8, t8, &continue_1); |
| 5004 __ nop(); | 5004 __ nop(); |
| 5005 | 5005 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5066 CHECK_EQ(tc[i].expected_res, res); | 5066 CHECK_EQ(tc[i].expected_res, res); |
| 5067 } | 5067 } |
| 5068 } | 5068 } |
| 5069 } | 5069 } |
| 5070 | 5070 |
| 5071 | 5071 |
| 5072 uint32_t run_bal(int16_t offset) { | 5072 uint32_t run_bal(int16_t offset) { |
| 5073 Isolate* isolate = CcTest::i_isolate(); | 5073 Isolate* isolate = CcTest::i_isolate(); |
| 5074 HandleScope scope(isolate); | 5074 HandleScope scope(isolate); |
| 5075 | 5075 |
| 5076 MacroAssembler assm(isolate, NULL, 0); | 5076 MacroAssembler assm(isolate, NULL, 0, true); |
| 5077 | 5077 |
| 5078 __ mov(t0, ra); | 5078 __ mov(t0, ra); |
| 5079 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset". | 5079 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset". |
| 5080 __ nop(); | 5080 __ nop(); |
| 5081 | 5081 |
| 5082 __ mov(ra, t0); | 5082 __ mov(ra, t0); |
| 5083 __ jr(ra); | 5083 __ jr(ra); |
| 5084 __ nop(); | 5084 __ nop(); |
| 5085 | 5085 |
| 5086 __ li(v0, 1); | 5086 __ li(v0, 1); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5122 | 5122 |
| 5123 | 5123 |
| 5124 TEST(Trampoline) { | 5124 TEST(Trampoline) { |
| 5125 // Private member of Assembler class. | 5125 // Private member of Assembler class. |
| 5126 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; | 5126 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 5127 | 5127 |
| 5128 CcTest::InitializeVM(); | 5128 CcTest::InitializeVM(); |
| 5129 Isolate* isolate = CcTest::i_isolate(); | 5129 Isolate* isolate = CcTest::i_isolate(); |
| 5130 HandleScope scope(isolate); | 5130 HandleScope scope(isolate); |
| 5131 | 5131 |
| 5132 MacroAssembler assm(isolate, nullptr, 0); | 5132 MacroAssembler assm(isolate, nullptr, 0, true); |
| 5133 Label done; | 5133 Label done; |
| 5134 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; | 5134 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; |
| 5135 | 5135 |
| 5136 for (size_t i = 0; i < nr_calls; ++i) { | 5136 for (size_t i = 0; i < nr_calls; ++i) { |
| 5137 __ BranchShort(&done, eq, a0, Operand(a1)); | 5137 __ BranchShort(&done, eq, a0, Operand(a1)); |
| 5138 } | 5138 } |
| 5139 __ bind(&done); | 5139 __ bind(&done); |
| 5140 __ Ret(USE_DELAY_SLOT); | 5140 __ Ret(USE_DELAY_SLOT); |
| 5141 __ mov(v0, zero_reg); | 5141 __ mov(v0, zero_reg); |
| 5142 | 5142 |
| 5143 CodeDesc desc; | 5143 CodeDesc desc; |
| 5144 assm.GetCode(&desc); | 5144 assm.GetCode(&desc); |
| 5145 Handle<Code> code = isolate->factory()->NewCode( | 5145 Handle<Code> code = isolate->factory()->NewCode( |
| 5146 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5146 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 5147 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5147 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 5148 | 5148 |
| 5149 int32_t res = reinterpret_cast<int32_t>( | 5149 int32_t res = reinterpret_cast<int32_t>( |
| 5150 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5150 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
| 5151 CHECK_EQ(res, 0); | 5151 CHECK_EQ(res, 0); |
| 5152 } | 5152 } |
| 5153 | 5153 |
| 5154 | 5154 |
| 5155 #undef __ | 5155 #undef __ |
| OLD | NEW |