Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: test/cctest/test-assembler-mips64.cc

Issue 1476763002: Make whether or not a Code object should be created by masm explicit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enum class FTW Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-assembler-mips.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, v8::internal::CodeObjectRequired::kYes);
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 int64_t res = reinterpret_cast<int64_t>( 75 int64_t res = reinterpret_cast<int64_t>(
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(0xabcL, res); 77 CHECK_EQ(0xabcL, 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, v8::internal::CodeObjectRequired::kYes);
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
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(1275L, res); 113 CHECK_EQ(1275L, 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, v8::internal::CodeObjectRequired::kYes);
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(a4, zero_reg, 0); 131 __ ori(a4, zero_reg, 0);
132 __ lui(a4, 0x1234); 132 __ lui(a4, 0x1234);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 float fc; 282 float fc;
283 float fd; 283 float fd;
284 float fe; 284 float fe;
285 float ff; 285 float ff;
286 float fg; 286 float fg;
287 } T; 287 } T;
288 T t; 288 T t;
289 289
290 // Create a function that accepts &t, and loads, manipulates, and stores 290 // Create a function that accepts &t, and loads, manipulates, and stores
291 // the doubles t.a ... t.f. 291 // the doubles t.a ... t.f.
292 MacroAssembler assm(isolate, NULL, 0); 292 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
293 Label L, C; 293 Label L, C;
294 294
295 // Double precision floating point instructions. 295 // Double precision floating point instructions.
296 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); 296 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) );
297 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); 297 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) );
298 __ add_d(f8, f4, f6); 298 __ add_d(f8, f4, f6);
299 __ sdc1(f8, MemOperand(a0, offsetof(T, c)) ); // c = a + b. 299 __ sdc1(f8, MemOperand(a0, offsetof(T, c)) ); // c = a + b.
300 300
301 __ mov_d(f10, f8); // c 301 __ mov_d(f10, f8); // c
302 __ neg_d(f12, f6); // -b 302 __ neg_d(f12, f6); // -b
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 double c; 621 double c;
622 double d; 622 double d;
623 double e; 623 double e;
624 double f; 624 double f;
625 int32_t result; 625 int32_t result;
626 } T; 626 } T;
627 T t; 627 T t;
628 628
629 // Create a function that accepts &t, and loads, manipulates, and stores 629 // Create a function that accepts &t, and loads, manipulates, and stores
630 // the doubles t.a ... t.f. 630 // the doubles t.a ... t.f.
631 MacroAssembler assm(isolate, NULL, 0); 631 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
632 Label neither_is_nan, less_than, outa_here; 632 Label neither_is_nan, less_than, outa_here;
633 633
634 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); 634 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) );
635 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); 635 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) );
636 if (kArchVariant != kMips64r6) { 636 if (kArchVariant != kMips64r6) {
637 __ c(UN, D, f4, f6); 637 __ c(UN, D, f4, f6);
638 __ bc1f(&neither_is_nan); 638 __ bc1f(&neither_is_nan);
639 } else { 639 } else {
640 __ cmp(UN, L, f2, f4, f6); 640 __ cmp(UN, L, f2, f4, f6);
641 __ bc1eqz(&neither_is_nan, f2); 641 __ bc1eqz(&neither_is_nan, f2);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 int32_t result_rotrv_4; 709 int32_t result_rotrv_4;
710 int32_t result_rotrv_8; 710 int32_t result_rotrv_8;
711 int32_t result_rotrv_12; 711 int32_t result_rotrv_12;
712 int32_t result_rotrv_16; 712 int32_t result_rotrv_16;
713 int32_t result_rotrv_20; 713 int32_t result_rotrv_20;
714 int32_t result_rotrv_24; 714 int32_t result_rotrv_24;
715 int32_t result_rotrv_28; 715 int32_t result_rotrv_28;
716 } T; 716 } T;
717 T t; 717 T t;
718 718
719 MacroAssembler assm(isolate, NULL, 0); 719 MacroAssembler assm(isolate, NULL, 0,
720 v8::internal::CodeObjectRequired::kYes);
720 721
721 // Basic word load. 722 // Basic word load.
722 __ lw(a4, MemOperand(a0, offsetof(T, input)) ); 723 __ lw(a4, MemOperand(a0, offsetof(T, input)) );
723 724
724 // ROTR instruction (called through the Ror macro). 725 // ROTR instruction (called through the Ror macro).
725 __ Ror(a5, a4, 0x0004); 726 __ Ror(a5, a4, 0x0004);
726 __ Ror(a6, a4, 0x0008); 727 __ Ror(a6, a4, 0x0008);
727 __ Ror(a7, a4, 0x000c); 728 __ Ror(a7, a4, 0x000c);
728 __ Ror(t0, a4, 0x0010); 729 __ Ror(t0, a4, 0x0010);
729 __ Ror(t1, a4, 0x0014); 730 __ Ror(t1, a4, 0x0014);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 794 }
794 } 795 }
795 796
796 797
797 TEST(MIPS9) { 798 TEST(MIPS9) {
798 // Test BRANCH improvements. 799 // Test BRANCH improvements.
799 CcTest::InitializeVM(); 800 CcTest::InitializeVM();
800 Isolate* isolate = CcTest::i_isolate(); 801 Isolate* isolate = CcTest::i_isolate();
801 HandleScope scope(isolate); 802 HandleScope scope(isolate);
802 803
803 MacroAssembler assm(isolate, NULL, 0); 804 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
804 Label exit, exit2, exit3; 805 Label exit, exit2, exit3;
805 806
806 __ Branch(&exit, ge, a0, Operand(zero_reg)); 807 __ Branch(&exit, ge, a0, Operand(zero_reg));
807 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); 808 __ Branch(&exit2, ge, a0, Operand(0x00001FFF));
808 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); 809 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF));
809 810
810 __ bind(&exit); 811 __ bind(&exit);
811 __ bind(&exit2); 812 __ bind(&exit2);
812 __ bind(&exit3); 813 __ bind(&exit3);
813 __ jr(ra); 814 __ jr(ra);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 typedef struct { 1091 typedef struct {
1091 int32_t x; 1092 int32_t x;
1092 int32_t y; 1093 int32_t y;
1093 int32_t y1; 1094 int32_t y1;
1094 int32_t y2; 1095 int32_t y2;
1095 int32_t y3; 1096 int32_t y3;
1096 int32_t y4; 1097 int32_t y4;
1097 } T; 1098 } T;
1098 T t; 1099 T t;
1099 1100
1100 MacroAssembler assm(isolate, NULL, 0); 1101 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
1101 1102
1102 __ mov(t2, fp); // Save frame pointer. 1103 __ mov(t2, fp); // Save frame pointer.
1103 __ mov(fp, a0); // Access struct T by fp. 1104 __ mov(fp, a0); // Access struct T by fp.
1104 __ lw(a4, MemOperand(a0, offsetof(T, y))); 1105 __ lw(a4, MemOperand(a0, offsetof(T, y)));
1105 __ lw(a7, MemOperand(a0, offsetof(T, y4))); 1106 __ lw(a7, MemOperand(a0, offsetof(T, y4)));
1106 1107
1107 __ addu(a5, a4, a7); 1108 __ addu(a5, a4, a7);
1108 __ subu(t0, a4, a7); 1109 __ subu(t0, a4, a7);
1109 __ nop(); 1110 __ nop();
1110 __ push(a4); // These instructions disappear after opt. 1111 __ push(a4); // These instructions disappear after opt.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 typedef struct { 1180 typedef struct {
1180 double cvt_big_out; 1181 double cvt_big_out;
1181 double cvt_small_out; 1182 double cvt_small_out;
1182 uint32_t trunc_big_out; 1183 uint32_t trunc_big_out;
1183 uint32_t trunc_small_out; 1184 uint32_t trunc_small_out;
1184 uint32_t cvt_big_in; 1185 uint32_t cvt_big_in;
1185 uint32_t cvt_small_in; 1186 uint32_t cvt_small_in;
1186 } T; 1187 } T;
1187 T t; 1188 T t;
1188 1189
1189 MacroAssembler assm(isolate, NULL, 0); 1190 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
1190 1191
1191 __ sw(a4, MemOperand(a0, offsetof(T, cvt_small_in))); 1192 __ sw(a4, MemOperand(a0, offsetof(T, cvt_small_in)));
1192 __ Cvt_d_uw(f10, a4); 1193 __ Cvt_d_uw(f10, a4);
1193 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out))); 1194 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out)));
1194 1195
1195 __ Trunc_uw_d(f10, f10, f4); 1196 __ Trunc_uw_d(f10, f10, f4);
1196 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out))); 1197 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out)));
1197 1198
1198 __ sw(a4, MemOperand(a0, offsetof(T, cvt_big_in))); 1199 __ sw(a4, MemOperand(a0, offsetof(T, cvt_big_in)));
1199 __ Cvt_d_uw(f8, a4); 1200 __ Cvt_d_uw(f8, a4);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 ROUND_STRUCT_ELEMENT(round) 1257 ROUND_STRUCT_ELEMENT(round)
1257 ROUND_STRUCT_ELEMENT(floor) 1258 ROUND_STRUCT_ELEMENT(floor)
1258 ROUND_STRUCT_ELEMENT(ceil) 1259 ROUND_STRUCT_ELEMENT(ceil)
1259 ROUND_STRUCT_ELEMENT(trunc) 1260 ROUND_STRUCT_ELEMENT(trunc)
1260 ROUND_STRUCT_ELEMENT(cvt) 1261 ROUND_STRUCT_ELEMENT(cvt)
1261 } T; 1262 } T;
1262 T t; 1263 T t;
1263 1264
1264 #undef ROUND_STRUCT_ELEMENT 1265 #undef ROUND_STRUCT_ELEMENT
1265 1266
1266 MacroAssembler assm(isolate, NULL, 0); 1267 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
1267 1268
1268 // Save FCSR. 1269 // Save FCSR.
1269 __ cfc1(a1, FCSR); 1270 __ cfc1(a1, FCSR);
1270 // Disable FPU exceptions. 1271 // Disable FPU exceptions.
1271 __ ctc1(zero_reg, FCSR); 1272 __ ctc1(zero_reg, FCSR);
1272 #define RUN_ROUND_TEST(x) \ 1273 #define RUN_ROUND_TEST(x) \
1273 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \ 1274 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \
1274 __ x##_w_d(f0, f0); \ 1275 __ x##_w_d(f0, f0); \
1275 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \ 1276 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \
1276 \ 1277 \
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); 1473 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6);
1473 } 1474 }
1474 1475
1475 1476
1476 // ----------------------mips64r6 specific tests---------------------- 1477 // ----------------------mips64r6 specific tests----------------------
1477 TEST(seleqz_selnez) { 1478 TEST(seleqz_selnez) {
1478 if (kArchVariant == kMips64r6) { 1479 if (kArchVariant == kMips64r6) {
1479 CcTest::InitializeVM(); 1480 CcTest::InitializeVM();
1480 Isolate* isolate = CcTest::i_isolate(); 1481 Isolate* isolate = CcTest::i_isolate();
1481 HandleScope scope(isolate); 1482 HandleScope scope(isolate);
1482 MacroAssembler assm(isolate, NULL, 0); 1483 MacroAssembler assm(isolate, NULL, 0,
1484 v8::internal::CodeObjectRequired::kYes);
1483 1485
1484 typedef struct test { 1486 typedef struct test {
1485 int a; 1487 int a;
1486 int b; 1488 int b;
1487 int c; 1489 int c;
1488 int d; 1490 int d;
1489 double e; 1491 double e;
1490 double f; 1492 double f;
1491 double g; 1493 double g;
1492 double h; 1494 double h;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 } 1576 }
1575 } 1577 }
1576 1578
1577 1579
1578 1580
1579 TEST(min_max) { 1581 TEST(min_max) {
1580 if (kArchVariant == kMips64r6) { 1582 if (kArchVariant == kMips64r6) {
1581 CcTest::InitializeVM(); 1583 CcTest::InitializeVM();
1582 Isolate* isolate = CcTest::i_isolate(); 1584 Isolate* isolate = CcTest::i_isolate();
1583 HandleScope scope(isolate); 1585 HandleScope scope(isolate);
1584 MacroAssembler assm(isolate, NULL, 0); 1586 MacroAssembler assm(isolate, NULL, 0,
1587 v8::internal::CodeObjectRequired::kYes);
1585 1588
1586 typedef struct test_float { 1589 typedef struct test_float {
1587 double a; 1590 double a;
1588 double b; 1591 double b;
1589 double c; 1592 double c;
1590 double d; 1593 double d;
1591 float e; 1594 float e;
1592 float f; 1595 float f;
1593 float g; 1596 float g;
1594 float h; 1597 float h;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 } 1654 }
1652 } 1655 }
1653 1656
1654 1657
1655 TEST(rint_d) { 1658 TEST(rint_d) {
1656 if (kArchVariant == kMips64r6) { 1659 if (kArchVariant == kMips64r6) {
1657 const int kTableLength = 30; 1660 const int kTableLength = 30;
1658 CcTest::InitializeVM(); 1661 CcTest::InitializeVM();
1659 Isolate* isolate = CcTest::i_isolate(); 1662 Isolate* isolate = CcTest::i_isolate();
1660 HandleScope scope(isolate); 1663 HandleScope scope(isolate);
1661 MacroAssembler assm(isolate, NULL, 0); 1664 MacroAssembler assm(isolate, NULL, 0,
1665 v8::internal::CodeObjectRequired::kYes);
1662 1666
1663 typedef struct test_float { 1667 typedef struct test_float {
1664 double a; 1668 double a;
1665 double b; 1669 double b;
1666 int fcsr; 1670 int fcsr;
1667 }TestFloat; 1671 }TestFloat;
1668 1672
1669 TestFloat test; 1673 TestFloat test;
1670 double inputs[kTableLength] = {18446744073709551617.0, 1674 double inputs[kTableLength] = {18446744073709551617.0,
1671 4503599627370496.0, -4503599627370496.0, 1675 4503599627370496.0, -4503599627370496.0,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 } 1758 }
1755 } 1759 }
1756 } 1760 }
1757 1761
1758 1762
1759 TEST(sel) { 1763 TEST(sel) {
1760 if (kArchVariant == kMips64r6) { 1764 if (kArchVariant == kMips64r6) {
1761 CcTest::InitializeVM(); 1765 CcTest::InitializeVM();
1762 Isolate* isolate = CcTest::i_isolate(); 1766 Isolate* isolate = CcTest::i_isolate();
1763 HandleScope scope(isolate); 1767 HandleScope scope(isolate);
1764 MacroAssembler assm(isolate, NULL, 0); 1768 MacroAssembler assm(isolate, NULL, 0,
1769 v8::internal::CodeObjectRequired::kYes);
1765 1770
1766 typedef struct test { 1771 typedef struct test {
1767 double dd; 1772 double dd;
1768 double ds; 1773 double ds;
1769 double dt; 1774 double dt;
1770 float fd; 1775 float fd;
1771 float fs; 1776 float fs;
1772 float ft; 1777 float ft;
1773 } Test; 1778 } Test;
1774 1779
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } 1833 }
1829 } 1834 }
1830 1835
1831 1836
1832 TEST(rint_s) { 1837 TEST(rint_s) {
1833 if (kArchVariant == kMips64r6) { 1838 if (kArchVariant == kMips64r6) {
1834 const int kTableLength = 30; 1839 const int kTableLength = 30;
1835 CcTest::InitializeVM(); 1840 CcTest::InitializeVM();
1836 Isolate* isolate = CcTest::i_isolate(); 1841 Isolate* isolate = CcTest::i_isolate();
1837 HandleScope scope(isolate); 1842 HandleScope scope(isolate);
1838 MacroAssembler assm(isolate, NULL, 0); 1843 MacroAssembler assm(isolate, NULL, 0,
1844 v8::internal::CodeObjectRequired::kYes);
1839 1845
1840 typedef struct test_float { 1846 typedef struct test_float {
1841 float a; 1847 float a;
1842 float b; 1848 float b;
1843 int fcsr; 1849 int fcsr;
1844 }TestFloat; 1850 }TestFloat;
1845 1851
1846 TestFloat test; 1852 TestFloat test;
1847 float inputs[kTableLength] = {18446744073709551617.0, 1853 float inputs[kTableLength] = {18446744073709551617.0,
1848 4503599627370496.0, -4503599627370496.0, 1854 4503599627370496.0, -4503599627370496.0,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 } 1940 }
1935 } 1941 }
1936 1942
1937 1943
1938 TEST(mina_maxa) { 1944 TEST(mina_maxa) {
1939 if (kArchVariant == kMips64r6) { 1945 if (kArchVariant == kMips64r6) {
1940 const int kTableLength = 15; 1946 const int kTableLength = 15;
1941 CcTest::InitializeVM(); 1947 CcTest::InitializeVM();
1942 Isolate* isolate = CcTest::i_isolate(); 1948 Isolate* isolate = CcTest::i_isolate();
1943 HandleScope scope(isolate); 1949 HandleScope scope(isolate);
1944 MacroAssembler assm(isolate, NULL, 0); 1950 MacroAssembler assm(isolate, NULL, 0,
1951 v8::internal::CodeObjectRequired::kYes);
1945 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1952 const double double_nan = std::numeric_limits<double>::quiet_NaN();
1946 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1953 const float float_nan = std::numeric_limits<float>::quiet_NaN();
1947 1954
1948 typedef struct test_float { 1955 typedef struct test_float {
1949 double a; 1956 double a;
1950 double b; 1957 double b;
1951 double resd; 1958 double resd;
1952 double resd1; 1959 double resd1;
1953 float c; 1960 float c;
1954 float d; 1961 float d;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 } 2040 }
2034 2041
2035 2042
2036 2043
2037 // ----------------------mips64r2 specific tests---------------------- 2044 // ----------------------mips64r2 specific tests----------------------
2038 TEST(trunc_l) { 2045 TEST(trunc_l) {
2039 if (kArchVariant == kMips64r2) { 2046 if (kArchVariant == kMips64r2) {
2040 CcTest::InitializeVM(); 2047 CcTest::InitializeVM();
2041 Isolate* isolate = CcTest::i_isolate(); 2048 Isolate* isolate = CcTest::i_isolate();
2042 HandleScope scope(isolate); 2049 HandleScope scope(isolate);
2043 MacroAssembler assm(isolate, NULL, 0); 2050 MacroAssembler assm(isolate, NULL, 0,
2051 v8::internal::CodeObjectRequired::kYes);
2044 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2052 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2045 typedef struct test_float { 2053 typedef struct test_float {
2046 double a; 2054 double a;
2047 float b; 2055 float b;
2048 int64_t c; // a trunc result 2056 int64_t c; // a trunc result
2049 int64_t d; // b trunc result 2057 int64_t d; // b trunc result
2050 }Test; 2058 }Test;
2051 const int kTableLength = 15; 2059 const int kTableLength = 15;
2052 double inputs_D[kTableLength] = { 2060 double inputs_D[kTableLength] = {
2053 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2061 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 } 2101 }
2094 } 2102 }
2095 2103
2096 2104
2097 TEST(movz_movn) { 2105 TEST(movz_movn) {
2098 if (kArchVariant == kMips64r2) { 2106 if (kArchVariant == kMips64r2) {
2099 const int kTableLength = 4; 2107 const int kTableLength = 4;
2100 CcTest::InitializeVM(); 2108 CcTest::InitializeVM();
2101 Isolate* isolate = CcTest::i_isolate(); 2109 Isolate* isolate = CcTest::i_isolate();
2102 HandleScope scope(isolate); 2110 HandleScope scope(isolate);
2103 MacroAssembler assm(isolate, NULL, 0); 2111 MacroAssembler assm(isolate, NULL, 0,
2112 v8::internal::CodeObjectRequired::kYes);
2104 2113
2105 typedef struct test_float { 2114 typedef struct test_float {
2106 int64_t rt; 2115 int64_t rt;
2107 double a; 2116 double a;
2108 double b; 2117 double b;
2109 double bold; 2118 double bold;
2110 double b1; 2119 double b1;
2111 double bold1; 2120 double bold1;
2112 float c; 2121 float c;
2113 float d; 2122 float d;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 test.srcf = inputs_S[i]; 2230 test.srcf = inputs_S[i];
2222 2231
2223 for (int j = 0; j< 8; j++) { 2232 for (int j = 0; j< 8; j++) {
2224 test.cc = condition_flags[j]; 2233 test.cc = condition_flags[j];
2225 if (test.cc == 0) { 2234 if (test.cc == 0) {
2226 test.fcsr = 1 << 23; 2235 test.fcsr = 1 << 23;
2227 } else { 2236 } else {
2228 test.fcsr = 1 << (24+condition_flags[j]); 2237 test.fcsr = 1 << (24+condition_flags[j]);
2229 } 2238 }
2230 HandleScope scope(isolate); 2239 HandleScope scope(isolate);
2231 MacroAssembler assm(isolate, NULL, 0); 2240 MacroAssembler assm(isolate, NULL, 0,
2241 v8::internal::CodeObjectRequired::kYes);
2232 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) ); 2242 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) );
2233 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) ); 2243 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) );
2234 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) ); 2244 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) );
2235 __ cfc1(t0, FCSR); 2245 __ cfc1(t0, FCSR);
2236 __ ctc1(t1, FCSR); 2246 __ ctc1(t1, FCSR);
2237 __ li(t2, 0x0); 2247 __ li(t2, 0x0);
2238 __ mtc1(t2, f12); 2248 __ mtc1(t2, f12);
2239 __ mtc1(t2, f10); 2249 __ mtc1(t2, f10);
2240 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) ); 2250 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) );
2241 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) ); 2251 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) );
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 } 2285 }
2276 } 2286 }
2277 2287
2278 2288
2279 2289
2280 // ----------------------tests for all archs-------------------------- 2290 // ----------------------tests for all archs--------------------------
2281 TEST(cvt_w_d) { 2291 TEST(cvt_w_d) {
2282 CcTest::InitializeVM(); 2292 CcTest::InitializeVM();
2283 Isolate* isolate = CcTest::i_isolate(); 2293 Isolate* isolate = CcTest::i_isolate();
2284 HandleScope scope(isolate); 2294 HandleScope scope(isolate);
2285 MacroAssembler assm(isolate, NULL, 0); 2295 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2286 2296
2287 typedef struct test_float { 2297 typedef struct test_float {
2288 double a; 2298 double a;
2289 int32_t b; 2299 int32_t b;
2290 int fcsr; 2300 int fcsr;
2291 }Test; 2301 }Test;
2292 const int kTableLength = 24; 2302 const int kTableLength = 24;
2293 double inputs[kTableLength] = { 2303 double inputs[kTableLength] = {
2294 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2304 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
2295 -2.1, -2.6, -2.5, -3.1, -3.6, -3.5, 2305 -2.1, -2.6, -2.5, -3.1, -3.6, -3.5,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 CHECK_EQ(test.b, outputs[j][i]); 2362 CHECK_EQ(test.b, outputs[j][i]);
2353 } 2363 }
2354 } 2364 }
2355 } 2365 }
2356 2366
2357 2367
2358 TEST(trunc_w) { 2368 TEST(trunc_w) {
2359 CcTest::InitializeVM(); 2369 CcTest::InitializeVM();
2360 Isolate* isolate = CcTest::i_isolate(); 2370 Isolate* isolate = CcTest::i_isolate();
2361 HandleScope scope(isolate); 2371 HandleScope scope(isolate);
2362 MacroAssembler assm(isolate, NULL, 0); 2372 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2363 2373
2364 typedef struct test_float { 2374 typedef struct test_float {
2365 double a; 2375 double a;
2366 float b; 2376 float b;
2367 int32_t c; // a trunc result 2377 int32_t c; // a trunc result
2368 int32_t d; // b trunc result 2378 int32_t d; // b trunc result
2369 }Test; 2379 }Test;
2370 const int kTableLength = 15; 2380 const int kTableLength = 15;
2371 double inputs_D[kTableLength] = { 2381 double inputs_D[kTableLength] = {
2372 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2382 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 CHECK_EQ(test.c, outputs[i]); 2419 CHECK_EQ(test.c, outputs[i]);
2410 CHECK_EQ(test.d, test.c); 2420 CHECK_EQ(test.d, test.c);
2411 } 2421 }
2412 } 2422 }
2413 2423
2414 2424
2415 TEST(round_w) { 2425 TEST(round_w) {
2416 CcTest::InitializeVM(); 2426 CcTest::InitializeVM();
2417 Isolate* isolate = CcTest::i_isolate(); 2427 Isolate* isolate = CcTest::i_isolate();
2418 HandleScope scope(isolate); 2428 HandleScope scope(isolate);
2419 MacroAssembler assm(isolate, NULL, 0); 2429 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2420 2430
2421 typedef struct test_float { 2431 typedef struct test_float {
2422 double a; 2432 double a;
2423 float b; 2433 float b;
2424 int32_t c; // a trunc result 2434 int32_t c; // a trunc result
2425 int32_t d; // b trunc result 2435 int32_t d; // b trunc result
2426 }Test; 2436 }Test;
2427 const int kTableLength = 15; 2437 const int kTableLength = 15;
2428 double inputs_D[kTableLength] = { 2438 double inputs_D[kTableLength] = {
2429 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2439 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 CHECK_EQ(test.c, outputs[i]); 2476 CHECK_EQ(test.c, outputs[i]);
2467 CHECK_EQ(test.d, test.c); 2477 CHECK_EQ(test.d, test.c);
2468 } 2478 }
2469 } 2479 }
2470 2480
2471 2481
2472 TEST(round_l) { 2482 TEST(round_l) {
2473 CcTest::InitializeVM(); 2483 CcTest::InitializeVM();
2474 Isolate* isolate = CcTest::i_isolate(); 2484 Isolate* isolate = CcTest::i_isolate();
2475 HandleScope scope(isolate); 2485 HandleScope scope(isolate);
2476 MacroAssembler assm(isolate, NULL, 0); 2486 MacroAssembler assm(isolate, NULL, 0,
2487 v8::internal::CodeObjectRequired::kYes);
2477 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2488 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2478 typedef struct test_float { 2489 typedef struct test_float {
2479 double a; 2490 double a;
2480 float b; 2491 float b;
2481 int64_t c; 2492 int64_t c;
2482 int64_t d; 2493 int64_t d;
2483 }Test; 2494 }Test;
2484 const int kTableLength = 15; 2495 const int kTableLength = 15;
2485 double inputs_D[kTableLength] = { 2496 double inputs_D[kTableLength] = {
2486 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2497 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 CHECK_EQ(test.d, test.c); 2536 CHECK_EQ(test.d, test.c);
2526 } 2537 }
2527 } 2538 }
2528 2539
2529 2540
2530 TEST(sub) { 2541 TEST(sub) {
2531 const int kTableLength = 12; 2542 const int kTableLength = 12;
2532 CcTest::InitializeVM(); 2543 CcTest::InitializeVM();
2533 Isolate* isolate = CcTest::i_isolate(); 2544 Isolate* isolate = CcTest::i_isolate();
2534 HandleScope scope(isolate); 2545 HandleScope scope(isolate);
2535 MacroAssembler assm(isolate, NULL, 0); 2546 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2536 2547
2537 typedef struct test_float { 2548 typedef struct test_float {
2538 float a; 2549 float a;
2539 float b; 2550 float b;
2540 float resultS; 2551 float resultS;
2541 double c; 2552 double c;
2542 double d; 2553 double d;
2543 double resultD; 2554 double resultD;
2544 }TestFloat; 2555 }TestFloat;
2545 2556
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 2609
2599 TEST(sqrt_rsqrt_recip) { 2610 TEST(sqrt_rsqrt_recip) {
2600 const int kTableLength = 4; 2611 const int kTableLength = 4;
2601 const double deltaDouble = 2E-15; 2612 const double deltaDouble = 2E-15;
2602 const float deltaFloat = 2E-7; 2613 const float deltaFloat = 2E-7;
2603 const float sqrt2_s = sqrt(2); 2614 const float sqrt2_s = sqrt(2);
2604 const double sqrt2_d = sqrt(2); 2615 const double sqrt2_d = sqrt(2);
2605 CcTest::InitializeVM(); 2616 CcTest::InitializeVM();
2606 Isolate* isolate = CcTest::i_isolate(); 2617 Isolate* isolate = CcTest::i_isolate();
2607 HandleScope scope(isolate); 2618 HandleScope scope(isolate);
2608 MacroAssembler assm(isolate, NULL, 0); 2619 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2609 2620
2610 typedef struct test_float { 2621 typedef struct test_float {
2611 float a; 2622 float a;
2612 float resultS; 2623 float resultS;
2613 float resultS1; 2624 float resultS1;
2614 float resultS2; 2625 float resultS2;
2615 double c; 2626 double c;
2616 double resultD; 2627 double resultD;
2617 double resultD1; 2628 double resultD1;
2618 double resultD2; 2629 double resultD2;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 } 2701 }
2691 } 2702 }
2692 } 2703 }
2693 2704
2694 2705
2695 TEST(neg) { 2706 TEST(neg) {
2696 const int kTableLength = 2; 2707 const int kTableLength = 2;
2697 CcTest::InitializeVM(); 2708 CcTest::InitializeVM();
2698 Isolate* isolate = CcTest::i_isolate(); 2709 Isolate* isolate = CcTest::i_isolate();
2699 HandleScope scope(isolate); 2710 HandleScope scope(isolate);
2700 MacroAssembler assm(isolate, NULL, 0); 2711 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2701 2712
2702 typedef struct test_float { 2713 typedef struct test_float {
2703 float a; 2714 float a;
2704 float resultS; 2715 float resultS;
2705 double c; 2716 double c;
2706 double resultD; 2717 double resultD;
2707 }TestFloat; 2718 }TestFloat;
2708 2719
2709 TestFloat test; 2720 TestFloat test;
2710 double inputs_D[kTableLength] = { 2721 double inputs_D[kTableLength] = {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 } 2755 }
2745 } 2756 }
2746 2757
2747 2758
2748 2759
2749 TEST(mul) { 2760 TEST(mul) {
2750 const int kTableLength = 4; 2761 const int kTableLength = 4;
2751 CcTest::InitializeVM(); 2762 CcTest::InitializeVM();
2752 Isolate* isolate = CcTest::i_isolate(); 2763 Isolate* isolate = CcTest::i_isolate();
2753 HandleScope scope(isolate); 2764 HandleScope scope(isolate);
2754 MacroAssembler assm(isolate, NULL, 0); 2765 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2755 2766
2756 typedef struct test_float { 2767 typedef struct test_float {
2757 float a; 2768 float a;
2758 float b; 2769 float b;
2759 float resultS; 2770 float resultS;
2760 double c; 2771 double c;
2761 double d; 2772 double d;
2762 double resultD; 2773 double resultD;
2763 }TestFloat; 2774 }TestFloat;
2764 2775
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); 2814 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]);
2804 } 2815 }
2805 } 2816 }
2806 2817
2807 2818
2808 TEST(mov) { 2819 TEST(mov) {
2809 const int kTableLength = 4; 2820 const int kTableLength = 4;
2810 CcTest::InitializeVM(); 2821 CcTest::InitializeVM();
2811 Isolate* isolate = CcTest::i_isolate(); 2822 Isolate* isolate = CcTest::i_isolate();
2812 HandleScope scope(isolate); 2823 HandleScope scope(isolate);
2813 MacroAssembler assm(isolate, NULL, 0); 2824 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2814 2825
2815 typedef struct test_float { 2826 typedef struct test_float {
2816 double a; 2827 double a;
2817 double b; 2828 double b;
2818 float c; 2829 float c;
2819 float d; 2830 float d;
2820 }TestFloat; 2831 }TestFloat;
2821 2832
2822 TestFloat test; 2833 TestFloat test;
2823 double inputs_D[kTableLength] = { 2834 double inputs_D[kTableLength] = {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 CHECK_EQ(test.b, outputs_D[i]); 2867 CHECK_EQ(test.b, outputs_D[i]);
2857 CHECK_EQ(test.d, outputs_S[i]); 2868 CHECK_EQ(test.d, outputs_S[i]);
2858 } 2869 }
2859 } 2870 }
2860 2871
2861 2872
2862 TEST(floor_w) { 2873 TEST(floor_w) {
2863 CcTest::InitializeVM(); 2874 CcTest::InitializeVM();
2864 Isolate* isolate = CcTest::i_isolate(); 2875 Isolate* isolate = CcTest::i_isolate();
2865 HandleScope scope(isolate); 2876 HandleScope scope(isolate);
2866 MacroAssembler assm(isolate, NULL, 0); 2877 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2867 2878
2868 typedef struct test_float { 2879 typedef struct test_float {
2869 double a; 2880 double a;
2870 float b; 2881 float b;
2871 int32_t c; // a floor result 2882 int32_t c; // a floor result
2872 int32_t d; // b floor result 2883 int32_t d; // b floor result
2873 }Test; 2884 }Test;
2874 const int kTableLength = 15; 2885 const int kTableLength = 15;
2875 double inputs_D[kTableLength] = { 2886 double inputs_D[kTableLength] = {
2876 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2887 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 CHECK_EQ(test.c, outputs[i]); 2924 CHECK_EQ(test.c, outputs[i]);
2914 CHECK_EQ(test.d, test.c); 2925 CHECK_EQ(test.d, test.c);
2915 } 2926 }
2916 } 2927 }
2917 2928
2918 2929
2919 TEST(floor_l) { 2930 TEST(floor_l) {
2920 CcTest::InitializeVM(); 2931 CcTest::InitializeVM();
2921 Isolate* isolate = CcTest::i_isolate(); 2932 Isolate* isolate = CcTest::i_isolate();
2922 HandleScope scope(isolate); 2933 HandleScope scope(isolate);
2923 MacroAssembler assm(isolate, NULL, 0); 2934 MacroAssembler assm(isolate, NULL, 0,
2935 v8::internal::CodeObjectRequired::kYes);
2924 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2936 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2925 typedef struct test_float { 2937 typedef struct test_float {
2926 double a; 2938 double a;
2927 float b; 2939 float b;
2928 int64_t c; 2940 int64_t c;
2929 int64_t d; 2941 int64_t d;
2930 }Test; 2942 }Test;
2931 const int kTableLength = 15; 2943 const int kTableLength = 15;
2932 double inputs_D[kTableLength] = { 2944 double inputs_D[kTableLength] = {
2933 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2945 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 CHECK_EQ(test.c, outputs[i]); 2982 CHECK_EQ(test.c, outputs[i]);
2971 CHECK_EQ(test.d, test.c); 2983 CHECK_EQ(test.d, test.c);
2972 } 2984 }
2973 } 2985 }
2974 2986
2975 2987
2976 TEST(ceil_w) { 2988 TEST(ceil_w) {
2977 CcTest::InitializeVM(); 2989 CcTest::InitializeVM();
2978 Isolate* isolate = CcTest::i_isolate(); 2990 Isolate* isolate = CcTest::i_isolate();
2979 HandleScope scope(isolate); 2991 HandleScope scope(isolate);
2980 MacroAssembler assm(isolate, NULL, 0); 2992 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
2981 2993
2982 typedef struct test_float { 2994 typedef struct test_float {
2983 double a; 2995 double a;
2984 float b; 2996 float b;
2985 int32_t c; // a floor result 2997 int32_t c; // a floor result
2986 int32_t d; // b floor result 2998 int32_t d; // b floor result
2987 }Test; 2999 }Test;
2988 const int kTableLength = 15; 3000 const int kTableLength = 15;
2989 double inputs_D[kTableLength] = { 3001 double inputs_D[kTableLength] = {
2990 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 3002 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 CHECK_EQ(test.c, outputs[i]); 3039 CHECK_EQ(test.c, outputs[i]);
3028 CHECK_EQ(test.d, test.c); 3040 CHECK_EQ(test.d, test.c);
3029 } 3041 }
3030 } 3042 }
3031 3043
3032 3044
3033 TEST(ceil_l) { 3045 TEST(ceil_l) {
3034 CcTest::InitializeVM(); 3046 CcTest::InitializeVM();
3035 Isolate* isolate = CcTest::i_isolate(); 3047 Isolate* isolate = CcTest::i_isolate();
3036 HandleScope scope(isolate); 3048 HandleScope scope(isolate);
3037 MacroAssembler assm(isolate, NULL, 0); 3049 MacroAssembler assm(isolate, NULL, 0,
3050 v8::internal::CodeObjectRequired::kYes);
3038 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 3051 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
3039 typedef struct test_float { 3052 typedef struct test_float {
3040 double a; 3053 double a;
3041 float b; 3054 float b;
3042 int64_t c; 3055 int64_t c;
3043 int64_t d; 3056 int64_t d;
3044 }Test; 3057 }Test;
3045 const int kTableLength = 15; 3058 const int kTableLength = 15;
3046 double inputs_D[kTableLength] = { 3059 double inputs_D[kTableLength] = {
3047 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 3060 2.1, 2.6, 2.5, 3.1, 3.6, 3.5,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 float fNegSubnorm; 3430 float fNegSubnorm;
3418 float fNegZero; 3431 float fNegZero;
3419 float fPosInf; 3432 float fPosInf;
3420 float fPosNorm; 3433 float fPosNorm;
3421 float fPosSubnorm; 3434 float fPosSubnorm;
3422 float fPosZero; } T; 3435 float fPosZero; } T;
3423 T t; 3436 T t;
3424 3437
3425 // Create a function that accepts &t, and loads, manipulates, and stores 3438 // Create a function that accepts &t, and loads, manipulates, and stores
3426 // the doubles t.a ... t.f. 3439 // the doubles t.a ... t.f.
3427 MacroAssembler assm(isolate, NULL, 0); 3440 MacroAssembler assm(isolate, NULL, 0,
3441 v8::internal::CodeObjectRequired::kYes);
3428 3442
3429 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan))); 3443 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan)));
3430 __ class_d(f6, f4); 3444 __ class_d(f6, f4);
3431 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan))); 3445 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan)));
3432 3446
3433 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan))); 3447 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan)));
3434 __ class_d(f6, f4); 3448 __ class_d(f6, f4);
3435 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan))); 3449 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan)));
3436 3450
3437 __ ldc1(f4, MemOperand(a0, offsetof(T, dNegInf))); 3451 __ ldc1(f4, MemOperand(a0, offsetof(T, dNegInf)));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3566 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100); 3580 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100);
3567 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); 3581 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200);
3568 } 3582 }
3569 } 3583 }
3570 3584
3571 3585
3572 TEST(ABS) { 3586 TEST(ABS) {
3573 CcTest::InitializeVM(); 3587 CcTest::InitializeVM();
3574 Isolate* isolate = CcTest::i_isolate(); 3588 Isolate* isolate = CcTest::i_isolate();
3575 HandleScope scope(isolate); 3589 HandleScope scope(isolate);
3576 MacroAssembler assm(isolate, NULL, 0); 3590 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
3577 3591
3578 typedef struct test_float { 3592 typedef struct test_float {
3579 int64_t fir; 3593 int64_t fir;
3580 double a; 3594 double a;
3581 float b; 3595 float b;
3582 double fcsr; 3596 double fcsr;
3583 } TestFloat; 3597 } TestFloat;
3584 3598
3585 TestFloat test; 3599 TestFloat test;
3586 3600
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 3678 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
3665 CHECK_EQ(std::isnan(test.a), true); 3679 CHECK_EQ(std::isnan(test.a), true);
3666 CHECK_EQ(std::isnan(test.b), true); 3680 CHECK_EQ(std::isnan(test.b), true);
3667 } 3681 }
3668 3682
3669 3683
3670 TEST(ADD_FMT) { 3684 TEST(ADD_FMT) {
3671 CcTest::InitializeVM(); 3685 CcTest::InitializeVM();
3672 Isolate* isolate = CcTest::i_isolate(); 3686 Isolate* isolate = CcTest::i_isolate();
3673 HandleScope scope(isolate); 3687 HandleScope scope(isolate);
3674 MacroAssembler assm(isolate, NULL, 0); 3688 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
3675 3689
3676 typedef struct test_float { 3690 typedef struct test_float {
3677 double a; 3691 double a;
3678 double b; 3692 double b;
3679 double c; 3693 double c;
3680 float fa; 3694 float fa;
3681 float fb; 3695 float fb;
3682 float fc; 3696 float fc;
3683 } TestFloat; 3697 } TestFloat;
3684 3698
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 CHECK_EQ(std::isnan(test.c), true); 3748 CHECK_EQ(std::isnan(test.c), true);
3735 CHECK_EQ(std::isnan(test.fc), true); 3749 CHECK_EQ(std::isnan(test.fc), true);
3736 } 3750 }
3737 3751
3738 3752
3739 TEST(C_COND_FMT) { 3753 TEST(C_COND_FMT) {
3740 if (kArchVariant == kMips64r2) { 3754 if (kArchVariant == kMips64r2) {
3741 CcTest::InitializeVM(); 3755 CcTest::InitializeVM();
3742 Isolate* isolate = CcTest::i_isolate(); 3756 Isolate* isolate = CcTest::i_isolate();
3743 HandleScope scope(isolate); 3757 HandleScope scope(isolate);
3744 MacroAssembler assm(isolate, NULL, 0); 3758 MacroAssembler assm(isolate, NULL, 0,
3759 v8::internal::CodeObjectRequired::kYes);
3745 3760
3746 typedef struct test_float { 3761 typedef struct test_float {
3747 double dOp1; 3762 double dOp1;
3748 double dOp2; 3763 double dOp2;
3749 uint32_t dF; 3764 uint32_t dF;
3750 uint32_t dUn; 3765 uint32_t dUn;
3751 uint32_t dEq; 3766 uint32_t dEq;
3752 uint32_t dUeq; 3767 uint32_t dUeq;
3753 uint32_t dOlt; 3768 uint32_t dOlt;
3754 uint32_t dUlt; 3769 uint32_t dUlt;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 CHECK_EQ(test.fUle, 1U); 3960 CHECK_EQ(test.fUle, 1U);
3946 } 3961 }
3947 } 3962 }
3948 3963
3949 3964
3950 TEST(CMP_COND_FMT) { 3965 TEST(CMP_COND_FMT) {
3951 if (kArchVariant == kMips64r6) { 3966 if (kArchVariant == kMips64r6) {
3952 CcTest::InitializeVM(); 3967 CcTest::InitializeVM();
3953 Isolate* isolate = CcTest::i_isolate(); 3968 Isolate* isolate = CcTest::i_isolate();
3954 HandleScope scope(isolate); 3969 HandleScope scope(isolate);
3955 MacroAssembler assm(isolate, NULL, 0); 3970 MacroAssembler assm(isolate, NULL, 0,
3971 v8::internal::CodeObjectRequired::kYes);
3956 3972
3957 typedef struct test_float { 3973 typedef struct test_float {
3958 double dOp1; 3974 double dOp1;
3959 double dOp2; 3975 double dOp2;
3960 double dF; 3976 double dF;
3961 double dUn; 3977 double dUn;
3962 double dEq; 3978 double dEq;
3963 double dUeq; 3979 double dUeq;
3964 double dOlt; 3980 double dOlt;
3965 double dUlt; 3981 double dUlt;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
4161 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse); 4177 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse);
4162 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue); 4178 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue);
4163 } 4179 }
4164 } 4180 }
4165 4181
4166 4182
4167 TEST(CVT) { 4183 TEST(CVT) {
4168 CcTest::InitializeVM(); 4184 CcTest::InitializeVM();
4169 Isolate* isolate = CcTest::i_isolate(); 4185 Isolate* isolate = CcTest::i_isolate();
4170 HandleScope scope(isolate); 4186 HandleScope scope(isolate);
4171 MacroAssembler assm(isolate, NULL, 0); 4187 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4172 4188
4173 typedef struct test_float { 4189 typedef struct test_float {
4174 float cvt_d_s_in; 4190 float cvt_d_s_in;
4175 double cvt_d_s_out; 4191 double cvt_d_s_out;
4176 int32_t cvt_d_w_in; 4192 int32_t cvt_d_w_in;
4177 double cvt_d_w_out; 4193 double cvt_d_w_out;
4178 int64_t cvt_d_l_in; 4194 int64_t cvt_d_l_in;
4179 double cvt_d_l_out; 4195 double cvt_d_l_out;
4180 4196
4181 float cvt_l_s_in; 4197 float cvt_l_s_in;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4359 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in)); 4375 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
4360 CHECK_EQ(test.cvt_w_s_out, 0); 4376 CHECK_EQ(test.cvt_w_s_out, 0);
4361 CHECK_EQ(test.cvt_w_d_out, 0); 4377 CHECK_EQ(test.cvt_w_d_out, 0);
4362 } 4378 }
4363 4379
4364 4380
4365 TEST(DIV_FMT) { 4381 TEST(DIV_FMT) {
4366 CcTest::InitializeVM(); 4382 CcTest::InitializeVM();
4367 Isolate* isolate = CcTest::i_isolate(); 4383 Isolate* isolate = CcTest::i_isolate();
4368 HandleScope scope(isolate); 4384 HandleScope scope(isolate);
4369 MacroAssembler assm(isolate, NULL, 0); 4385 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4370 4386
4371 typedef struct test { 4387 typedef struct test {
4372 double dOp1; 4388 double dOp1;
4373 double dOp2; 4389 double dOp2;
4374 double dRes; 4390 double dRes;
4375 float fOp1; 4391 float fOp1;
4376 float fOp2; 4392 float fOp2;
4377 float fRes; 4393 float fRes;
4378 } Test; 4394 } Test;
4379 4395
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 4495 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
4480 CHECK_EQ(true, std::isnan(test.dRes)); 4496 CHECK_EQ(true, std::isnan(test.dRes));
4481 CHECK_EQ(true, std::isnan(test.fRes)); 4497 CHECK_EQ(true, std::isnan(test.fRes));
4482 } 4498 }
4483 4499
4484 4500
4485 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { 4501 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
4486 Isolate* isolate = CcTest::i_isolate(); 4502 Isolate* isolate = CcTest::i_isolate();
4487 HandleScope scope(isolate); 4503 HandleScope scope(isolate);
4488 4504
4489 MacroAssembler assm(isolate, NULL, 0); 4505 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4490 4506
4491 __ align(v0, a0, a1, bp); 4507 __ align(v0, a0, a1, bp);
4492 __ jr(ra); 4508 __ jr(ra);
4493 __ nop(); 4509 __ nop();
4494 4510
4495 CodeDesc desc; 4511 CodeDesc desc;
4496 assm.GetCode(&desc); 4512 assm.GetCode(&desc);
4497 Handle<Code> code = isolate->factory()->NewCode( 4513 Handle<Code> code = isolate->factory()->NewCode(
4498 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4514 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4499 4515
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 tc[i].bp)); 4548 tc[i].bp));
4533 } 4549 }
4534 } 4550 }
4535 } 4551 }
4536 4552
4537 4553
4538 uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { 4554 uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
4539 Isolate* isolate = CcTest::i_isolate(); 4555 Isolate* isolate = CcTest::i_isolate();
4540 HandleScope scope(isolate); 4556 HandleScope scope(isolate);
4541 4557
4542 MacroAssembler assm(isolate, NULL, 0); 4558 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4543 4559
4544 __ dalign(v0, a0, a1, bp); 4560 __ dalign(v0, a0, a1, bp);
4545 __ jr(ra); 4561 __ jr(ra);
4546 __ nop(); 4562 __ nop();
4547 4563
4548 CodeDesc desc; 4564 CodeDesc desc;
4549 assm.GetCode(&desc); 4565 assm.GetCode(&desc);
4550 Handle<Code> code = isolate->factory()->NewCode( 4566 Handle<Code> code = isolate->factory()->NewCode(
4551 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4567 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4552 4568
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4590 } 4606 }
4591 } 4607 }
4592 4608
4593 4609
4594 uint64_t PC; // The program counter. 4610 uint64_t PC; // The program counter.
4595 4611
4596 uint64_t run_aluipc(int16_t offset) { 4612 uint64_t run_aluipc(int16_t offset) {
4597 Isolate* isolate = CcTest::i_isolate(); 4613 Isolate* isolate = CcTest::i_isolate();
4598 HandleScope scope(isolate); 4614 HandleScope scope(isolate);
4599 4615
4600 MacroAssembler assm(isolate, NULL, 0); 4616 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4601 4617
4602 __ aluipc(v0, offset); 4618 __ aluipc(v0, offset);
4603 __ jr(ra); 4619 __ jr(ra);
4604 __ nop(); 4620 __ nop();
4605 4621
4606 CodeDesc desc; 4622 CodeDesc desc;
4607 assm.GetCode(&desc); 4623 assm.GetCode(&desc);
4608 Handle<Code> code = isolate->factory()->NewCode( 4624 Handle<Code> code = isolate->factory()->NewCode(
4609 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4625 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4610 4626
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 CHECK_EQ(expected_res, res); 4660 CHECK_EQ(expected_res, res);
4645 } 4661 }
4646 } 4662 }
4647 } 4663 }
4648 4664
4649 4665
4650 uint64_t run_auipc(int16_t offset) { 4666 uint64_t run_auipc(int16_t offset) {
4651 Isolate* isolate = CcTest::i_isolate(); 4667 Isolate* isolate = CcTest::i_isolate();
4652 HandleScope scope(isolate); 4668 HandleScope scope(isolate);
4653 4669
4654 MacroAssembler assm(isolate, NULL, 0); 4670 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4655 4671
4656 __ auipc(v0, offset); 4672 __ auipc(v0, offset);
4657 __ jr(ra); 4673 __ jr(ra);
4658 __ nop(); 4674 __ nop();
4659 4675
4660 CodeDesc desc; 4676 CodeDesc desc;
4661 assm.GetCode(&desc); 4677 assm.GetCode(&desc);
4662 Handle<Code> code = isolate->factory()->NewCode( 4678 Handle<Code> code = isolate->factory()->NewCode(
4663 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4679 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4664 4680
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4698 CHECK_EQ(expected_res, res); 4714 CHECK_EQ(expected_res, res);
4699 } 4715 }
4700 } 4716 }
4701 } 4717 }
4702 4718
4703 4719
4704 uint64_t run_lwpc(int offset) { 4720 uint64_t run_lwpc(int offset) {
4705 Isolate* isolate = CcTest::i_isolate(); 4721 Isolate* isolate = CcTest::i_isolate();
4706 HandleScope scope(isolate); 4722 HandleScope scope(isolate);
4707 4723
4708 MacroAssembler assm(isolate, NULL, 0); 4724 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4709 4725
4710 // 256k instructions; 2^8k 4726 // 256k instructions; 2^8k
4711 // addiu t3, a4, 0xffff; (0x250fffff) 4727 // addiu t3, a4, 0xffff; (0x250fffff)
4712 // ... 4728 // ...
4713 // addiu t0, a4, 0x0000; (0x250c0000) 4729 // addiu t0, a4, 0x0000; (0x250c0000)
4714 uint32_t addiu_start_1 = 0x25000000; 4730 uint32_t addiu_start_1 = 0x25000000;
4715 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 4731 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
4716 uint32_t addiu_new = addiu_start_1 + i; 4732 uint32_t addiu_new = addiu_start_1 + i;
4717 __ dd(addiu_new); 4733 __ dd(addiu_new);
4718 } 4734 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4774 CHECK_EQ(tc[i].expected_res, res); 4790 CHECK_EQ(tc[i].expected_res, res);
4775 } 4791 }
4776 } 4792 }
4777 } 4793 }
4778 4794
4779 4795
4780 uint64_t run_lwupc(int offset) { 4796 uint64_t run_lwupc(int offset) {
4781 Isolate* isolate = CcTest::i_isolate(); 4797 Isolate* isolate = CcTest::i_isolate();
4782 HandleScope scope(isolate); 4798 HandleScope scope(isolate);
4783 4799
4784 MacroAssembler assm(isolate, NULL, 0); 4800 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4785 4801
4786 // 256k instructions; 2^8k 4802 // 256k instructions; 2^8k
4787 // addiu t3, a4, 0xffff; (0x250fffff) 4803 // addiu t3, a4, 0xffff; (0x250fffff)
4788 // ... 4804 // ...
4789 // addiu t0, a4, 0x0000; (0x250c0000) 4805 // addiu t0, a4, 0x0000; (0x250c0000)
4790 uint32_t addiu_start_1 = 0x25000000; 4806 uint32_t addiu_start_1 = 0x25000000;
4791 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 4807 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
4792 uint32_t addiu_new = addiu_start_1 + i; 4808 uint32_t addiu_new = addiu_start_1 + i;
4793 __ dd(addiu_new); 4809 __ dd(addiu_new);
4794 } 4810 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4850 CHECK_EQ(tc[i].expected_res, res); 4866 CHECK_EQ(tc[i].expected_res, res);
4851 } 4867 }
4852 } 4868 }
4853 } 4869 }
4854 4870
4855 4871
4856 uint64_t run_jic(int16_t offset) { 4872 uint64_t run_jic(int16_t offset) {
4857 Isolate* isolate = CcTest::i_isolate(); 4873 Isolate* isolate = CcTest::i_isolate();
4858 HandleScope scope(isolate); 4874 HandleScope scope(isolate);
4859 4875
4860 MacroAssembler assm(isolate, NULL, 0); 4876 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4861 4877
4862 Label get_program_counter, stop_execution; 4878 Label get_program_counter, stop_execution;
4863 __ push(ra); 4879 __ push(ra);
4864 __ li(v0, 0); 4880 __ li(v0, 0);
4865 __ li(t1, 0x66); 4881 __ li(t1, 0x66);
4866 4882
4867 __ addiu(v0, v0, 0x1); // <-- offset = -32 4883 __ addiu(v0, v0, 0x1); // <-- offset = -32
4868 __ addiu(v0, v0, 0x2); 4884 __ addiu(v0, v0, 0x2);
4869 __ addiu(v0, v0, 0x10); 4885 __ addiu(v0, v0, 0x10);
4870 __ addiu(v0, v0, 0x20); 4886 __ addiu(v0, v0, 0x20);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4931 CHECK_EQ(tc[i].expected_res, res); 4947 CHECK_EQ(tc[i].expected_res, res);
4932 } 4948 }
4933 } 4949 }
4934 } 4950 }
4935 4951
4936 4952
4937 uint64_t run_beqzc(int32_t value, int32_t offset) { 4953 uint64_t run_beqzc(int32_t value, int32_t offset) {
4938 Isolate* isolate = CcTest::i_isolate(); 4954 Isolate* isolate = CcTest::i_isolate();
4939 HandleScope scope(isolate); 4955 HandleScope scope(isolate);
4940 4956
4941 MacroAssembler assm(isolate, NULL, 0); 4957 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
4942 4958
4943 Label stop_execution; 4959 Label stop_execution;
4944 __ li(v0, 0); 4960 __ li(v0, 0);
4945 __ li(t1, 0x66); 4961 __ li(t1, 0x66);
4946 4962
4947 __ addiu(v0, v0, 0x1); // <-- offset = -8 4963 __ addiu(v0, v0, 0x1); // <-- offset = -8
4948 __ addiu(v0, v0, 0x2); 4964 __ addiu(v0, v0, 0x2);
4949 __ addiu(v0, v0, 0x10); 4965 __ addiu(v0, v0, 0x10);
4950 __ addiu(v0, v0, 0x20); 4966 __ addiu(v0, v0, 0x20);
4951 __ beq(v0, t1, &stop_execution); 4967 __ beq(v0, t1, &stop_execution);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 CHECK_EQ(tc[i].expected_res, res); 5020 CHECK_EQ(tc[i].expected_res, res);
5005 } 5021 }
5006 } 5022 }
5007 } 5023 }
5008 5024
5009 5025
5010 uint64_t run_jialc(int16_t offset) { 5026 uint64_t run_jialc(int16_t offset) {
5011 Isolate* isolate = CcTest::i_isolate(); 5027 Isolate* isolate = CcTest::i_isolate();
5012 HandleScope scope(isolate); 5028 HandleScope scope(isolate);
5013 5029
5014 MacroAssembler assm(isolate, NULL, 0); 5030 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5015 5031
5016 Label main_block, get_program_counter; 5032 Label main_block, get_program_counter;
5017 __ push(ra); 5033 __ push(ra);
5018 __ li(v0, 0); 5034 __ li(v0, 0);
5019 __ beq(v0, v0, &main_block); 5035 __ beq(v0, v0, &main_block);
5020 __ nop(); 5036 __ nop();
5021 5037
5022 // Block 1 5038 // Block 1
5023 __ addiu(v0, v0, 0x1); // <-- offset = -40 5039 __ addiu(v0, v0, 0x1); // <-- offset = -40
5024 __ addiu(v0, v0, 0x2); 5040 __ addiu(v0, v0, 0x2);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
5098 CHECK_EQ(tc[i].expected_res, res); 5114 CHECK_EQ(tc[i].expected_res, res);
5099 } 5115 }
5100 } 5116 }
5101 } 5117 }
5102 5118
5103 5119
5104 uint64_t run_addiupc(int32_t imm19) { 5120 uint64_t run_addiupc(int32_t imm19) {
5105 Isolate* isolate = CcTest::i_isolate(); 5121 Isolate* isolate = CcTest::i_isolate();
5106 HandleScope scope(isolate); 5122 HandleScope scope(isolate);
5107 5123
5108 MacroAssembler assm(isolate, NULL, 0); 5124 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5109 5125
5110 __ addiupc(v0, imm19); 5126 __ addiupc(v0, imm19);
5111 __ jr(ra); 5127 __ jr(ra);
5112 __ nop(); 5128 __ nop();
5113 5129
5114 CodeDesc desc; 5130 CodeDesc desc;
5115 assm.GetCode(&desc); 5131 assm.GetCode(&desc);
5116 Handle<Code> code = isolate->factory()->NewCode( 5132 Handle<Code> code = isolate->factory()->NewCode(
5117 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5133 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5118 5134
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 CHECK_EQ(expected_res, res); 5168 CHECK_EQ(expected_res, res);
5153 } 5169 }
5154 } 5170 }
5155 } 5171 }
5156 5172
5157 5173
5158 uint64_t run_ldpc(int offset) { 5174 uint64_t run_ldpc(int offset) {
5159 Isolate* isolate = CcTest::i_isolate(); 5175 Isolate* isolate = CcTest::i_isolate();
5160 HandleScope scope(isolate); 5176 HandleScope scope(isolate);
5161 5177
5162 MacroAssembler assm(isolate, NULL, 0); 5178 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5163 5179
5164 // 256k instructions; 2 * 2^7k = 2^8k 5180 // 256k instructions; 2 * 2^7k = 2^8k
5165 // addiu t3, a4, 0xffff; (0x250fffff) 5181 // addiu t3, a4, 0xffff; (0x250fffff)
5166 // ... 5182 // ...
5167 // addiu t0, a4, 0x0000; (0x250c0000) 5183 // addiu t0, a4, 0x0000; (0x250c0000)
5168 uint32_t addiu_start_1 = 0x25000000; 5184 uint32_t addiu_start_1 = 0x25000000;
5169 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 5185 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
5170 uint32_t addiu_new = addiu_start_1 + i; 5186 uint32_t addiu_new = addiu_start_1 + i;
5171 __ dd(addiu_new); 5187 __ dd(addiu_new);
5172 } 5188 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5227 CHECK_EQ(tc[i].expected_res, res); 5243 CHECK_EQ(tc[i].expected_res, res);
5228 } 5244 }
5229 } 5245 }
5230 } 5246 }
5231 5247
5232 5248
5233 int64_t run_bc(int32_t offset) { 5249 int64_t run_bc(int32_t offset) {
5234 Isolate* isolate = CcTest::i_isolate(); 5250 Isolate* isolate = CcTest::i_isolate();
5235 HandleScope scope(isolate); 5251 HandleScope scope(isolate);
5236 5252
5237 MacroAssembler assm(isolate, NULL, 0); 5253 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5238 5254
5239 Label continue_1, stop_execution; 5255 Label continue_1, stop_execution;
5240 __ push(ra); 5256 __ push(ra);
5241 __ li(v0, 0); 5257 __ li(v0, 0);
5242 __ li(t8, 0); 5258 __ li(t8, 0);
5243 __ li(t9, 2); // Condition for the stopping execution. 5259 __ li(t9, 2); // Condition for the stopping execution.
5244 5260
5245 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 5261 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1
5246 for (int32_t i = -100; i <= -11; ++i) { 5262 for (int32_t i = -100; i <= -11; ++i) {
5247 __ dd(instruction_addiu); 5263 __ dd(instruction_addiu);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5308 CHECK_EQ(tc[i].expected_res, res); 5324 CHECK_EQ(tc[i].expected_res, res);
5309 } 5325 }
5310 } 5326 }
5311 } 5327 }
5312 5328
5313 5329
5314 int64_t run_balc(int32_t offset) { 5330 int64_t run_balc(int32_t offset) {
5315 Isolate* isolate = CcTest::i_isolate(); 5331 Isolate* isolate = CcTest::i_isolate();
5316 HandleScope scope(isolate); 5332 HandleScope scope(isolate);
5317 5333
5318 MacroAssembler assm(isolate, NULL, 0); 5334 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5319 5335
5320 Label continue_1, stop_execution; 5336 Label continue_1, stop_execution;
5321 __ push(ra); 5337 __ push(ra);
5322 __ li(v0, 0); 5338 __ li(v0, 0);
5323 __ li(t8, 0); 5339 __ li(t8, 0);
5324 __ li(t9, 2); // Condition for stopping execution. 5340 __ li(t9, 2); // Condition for stopping execution.
5325 5341
5326 __ beq(t8, t8, &continue_1); 5342 __ beq(t8, t8, &continue_1);
5327 __ nop(); 5343 __ nop();
5328 5344
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5389 CHECK_EQ(tc[i].expected_res, res); 5405 CHECK_EQ(tc[i].expected_res, res);
5390 } 5406 }
5391 } 5407 }
5392 } 5408 }
5393 5409
5394 5410
5395 uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) { 5411 uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) {
5396 Isolate* isolate = CcTest::i_isolate(); 5412 Isolate* isolate = CcTest::i_isolate();
5397 HandleScope scope(isolate); 5413 HandleScope scope(isolate);
5398 5414
5399 MacroAssembler assm(isolate, NULL, 0); 5415 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5400 5416
5401 __ dsll(v0, a0, sa_value); 5417 __ dsll(v0, a0, sa_value);
5402 __ jr(ra); 5418 __ jr(ra);
5403 __ nop(); 5419 __ nop();
5404 5420
5405 CodeDesc desc; 5421 CodeDesc desc;
5406 assm.GetCode(&desc); 5422 assm.GetCode(&desc);
5407 Handle<Code> code = isolate->factory()->NewCode( 5423 Handle<Code> code = isolate->factory()->NewCode(
5408 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5424 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5409 5425
(...skipping 27 matching lines...) Expand all
5437 CHECK_EQ(tc[i].expected_res, 5453 CHECK_EQ(tc[i].expected_res,
5438 run_dsll(tc[i].rt_value, tc[i].sa_value)); 5454 run_dsll(tc[i].rt_value, tc[i].sa_value));
5439 } 5455 }
5440 } 5456 }
5441 5457
5442 5458
5443 uint64_t run_bal(int16_t offset) { 5459 uint64_t run_bal(int16_t offset) {
5444 Isolate* isolate = CcTest::i_isolate(); 5460 Isolate* isolate = CcTest::i_isolate();
5445 HandleScope scope(isolate); 5461 HandleScope scope(isolate);
5446 5462
5447 MacroAssembler assm(isolate, NULL, 0); 5463 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5448 5464
5449 __ mov(t0, ra); 5465 __ mov(t0, ra);
5450 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset". 5466 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset".
5451 __ nop(); 5467 __ nop();
5452 5468
5453 __ mov(ra, t0); 5469 __ mov(ra, t0);
5454 __ jr(ra); 5470 __ jr(ra);
5455 __ nop(); 5471 __ nop();
5456 5472
5457 __ li(v0, 1); 5473 __ li(v0, 1);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5493 5509
5494 5510
5495 TEST(Trampoline) { 5511 TEST(Trampoline) {
5496 // Private member of Assembler class. 5512 // Private member of Assembler class.
5497 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; 5513 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1;
5498 5514
5499 CcTest::InitializeVM(); 5515 CcTest::InitializeVM();
5500 Isolate* isolate = CcTest::i_isolate(); 5516 Isolate* isolate = CcTest::i_isolate();
5501 HandleScope scope(isolate); 5517 HandleScope scope(isolate);
5502 5518
5503 MacroAssembler assm(isolate, nullptr, 0); 5519 MacroAssembler assm(isolate, nullptr, 0,
5520 v8::internal::CodeObjectRequired::kYes);
5504 Label done; 5521 Label done;
5505 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; 5522 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2;
5506 5523
5507 for (size_t i = 0; i < nr_calls; ++i) { 5524 for (size_t i = 0; i < nr_calls; ++i) {
5508 __ BranchShort(&done, eq, a0, Operand(a1)); 5525 __ BranchShort(&done, eq, a0, Operand(a1));
5509 } 5526 }
5510 __ bind(&done); 5527 __ bind(&done);
5511 __ Ret(USE_DELAY_SLOT); 5528 __ Ret(USE_DELAY_SLOT);
5512 __ mov(v0, zero_reg); 5529 __ mov(v0, zero_reg);
5513 5530
5514 CodeDesc desc; 5531 CodeDesc desc;
5515 assm.GetCode(&desc); 5532 assm.GetCode(&desc);
5516 Handle<Code> code = isolate->factory()->NewCode( 5533 Handle<Code> code = isolate->factory()->NewCode(
5517 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5534 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5518 F2 f = FUNCTION_CAST<F2>(code->entry()); 5535 F2 f = FUNCTION_CAST<F2>(code->entry());
5519 5536
5520 int64_t res = reinterpret_cast<int64_t>( 5537 int64_t res = reinterpret_cast<int64_t>(
5521 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5538 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5522 CHECK_EQ(res, 0); 5539 CHECK_EQ(res, 0);
5523 } 5540 }
5524 5541
5525 5542
5526 #undef __ 5543 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-mips.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698