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

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: updates 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
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, 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 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, 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
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, 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(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, true);
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, true);
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, true);
720 720
721 // Basic word load. 721 // Basic word load.
722 __ lw(a4, MemOperand(a0, offsetof(T, input)) ); 722 __ lw(a4, MemOperand(a0, offsetof(T, input)) );
723 723
724 // ROTR instruction (called through the Ror macro). 724 // ROTR instruction (called through the Ror macro).
725 __ Ror(a5, a4, 0x0004); 725 __ Ror(a5, a4, 0x0004);
726 __ Ror(a6, a4, 0x0008); 726 __ Ror(a6, a4, 0x0008);
727 __ Ror(a7, a4, 0x000c); 727 __ Ror(a7, a4, 0x000c);
728 __ Ror(t0, a4, 0x0010); 728 __ Ror(t0, a4, 0x0010);
729 __ Ror(t1, a4, 0x0014); 729 __ Ror(t1, a4, 0x0014);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 } 794 }
795 795
796 796
797 TEST(MIPS9) { 797 TEST(MIPS9) {
798 // Test BRANCH improvements. 798 // Test BRANCH improvements.
799 CcTest::InitializeVM(); 799 CcTest::InitializeVM();
800 Isolate* isolate = CcTest::i_isolate(); 800 Isolate* isolate = CcTest::i_isolate();
801 HandleScope scope(isolate); 801 HandleScope scope(isolate);
802 802
803 MacroAssembler assm(isolate, NULL, 0); 803 MacroAssembler assm(isolate, NULL, 0, true);
804 Label exit, exit2, exit3; 804 Label exit, exit2, exit3;
805 805
806 __ Branch(&exit, ge, a0, Operand(zero_reg)); 806 __ Branch(&exit, ge, a0, Operand(zero_reg));
807 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); 807 __ Branch(&exit2, ge, a0, Operand(0x00001FFF));
808 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); 808 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF));
809 809
810 __ bind(&exit); 810 __ bind(&exit);
811 __ bind(&exit2); 811 __ bind(&exit2);
812 __ bind(&exit3); 812 __ bind(&exit3);
813 __ jr(ra); 813 __ jr(ra);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 typedef struct { 1090 typedef struct {
1091 int32_t x; 1091 int32_t x;
1092 int32_t y; 1092 int32_t y;
1093 int32_t y1; 1093 int32_t y1;
1094 int32_t y2; 1094 int32_t y2;
1095 int32_t y3; 1095 int32_t y3;
1096 int32_t y4; 1096 int32_t y4;
1097 } T; 1097 } T;
1098 T t; 1098 T t;
1099 1099
1100 MacroAssembler assm(isolate, NULL, 0); 1100 MacroAssembler assm(isolate, NULL, 0, true);
1101 1101
1102 __ mov(t2, fp); // Save frame pointer. 1102 __ mov(t2, fp); // Save frame pointer.
1103 __ mov(fp, a0); // Access struct T by fp. 1103 __ mov(fp, a0); // Access struct T by fp.
1104 __ lw(a4, MemOperand(a0, offsetof(T, y))); 1104 __ lw(a4, MemOperand(a0, offsetof(T, y)));
1105 __ lw(a7, MemOperand(a0, offsetof(T, y4))); 1105 __ lw(a7, MemOperand(a0, offsetof(T, y4)));
1106 1106
1107 __ addu(a5, a4, a7); 1107 __ addu(a5, a4, a7);
1108 __ subu(t0, a4, a7); 1108 __ subu(t0, a4, a7);
1109 __ nop(); 1109 __ nop();
1110 __ push(a4); // These instructions disappear after opt. 1110 __ push(a4); // These instructions disappear after opt.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 typedef struct { 1179 typedef struct {
1180 double cvt_big_out; 1180 double cvt_big_out;
1181 double cvt_small_out; 1181 double cvt_small_out;
1182 uint32_t trunc_big_out; 1182 uint32_t trunc_big_out;
1183 uint32_t trunc_small_out; 1183 uint32_t trunc_small_out;
1184 uint32_t cvt_big_in; 1184 uint32_t cvt_big_in;
1185 uint32_t cvt_small_in; 1185 uint32_t cvt_small_in;
1186 } T; 1186 } T;
1187 T t; 1187 T t;
1188 1188
1189 MacroAssembler assm(isolate, NULL, 0); 1189 MacroAssembler assm(isolate, NULL, 0, true);
1190 1190
1191 __ sw(a4, MemOperand(a0, offsetof(T, cvt_small_in))); 1191 __ sw(a4, MemOperand(a0, offsetof(T, cvt_small_in)));
1192 __ Cvt_d_uw(f10, a4); 1192 __ Cvt_d_uw(f10, a4);
1193 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out))); 1193 __ sdc1(f10, MemOperand(a0, offsetof(T, cvt_small_out)));
1194 1194
1195 __ Trunc_uw_d(f10, f10, f4); 1195 __ Trunc_uw_d(f10, f10, f4);
1196 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out))); 1196 __ swc1(f10, MemOperand(a0, offsetof(T, trunc_small_out)));
1197 1197
1198 __ sw(a4, MemOperand(a0, offsetof(T, cvt_big_in))); 1198 __ sw(a4, MemOperand(a0, offsetof(T, cvt_big_in)));
1199 __ Cvt_d_uw(f8, a4); 1199 __ Cvt_d_uw(f8, a4);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 ROUND_STRUCT_ELEMENT(round) 1256 ROUND_STRUCT_ELEMENT(round)
1257 ROUND_STRUCT_ELEMENT(floor) 1257 ROUND_STRUCT_ELEMENT(floor)
1258 ROUND_STRUCT_ELEMENT(ceil) 1258 ROUND_STRUCT_ELEMENT(ceil)
1259 ROUND_STRUCT_ELEMENT(trunc) 1259 ROUND_STRUCT_ELEMENT(trunc)
1260 ROUND_STRUCT_ELEMENT(cvt) 1260 ROUND_STRUCT_ELEMENT(cvt)
1261 } T; 1261 } T;
1262 T t; 1262 T t;
1263 1263
1264 #undef ROUND_STRUCT_ELEMENT 1264 #undef ROUND_STRUCT_ELEMENT
1265 1265
1266 MacroAssembler assm(isolate, NULL, 0); 1266 MacroAssembler assm(isolate, NULL, 0, true);
1267 1267
1268 // Save FCSR. 1268 // Save FCSR.
1269 __ cfc1(a1, FCSR); 1269 __ cfc1(a1, FCSR);
1270 // Disable FPU exceptions. 1270 // Disable FPU exceptions.
1271 __ ctc1(zero_reg, FCSR); 1271 __ ctc1(zero_reg, FCSR);
1272 #define RUN_ROUND_TEST(x) \ 1272 #define RUN_ROUND_TEST(x) \
1273 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \ 1273 __ ldc1(f0, MemOperand(a0, offsetof(T, round_up_in))); \
1274 __ x##_w_d(f0, f0); \ 1274 __ x##_w_d(f0, f0); \
1275 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \ 1275 __ swc1(f0, MemOperand(a0, offsetof(T, x##_up_out))); \
1276 \ 1276 \
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6); 1472 CHECK_EQ(static_cast<int64_t>(0x000000003333bbccL), t.r6);
1473 } 1473 }
1474 1474
1475 1475
1476 // ----------------------mips64r6 specific tests---------------------- 1476 // ----------------------mips64r6 specific tests----------------------
1477 TEST(seleqz_selnez) { 1477 TEST(seleqz_selnez) {
1478 if (kArchVariant == kMips64r6) { 1478 if (kArchVariant == kMips64r6) {
1479 CcTest::InitializeVM(); 1479 CcTest::InitializeVM();
1480 Isolate* isolate = CcTest::i_isolate(); 1480 Isolate* isolate = CcTest::i_isolate();
1481 HandleScope scope(isolate); 1481 HandleScope scope(isolate);
1482 MacroAssembler assm(isolate, NULL, 0); 1482 MacroAssembler assm(isolate, NULL, 0, true);
1483 1483
1484 typedef struct test { 1484 typedef struct test {
1485 int a; 1485 int a;
1486 int b; 1486 int b;
1487 int c; 1487 int c;
1488 int d; 1488 int d;
1489 double e; 1489 double e;
1490 double f; 1490 double f;
1491 double g; 1491 double g;
1492 double h; 1492 double h;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 } 1574 }
1575 } 1575 }
1576 1576
1577 1577
1578 1578
1579 TEST(min_max) { 1579 TEST(min_max) {
1580 if (kArchVariant == kMips64r6) { 1580 if (kArchVariant == kMips64r6) {
1581 CcTest::InitializeVM(); 1581 CcTest::InitializeVM();
1582 Isolate* isolate = CcTest::i_isolate(); 1582 Isolate* isolate = CcTest::i_isolate();
1583 HandleScope scope(isolate); 1583 HandleScope scope(isolate);
1584 MacroAssembler assm(isolate, NULL, 0); 1584 MacroAssembler assm(isolate, NULL, 0, true);
1585 1585
1586 typedef struct test_float { 1586 typedef struct test_float {
1587 double a; 1587 double a;
1588 double b; 1588 double b;
1589 double c; 1589 double c;
1590 double d; 1590 double d;
1591 float e; 1591 float e;
1592 float f; 1592 float f;
1593 float g; 1593 float g;
1594 float h; 1594 float h;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 } 1651 }
1652 } 1652 }
1653 1653
1654 1654
1655 TEST(rint_d) { 1655 TEST(rint_d) {
1656 if (kArchVariant == kMips64r6) { 1656 if (kArchVariant == kMips64r6) {
1657 const int kTableLength = 30; 1657 const int kTableLength = 30;
1658 CcTest::InitializeVM(); 1658 CcTest::InitializeVM();
1659 Isolate* isolate = CcTest::i_isolate(); 1659 Isolate* isolate = CcTest::i_isolate();
1660 HandleScope scope(isolate); 1660 HandleScope scope(isolate);
1661 MacroAssembler assm(isolate, NULL, 0); 1661 MacroAssembler assm(isolate, NULL, 0, true);
1662 1662
1663 typedef struct test_float { 1663 typedef struct test_float {
1664 double a; 1664 double a;
1665 double b; 1665 double b;
1666 int fcsr; 1666 int fcsr;
1667 }TestFloat; 1667 }TestFloat;
1668 1668
1669 TestFloat test; 1669 TestFloat test;
1670 double inputs[kTableLength] = {18446744073709551617.0, 1670 double inputs[kTableLength] = {18446744073709551617.0,
1671 4503599627370496.0, -4503599627370496.0, 1671 4503599627370496.0, -4503599627370496.0,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 } 1754 }
1755 } 1755 }
1756 } 1756 }
1757 1757
1758 1758
1759 TEST(sel) { 1759 TEST(sel) {
1760 if (kArchVariant == kMips64r6) { 1760 if (kArchVariant == kMips64r6) {
1761 CcTest::InitializeVM(); 1761 CcTest::InitializeVM();
1762 Isolate* isolate = CcTest::i_isolate(); 1762 Isolate* isolate = CcTest::i_isolate();
1763 HandleScope scope(isolate); 1763 HandleScope scope(isolate);
1764 MacroAssembler assm(isolate, NULL, 0); 1764 MacroAssembler assm(isolate, NULL, 0, true);
1765 1765
1766 typedef struct test { 1766 typedef struct test {
1767 double dd; 1767 double dd;
1768 double ds; 1768 double ds;
1769 double dt; 1769 double dt;
1770 float fd; 1770 float fd;
1771 float fs; 1771 float fs;
1772 float ft; 1772 float ft;
1773 } Test; 1773 } Test;
1774 1774
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } 1828 }
1829 } 1829 }
1830 1830
1831 1831
1832 TEST(rint_s) { 1832 TEST(rint_s) {
1833 if (kArchVariant == kMips64r6) { 1833 if (kArchVariant == kMips64r6) {
1834 const int kTableLength = 30; 1834 const int kTableLength = 30;
1835 CcTest::InitializeVM(); 1835 CcTest::InitializeVM();
1836 Isolate* isolate = CcTest::i_isolate(); 1836 Isolate* isolate = CcTest::i_isolate();
1837 HandleScope scope(isolate); 1837 HandleScope scope(isolate);
1838 MacroAssembler assm(isolate, NULL, 0); 1838 MacroAssembler assm(isolate, NULL, 0, true);
1839 1839
1840 typedef struct test_float { 1840 typedef struct test_float {
1841 float a; 1841 float a;
1842 float b; 1842 float b;
1843 int fcsr; 1843 int fcsr;
1844 }TestFloat; 1844 }TestFloat;
1845 1845
1846 TestFloat test; 1846 TestFloat test;
1847 float inputs[kTableLength] = {18446744073709551617.0, 1847 float inputs[kTableLength] = {18446744073709551617.0,
1848 4503599627370496.0, -4503599627370496.0, 1848 4503599627370496.0, -4503599627370496.0,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 } 1934 }
1935 } 1935 }
1936 1936
1937 1937
1938 TEST(mina_maxa) { 1938 TEST(mina_maxa) {
1939 if (kArchVariant == kMips64r6) { 1939 if (kArchVariant == kMips64r6) {
1940 const int kTableLength = 15; 1940 const int kTableLength = 15;
1941 CcTest::InitializeVM(); 1941 CcTest::InitializeVM();
1942 Isolate* isolate = CcTest::i_isolate(); 1942 Isolate* isolate = CcTest::i_isolate();
1943 HandleScope scope(isolate); 1943 HandleScope scope(isolate);
1944 MacroAssembler assm(isolate, NULL, 0); 1944 MacroAssembler assm(isolate, NULL, 0, true);
1945 const double double_nan = std::numeric_limits<double>::quiet_NaN(); 1945 const double double_nan = std::numeric_limits<double>::quiet_NaN();
1946 const float float_nan = std::numeric_limits<float>::quiet_NaN(); 1946 const float float_nan = std::numeric_limits<float>::quiet_NaN();
1947 1947
1948 typedef struct test_float { 1948 typedef struct test_float {
1949 double a; 1949 double a;
1950 double b; 1950 double b;
1951 double resd; 1951 double resd;
1952 double resd1; 1952 double resd1;
1953 float c; 1953 float c;
1954 float d; 1954 float d;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 } 2033 }
2034 2034
2035 2035
2036 2036
2037 // ----------------------mips64r2 specific tests---------------------- 2037 // ----------------------mips64r2 specific tests----------------------
2038 TEST(trunc_l) { 2038 TEST(trunc_l) {
2039 if (kArchVariant == kMips64r2) { 2039 if (kArchVariant == kMips64r2) {
2040 CcTest::InitializeVM(); 2040 CcTest::InitializeVM();
2041 Isolate* isolate = CcTest::i_isolate(); 2041 Isolate* isolate = CcTest::i_isolate();
2042 HandleScope scope(isolate); 2042 HandleScope scope(isolate);
2043 MacroAssembler assm(isolate, NULL, 0); 2043 MacroAssembler assm(isolate, NULL, 0, true);
2044 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2044 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2045 typedef struct test_float { 2045 typedef struct test_float {
2046 double a; 2046 double a;
2047 float b; 2047 float b;
2048 int64_t c; // a trunc result 2048 int64_t c; // a trunc result
2049 int64_t d; // b trunc result 2049 int64_t d; // b trunc result
2050 }Test; 2050 }Test;
2051 const int kTableLength = 15; 2051 const int kTableLength = 15;
2052 double inputs_D[kTableLength] = { 2052 double inputs_D[kTableLength] = {
2053 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2053 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 } 2093 }
2094 } 2094 }
2095 2095
2096 2096
2097 TEST(movz_movn) { 2097 TEST(movz_movn) {
2098 if (kArchVariant == kMips64r2) { 2098 if (kArchVariant == kMips64r2) {
2099 const int kTableLength = 4; 2099 const int kTableLength = 4;
2100 CcTest::InitializeVM(); 2100 CcTest::InitializeVM();
2101 Isolate* isolate = CcTest::i_isolate(); 2101 Isolate* isolate = CcTest::i_isolate();
2102 HandleScope scope(isolate); 2102 HandleScope scope(isolate);
2103 MacroAssembler assm(isolate, NULL, 0); 2103 MacroAssembler assm(isolate, NULL, 0, true);
2104 2104
2105 typedef struct test_float { 2105 typedef struct test_float {
2106 int64_t rt; 2106 int64_t rt;
2107 double a; 2107 double a;
2108 double b; 2108 double b;
2109 double bold; 2109 double bold;
2110 double b1; 2110 double b1;
2111 double bold1; 2111 double bold1;
2112 float c; 2112 float c;
2113 float d; 2113 float d;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 test.srcf = inputs_S[i]; 2221 test.srcf = inputs_S[i];
2222 2222
2223 for (int j = 0; j< 8; j++) { 2223 for (int j = 0; j< 8; j++) {
2224 test.cc = condition_flags[j]; 2224 test.cc = condition_flags[j];
2225 if (test.cc == 0) { 2225 if (test.cc == 0) {
2226 test.fcsr = 1 << 23; 2226 test.fcsr = 1 << 23;
2227 } else { 2227 } else {
2228 test.fcsr = 1 << (24+condition_flags[j]); 2228 test.fcsr = 1 << (24+condition_flags[j]);
2229 } 2229 }
2230 HandleScope scope(isolate); 2230 HandleScope scope(isolate);
2231 MacroAssembler assm(isolate, NULL, 0); 2231 MacroAssembler assm(isolate, NULL, 0, true);
2232 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) ); 2232 __ ldc1(f2, MemOperand(a0, offsetof(TestFloat, srcd)) );
2233 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) ); 2233 __ lwc1(f4, MemOperand(a0, offsetof(TestFloat, srcf)) );
2234 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) ); 2234 __ lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr)) );
2235 __ cfc1(t0, FCSR); 2235 __ cfc1(t0, FCSR);
2236 __ ctc1(t1, FCSR); 2236 __ ctc1(t1, FCSR);
2237 __ li(t2, 0x0); 2237 __ li(t2, 0x0);
2238 __ mtc1(t2, f12); 2238 __ mtc1(t2, f12);
2239 __ mtc1(t2, f10); 2239 __ mtc1(t2, f10);
2240 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) ); 2240 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold)) );
2241 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) ); 2241 __ swc1(f12, MemOperand(a0, offsetof(TestFloat, dstfold)) );
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 } 2275 }
2276 } 2276 }
2277 2277
2278 2278
2279 2279
2280 // ----------------------tests for all archs-------------------------- 2280 // ----------------------tests for all archs--------------------------
2281 TEST(cvt_w_d) { 2281 TEST(cvt_w_d) {
2282 CcTest::InitializeVM(); 2282 CcTest::InitializeVM();
2283 Isolate* isolate = CcTest::i_isolate(); 2283 Isolate* isolate = CcTest::i_isolate();
2284 HandleScope scope(isolate); 2284 HandleScope scope(isolate);
2285 MacroAssembler assm(isolate, NULL, 0); 2285 MacroAssembler assm(isolate, NULL, 0, true);
2286 2286
2287 typedef struct test_float { 2287 typedef struct test_float {
2288 double a; 2288 double a;
2289 int32_t b; 2289 int32_t b;
2290 int fcsr; 2290 int fcsr;
2291 }Test; 2291 }Test;
2292 const int kTableLength = 24; 2292 const int kTableLength = 24;
2293 double inputs[kTableLength] = { 2293 double inputs[kTableLength] = {
2294 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2294 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, 2295 -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]); 2352 CHECK_EQ(test.b, outputs[j][i]);
2353 } 2353 }
2354 } 2354 }
2355 } 2355 }
2356 2356
2357 2357
2358 TEST(trunc_w) { 2358 TEST(trunc_w) {
2359 CcTest::InitializeVM(); 2359 CcTest::InitializeVM();
2360 Isolate* isolate = CcTest::i_isolate(); 2360 Isolate* isolate = CcTest::i_isolate();
2361 HandleScope scope(isolate); 2361 HandleScope scope(isolate);
2362 MacroAssembler assm(isolate, NULL, 0); 2362 MacroAssembler assm(isolate, NULL, 0, true);
2363 2363
2364 typedef struct test_float { 2364 typedef struct test_float {
2365 double a; 2365 double a;
2366 float b; 2366 float b;
2367 int32_t c; // a trunc result 2367 int32_t c; // a trunc result
2368 int32_t d; // b trunc result 2368 int32_t d; // b trunc result
2369 }Test; 2369 }Test;
2370 const int kTableLength = 15; 2370 const int kTableLength = 15;
2371 double inputs_D[kTableLength] = { 2371 double inputs_D[kTableLength] = {
2372 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2372 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]); 2409 CHECK_EQ(test.c, outputs[i]);
2410 CHECK_EQ(test.d, test.c); 2410 CHECK_EQ(test.d, test.c);
2411 } 2411 }
2412 } 2412 }
2413 2413
2414 2414
2415 TEST(round_w) { 2415 TEST(round_w) {
2416 CcTest::InitializeVM(); 2416 CcTest::InitializeVM();
2417 Isolate* isolate = CcTest::i_isolate(); 2417 Isolate* isolate = CcTest::i_isolate();
2418 HandleScope scope(isolate); 2418 HandleScope scope(isolate);
2419 MacroAssembler assm(isolate, NULL, 0); 2419 MacroAssembler assm(isolate, NULL, 0, true);
2420 2420
2421 typedef struct test_float { 2421 typedef struct test_float {
2422 double a; 2422 double a;
2423 float b; 2423 float b;
2424 int32_t c; // a trunc result 2424 int32_t c; // a trunc result
2425 int32_t d; // b trunc result 2425 int32_t d; // b trunc result
2426 }Test; 2426 }Test;
2427 const int kTableLength = 15; 2427 const int kTableLength = 15;
2428 double inputs_D[kTableLength] = { 2428 double inputs_D[kTableLength] = {
2429 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2429 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]); 2466 CHECK_EQ(test.c, outputs[i]);
2467 CHECK_EQ(test.d, test.c); 2467 CHECK_EQ(test.d, test.c);
2468 } 2468 }
2469 } 2469 }
2470 2470
2471 2471
2472 TEST(round_l) { 2472 TEST(round_l) {
2473 CcTest::InitializeVM(); 2473 CcTest::InitializeVM();
2474 Isolate* isolate = CcTest::i_isolate(); 2474 Isolate* isolate = CcTest::i_isolate();
2475 HandleScope scope(isolate); 2475 HandleScope scope(isolate);
2476 MacroAssembler assm(isolate, NULL, 0); 2476 MacroAssembler assm(isolate, NULL, 0, true);
2477 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2477 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2478 typedef struct test_float { 2478 typedef struct test_float {
2479 double a; 2479 double a;
2480 float b; 2480 float b;
2481 int64_t c; 2481 int64_t c;
2482 int64_t d; 2482 int64_t d;
2483 }Test; 2483 }Test;
2484 const int kTableLength = 15; 2484 const int kTableLength = 15;
2485 double inputs_D[kTableLength] = { 2485 double inputs_D[kTableLength] = {
2486 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2486 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); 2525 CHECK_EQ(test.d, test.c);
2526 } 2526 }
2527 } 2527 }
2528 2528
2529 2529
2530 TEST(sub) { 2530 TEST(sub) {
2531 const int kTableLength = 12; 2531 const int kTableLength = 12;
2532 CcTest::InitializeVM(); 2532 CcTest::InitializeVM();
2533 Isolate* isolate = CcTest::i_isolate(); 2533 Isolate* isolate = CcTest::i_isolate();
2534 HandleScope scope(isolate); 2534 HandleScope scope(isolate);
2535 MacroAssembler assm(isolate, NULL, 0); 2535 MacroAssembler assm(isolate, NULL, 0, true);
2536 2536
2537 typedef struct test_float { 2537 typedef struct test_float {
2538 float a; 2538 float a;
2539 float b; 2539 float b;
2540 float resultS; 2540 float resultS;
2541 double c; 2541 double c;
2542 double d; 2542 double d;
2543 double resultD; 2543 double resultD;
2544 }TestFloat; 2544 }TestFloat;
2545 2545
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 2598
2599 TEST(sqrt_rsqrt_recip) { 2599 TEST(sqrt_rsqrt_recip) {
2600 const int kTableLength = 4; 2600 const int kTableLength = 4;
2601 const double deltaDouble = 2E-15; 2601 const double deltaDouble = 2E-15;
2602 const float deltaFloat = 2E-7; 2602 const float deltaFloat = 2E-7;
2603 const float sqrt2_s = sqrt(2); 2603 const float sqrt2_s = sqrt(2);
2604 const double sqrt2_d = sqrt(2); 2604 const double sqrt2_d = sqrt(2);
2605 CcTest::InitializeVM(); 2605 CcTest::InitializeVM();
2606 Isolate* isolate = CcTest::i_isolate(); 2606 Isolate* isolate = CcTest::i_isolate();
2607 HandleScope scope(isolate); 2607 HandleScope scope(isolate);
2608 MacroAssembler assm(isolate, NULL, 0); 2608 MacroAssembler assm(isolate, NULL, 0, true);
2609 2609
2610 typedef struct test_float { 2610 typedef struct test_float {
2611 float a; 2611 float a;
2612 float resultS; 2612 float resultS;
2613 float resultS1; 2613 float resultS1;
2614 float resultS2; 2614 float resultS2;
2615 double c; 2615 double c;
2616 double resultD; 2616 double resultD;
2617 double resultD1; 2617 double resultD1;
2618 double resultD2; 2618 double resultD2;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 } 2690 }
2691 } 2691 }
2692 } 2692 }
2693 2693
2694 2694
2695 TEST(neg) { 2695 TEST(neg) {
2696 const int kTableLength = 2; 2696 const int kTableLength = 2;
2697 CcTest::InitializeVM(); 2697 CcTest::InitializeVM();
2698 Isolate* isolate = CcTest::i_isolate(); 2698 Isolate* isolate = CcTest::i_isolate();
2699 HandleScope scope(isolate); 2699 HandleScope scope(isolate);
2700 MacroAssembler assm(isolate, NULL, 0); 2700 MacroAssembler assm(isolate, NULL, 0, true);
2701 2701
2702 typedef struct test_float { 2702 typedef struct test_float {
2703 float a; 2703 float a;
2704 float resultS; 2704 float resultS;
2705 double c; 2705 double c;
2706 double resultD; 2706 double resultD;
2707 }TestFloat; 2707 }TestFloat;
2708 2708
2709 TestFloat test; 2709 TestFloat test;
2710 double inputs_D[kTableLength] = { 2710 double inputs_D[kTableLength] = {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 } 2744 }
2745 } 2745 }
2746 2746
2747 2747
2748 2748
2749 TEST(mul) { 2749 TEST(mul) {
2750 const int kTableLength = 4; 2750 const int kTableLength = 4;
2751 CcTest::InitializeVM(); 2751 CcTest::InitializeVM();
2752 Isolate* isolate = CcTest::i_isolate(); 2752 Isolate* isolate = CcTest::i_isolate();
2753 HandleScope scope(isolate); 2753 HandleScope scope(isolate);
2754 MacroAssembler assm(isolate, NULL, 0); 2754 MacroAssembler assm(isolate, NULL, 0, true);
2755 2755
2756 typedef struct test_float { 2756 typedef struct test_float {
2757 float a; 2757 float a;
2758 float b; 2758 float b;
2759 float resultS; 2759 float resultS;
2760 double c; 2760 double c;
2761 double d; 2761 double d;
2762 double resultD; 2762 double resultD;
2763 }TestFloat; 2763 }TestFloat;
2764 2764
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); 2803 CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]);
2804 } 2804 }
2805 } 2805 }
2806 2806
2807 2807
2808 TEST(mov) { 2808 TEST(mov) {
2809 const int kTableLength = 4; 2809 const int kTableLength = 4;
2810 CcTest::InitializeVM(); 2810 CcTest::InitializeVM();
2811 Isolate* isolate = CcTest::i_isolate(); 2811 Isolate* isolate = CcTest::i_isolate();
2812 HandleScope scope(isolate); 2812 HandleScope scope(isolate);
2813 MacroAssembler assm(isolate, NULL, 0); 2813 MacroAssembler assm(isolate, NULL, 0, true);
2814 2814
2815 typedef struct test_float { 2815 typedef struct test_float {
2816 double a; 2816 double a;
2817 double b; 2817 double b;
2818 float c; 2818 float c;
2819 float d; 2819 float d;
2820 }TestFloat; 2820 }TestFloat;
2821 2821
2822 TestFloat test; 2822 TestFloat test;
2823 double inputs_D[kTableLength] = { 2823 double inputs_D[kTableLength] = {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 CHECK_EQ(test.b, outputs_D[i]); 2856 CHECK_EQ(test.b, outputs_D[i]);
2857 CHECK_EQ(test.d, outputs_S[i]); 2857 CHECK_EQ(test.d, outputs_S[i]);
2858 } 2858 }
2859 } 2859 }
2860 2860
2861 2861
2862 TEST(floor_w) { 2862 TEST(floor_w) {
2863 CcTest::InitializeVM(); 2863 CcTest::InitializeVM();
2864 Isolate* isolate = CcTest::i_isolate(); 2864 Isolate* isolate = CcTest::i_isolate();
2865 HandleScope scope(isolate); 2865 HandleScope scope(isolate);
2866 MacroAssembler assm(isolate, NULL, 0); 2866 MacroAssembler assm(isolate, NULL, 0, true);
2867 2867
2868 typedef struct test_float { 2868 typedef struct test_float {
2869 double a; 2869 double a;
2870 float b; 2870 float b;
2871 int32_t c; // a floor result 2871 int32_t c; // a floor result
2872 int32_t d; // b floor result 2872 int32_t d; // b floor result
2873 }Test; 2873 }Test;
2874 const int kTableLength = 15; 2874 const int kTableLength = 15;
2875 double inputs_D[kTableLength] = { 2875 double inputs_D[kTableLength] = {
2876 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2876 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]); 2913 CHECK_EQ(test.c, outputs[i]);
2914 CHECK_EQ(test.d, test.c); 2914 CHECK_EQ(test.d, test.c);
2915 } 2915 }
2916 } 2916 }
2917 2917
2918 2918
2919 TEST(floor_l) { 2919 TEST(floor_l) {
2920 CcTest::InitializeVM(); 2920 CcTest::InitializeVM();
2921 Isolate* isolate = CcTest::i_isolate(); 2921 Isolate* isolate = CcTest::i_isolate();
2922 HandleScope scope(isolate); 2922 HandleScope scope(isolate);
2923 MacroAssembler assm(isolate, NULL, 0); 2923 MacroAssembler assm(isolate, NULL, 0, true);
2924 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 2924 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
2925 typedef struct test_float { 2925 typedef struct test_float {
2926 double a; 2926 double a;
2927 float b; 2927 float b;
2928 int64_t c; 2928 int64_t c;
2929 int64_t d; 2929 int64_t d;
2930 }Test; 2930 }Test;
2931 const int kTableLength = 15; 2931 const int kTableLength = 15;
2932 double inputs_D[kTableLength] = { 2932 double inputs_D[kTableLength] = {
2933 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2933 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]); 2970 CHECK_EQ(test.c, outputs[i]);
2971 CHECK_EQ(test.d, test.c); 2971 CHECK_EQ(test.d, test.c);
2972 } 2972 }
2973 } 2973 }
2974 2974
2975 2975
2976 TEST(ceil_w) { 2976 TEST(ceil_w) {
2977 CcTest::InitializeVM(); 2977 CcTest::InitializeVM();
2978 Isolate* isolate = CcTest::i_isolate(); 2978 Isolate* isolate = CcTest::i_isolate();
2979 HandleScope scope(isolate); 2979 HandleScope scope(isolate);
2980 MacroAssembler assm(isolate, NULL, 0); 2980 MacroAssembler assm(isolate, NULL, 0, true);
2981 2981
2982 typedef struct test_float { 2982 typedef struct test_float {
2983 double a; 2983 double a;
2984 float b; 2984 float b;
2985 int32_t c; // a floor result 2985 int32_t c; // a floor result
2986 int32_t d; // b floor result 2986 int32_t d; // b floor result
2987 }Test; 2987 }Test;
2988 const int kTableLength = 15; 2988 const int kTableLength = 15;
2989 double inputs_D[kTableLength] = { 2989 double inputs_D[kTableLength] = {
2990 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 2990 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]); 3027 CHECK_EQ(test.c, outputs[i]);
3028 CHECK_EQ(test.d, test.c); 3028 CHECK_EQ(test.d, test.c);
3029 } 3029 }
3030 } 3030 }
3031 3031
3032 3032
3033 TEST(ceil_l) { 3033 TEST(ceil_l) {
3034 CcTest::InitializeVM(); 3034 CcTest::InitializeVM();
3035 Isolate* isolate = CcTest::i_isolate(); 3035 Isolate* isolate = CcTest::i_isolate();
3036 HandleScope scope(isolate); 3036 HandleScope scope(isolate);
3037 MacroAssembler assm(isolate, NULL, 0); 3037 MacroAssembler assm(isolate, NULL, 0, true);
3038 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult); 3038 const double dFPU64InvalidResult = static_cast<double>(kFPU64InvalidResult);
3039 typedef struct test_float { 3039 typedef struct test_float {
3040 double a; 3040 double a;
3041 float b; 3041 float b;
3042 int64_t c; 3042 int64_t c;
3043 int64_t d; 3043 int64_t d;
3044 }Test; 3044 }Test;
3045 const int kTableLength = 15; 3045 const int kTableLength = 15;
3046 double inputs_D[kTableLength] = { 3046 double inputs_D[kTableLength] = {
3047 2.1, 2.6, 2.5, 3.1, 3.6, 3.5, 3047 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; 3417 float fNegSubnorm;
3418 float fNegZero; 3418 float fNegZero;
3419 float fPosInf; 3419 float fPosInf;
3420 float fPosNorm; 3420 float fPosNorm;
3421 float fPosSubnorm; 3421 float fPosSubnorm;
3422 float fPosZero; } T; 3422 float fPosZero; } T;
3423 T t; 3423 T t;
3424 3424
3425 // Create a function that accepts &t, and loads, manipulates, and stores 3425 // Create a function that accepts &t, and loads, manipulates, and stores
3426 // the doubles t.a ... t.f. 3426 // the doubles t.a ... t.f.
3427 MacroAssembler assm(isolate, NULL, 0); 3427 MacroAssembler assm(isolate, NULL, 0, true);
3428 3428
3429 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan))); 3429 __ ldc1(f4, MemOperand(a0, offsetof(T, dSignalingNan)));
3430 __ class_d(f6, f4); 3430 __ class_d(f6, f4);
3431 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan))); 3431 __ sdc1(f6, MemOperand(a0, offsetof(T, dSignalingNan)));
3432 3432
3433 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan))); 3433 __ ldc1(f4, MemOperand(a0, offsetof(T, dQuietNan)));
3434 __ class_d(f6, f4); 3434 __ class_d(f6, f4);
3435 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan))); 3435 __ sdc1(f6, MemOperand(a0, offsetof(T, dQuietNan)));
3436 3436
3437 __ ldc1(f4, MemOperand(a0, offsetof(T, dNegInf))); 3437 __ 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); 3566 CHECK_EQ(bit_cast<int32_t>(t.fPosSubnorm), 0x100);
3567 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200); 3567 CHECK_EQ(bit_cast<int32_t>(t.fPosZero), 0x200);
3568 } 3568 }
3569 } 3569 }
3570 3570
3571 3571
3572 TEST(ABS) { 3572 TEST(ABS) {
3573 CcTest::InitializeVM(); 3573 CcTest::InitializeVM();
3574 Isolate* isolate = CcTest::i_isolate(); 3574 Isolate* isolate = CcTest::i_isolate();
3575 HandleScope scope(isolate); 3575 HandleScope scope(isolate);
3576 MacroAssembler assm(isolate, NULL, 0); 3576 MacroAssembler assm(isolate, NULL, 0, true);
3577 3577
3578 typedef struct test_float { 3578 typedef struct test_float {
3579 int64_t fir; 3579 int64_t fir;
3580 double a; 3580 double a;
3581 float b; 3581 float b;
3582 double fcsr; 3582 double fcsr;
3583 } TestFloat; 3583 } TestFloat;
3584 3584
3585 TestFloat test; 3585 TestFloat test;
3586 3586
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 3664 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
3665 CHECK_EQ(std::isnan(test.a), true); 3665 CHECK_EQ(std::isnan(test.a), true);
3666 CHECK_EQ(std::isnan(test.b), true); 3666 CHECK_EQ(std::isnan(test.b), true);
3667 } 3667 }
3668 3668
3669 3669
3670 TEST(ADD_FMT) { 3670 TEST(ADD_FMT) {
3671 CcTest::InitializeVM(); 3671 CcTest::InitializeVM();
3672 Isolate* isolate = CcTest::i_isolate(); 3672 Isolate* isolate = CcTest::i_isolate();
3673 HandleScope scope(isolate); 3673 HandleScope scope(isolate);
3674 MacroAssembler assm(isolate, NULL, 0); 3674 MacroAssembler assm(isolate, NULL, 0, true);
3675 3675
3676 typedef struct test_float { 3676 typedef struct test_float {
3677 double a; 3677 double a;
3678 double b; 3678 double b;
3679 double c; 3679 double c;
3680 float fa; 3680 float fa;
3681 float fb; 3681 float fb;
3682 float fc; 3682 float fc;
3683 } TestFloat; 3683 } TestFloat;
3684 3684
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 CHECK_EQ(std::isnan(test.c), true); 3734 CHECK_EQ(std::isnan(test.c), true);
3735 CHECK_EQ(std::isnan(test.fc), true); 3735 CHECK_EQ(std::isnan(test.fc), true);
3736 } 3736 }
3737 3737
3738 3738
3739 TEST(C_COND_FMT) { 3739 TEST(C_COND_FMT) {
3740 if (kArchVariant == kMips64r2) { 3740 if (kArchVariant == kMips64r2) {
3741 CcTest::InitializeVM(); 3741 CcTest::InitializeVM();
3742 Isolate* isolate = CcTest::i_isolate(); 3742 Isolate* isolate = CcTest::i_isolate();
3743 HandleScope scope(isolate); 3743 HandleScope scope(isolate);
3744 MacroAssembler assm(isolate, NULL, 0); 3744 MacroAssembler assm(isolate, NULL, 0, true);
3745 3745
3746 typedef struct test_float { 3746 typedef struct test_float {
3747 double dOp1; 3747 double dOp1;
3748 double dOp2; 3748 double dOp2;
3749 uint32_t dF; 3749 uint32_t dF;
3750 uint32_t dUn; 3750 uint32_t dUn;
3751 uint32_t dEq; 3751 uint32_t dEq;
3752 uint32_t dUeq; 3752 uint32_t dUeq;
3753 uint32_t dOlt; 3753 uint32_t dOlt;
3754 uint32_t dUlt; 3754 uint32_t dUlt;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 CHECK_EQ(test.fUle, 1U); 3945 CHECK_EQ(test.fUle, 1U);
3946 } 3946 }
3947 } 3947 }
3948 3948
3949 3949
3950 TEST(CMP_COND_FMT) { 3950 TEST(CMP_COND_FMT) {
3951 if (kArchVariant == kMips64r6) { 3951 if (kArchVariant == kMips64r6) {
3952 CcTest::InitializeVM(); 3952 CcTest::InitializeVM();
3953 Isolate* isolate = CcTest::i_isolate(); 3953 Isolate* isolate = CcTest::i_isolate();
3954 HandleScope scope(isolate); 3954 HandleScope scope(isolate);
3955 MacroAssembler assm(isolate, NULL, 0); 3955 MacroAssembler assm(isolate, NULL, 0, true);
3956 3956
3957 typedef struct test_float { 3957 typedef struct test_float {
3958 double dOp1; 3958 double dOp1;
3959 double dOp2; 3959 double dOp2;
3960 double dF; 3960 double dF;
3961 double dUn; 3961 double dUn;
3962 double dEq; 3962 double dEq;
3963 double dUeq; 3963 double dUeq;
3964 double dOlt; 3964 double dOlt;
3965 double dUlt; 3965 double dUlt;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
4161 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse); 4161 CHECK_EQ(bit_cast<uint32_t>(test.fOle), fFalse);
4162 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue); 4162 CHECK_EQ(bit_cast<uint32_t>(test.fUle), fTrue);
4163 } 4163 }
4164 } 4164 }
4165 4165
4166 4166
4167 TEST(CVT) { 4167 TEST(CVT) {
4168 CcTest::InitializeVM(); 4168 CcTest::InitializeVM();
4169 Isolate* isolate = CcTest::i_isolate(); 4169 Isolate* isolate = CcTest::i_isolate();
4170 HandleScope scope(isolate); 4170 HandleScope scope(isolate);
4171 MacroAssembler assm(isolate, NULL, 0); 4171 MacroAssembler assm(isolate, NULL, 0, true);
4172 4172
4173 typedef struct test_float { 4173 typedef struct test_float {
4174 float cvt_d_s_in; 4174 float cvt_d_s_in;
4175 double cvt_d_s_out; 4175 double cvt_d_s_out;
4176 int32_t cvt_d_w_in; 4176 int32_t cvt_d_w_in;
4177 double cvt_d_w_out; 4177 double cvt_d_w_out;
4178 int64_t cvt_d_l_in; 4178 int64_t cvt_d_l_in;
4179 double cvt_d_l_out; 4179 double cvt_d_l_out;
4180 4180
4181 float cvt_l_s_in; 4181 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)); 4359 CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
4360 CHECK_EQ(test.cvt_w_s_out, 0); 4360 CHECK_EQ(test.cvt_w_s_out, 0);
4361 CHECK_EQ(test.cvt_w_d_out, 0); 4361 CHECK_EQ(test.cvt_w_d_out, 0);
4362 } 4362 }
4363 4363
4364 4364
4365 TEST(DIV_FMT) { 4365 TEST(DIV_FMT) {
4366 CcTest::InitializeVM(); 4366 CcTest::InitializeVM();
4367 Isolate* isolate = CcTest::i_isolate(); 4367 Isolate* isolate = CcTest::i_isolate();
4368 HandleScope scope(isolate); 4368 HandleScope scope(isolate);
4369 MacroAssembler assm(isolate, NULL, 0); 4369 MacroAssembler assm(isolate, NULL, 0, true);
4370 4370
4371 typedef struct test { 4371 typedef struct test {
4372 double dOp1; 4372 double dOp1;
4373 double dOp2; 4373 double dOp2;
4374 double dRes; 4374 double dRes;
4375 float fOp1; 4375 float fOp1;
4376 float fOp2; 4376 float fOp2;
4377 float fRes; 4377 float fRes;
4378 } Test; 4378 } Test;
4379 4379
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); 4479 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
4480 CHECK_EQ(true, std::isnan(test.dRes)); 4480 CHECK_EQ(true, std::isnan(test.dRes));
4481 CHECK_EQ(true, std::isnan(test.fRes)); 4481 CHECK_EQ(true, std::isnan(test.fRes));
4482 } 4482 }
4483 4483
4484 4484
4485 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { 4485 uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
4486 Isolate* isolate = CcTest::i_isolate(); 4486 Isolate* isolate = CcTest::i_isolate();
4487 HandleScope scope(isolate); 4487 HandleScope scope(isolate);
4488 4488
4489 MacroAssembler assm(isolate, NULL, 0); 4489 MacroAssembler assm(isolate, NULL, 0, true);
4490 4490
4491 __ align(v0, a0, a1, bp); 4491 __ align(v0, a0, a1, bp);
4492 __ jr(ra); 4492 __ jr(ra);
4493 __ nop(); 4493 __ nop();
4494 4494
4495 CodeDesc desc; 4495 CodeDesc desc;
4496 assm.GetCode(&desc); 4496 assm.GetCode(&desc);
4497 Handle<Code> code = isolate->factory()->NewCode( 4497 Handle<Code> code = isolate->factory()->NewCode(
4498 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4498 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4499 4499
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 tc[i].bp)); 4532 tc[i].bp));
4533 } 4533 }
4534 } 4534 }
4535 } 4535 }
4536 4536
4537 4537
4538 uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { 4538 uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
4539 Isolate* isolate = CcTest::i_isolate(); 4539 Isolate* isolate = CcTest::i_isolate();
4540 HandleScope scope(isolate); 4540 HandleScope scope(isolate);
4541 4541
4542 MacroAssembler assm(isolate, NULL, 0); 4542 MacroAssembler assm(isolate, NULL, 0, true);
4543 4543
4544 __ dalign(v0, a0, a1, bp); 4544 __ dalign(v0, a0, a1, bp);
4545 __ jr(ra); 4545 __ jr(ra);
4546 __ nop(); 4546 __ nop();
4547 4547
4548 CodeDesc desc; 4548 CodeDesc desc;
4549 assm.GetCode(&desc); 4549 assm.GetCode(&desc);
4550 Handle<Code> code = isolate->factory()->NewCode( 4550 Handle<Code> code = isolate->factory()->NewCode(
4551 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4551 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4552 4552
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4590 } 4590 }
4591 } 4591 }
4592 4592
4593 4593
4594 uint64_t PC; // The program counter. 4594 uint64_t PC; // The program counter.
4595 4595
4596 uint64_t run_aluipc(int16_t offset) { 4596 uint64_t run_aluipc(int16_t offset) {
4597 Isolate* isolate = CcTest::i_isolate(); 4597 Isolate* isolate = CcTest::i_isolate();
4598 HandleScope scope(isolate); 4598 HandleScope scope(isolate);
4599 4599
4600 MacroAssembler assm(isolate, NULL, 0); 4600 MacroAssembler assm(isolate, NULL, 0, true);
4601 4601
4602 __ aluipc(v0, offset); 4602 __ aluipc(v0, offset);
4603 __ jr(ra); 4603 __ jr(ra);
4604 __ nop(); 4604 __ nop();
4605 4605
4606 CodeDesc desc; 4606 CodeDesc desc;
4607 assm.GetCode(&desc); 4607 assm.GetCode(&desc);
4608 Handle<Code> code = isolate->factory()->NewCode( 4608 Handle<Code> code = isolate->factory()->NewCode(
4609 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4609 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4610 4610
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 CHECK_EQ(expected_res, res); 4644 CHECK_EQ(expected_res, res);
4645 } 4645 }
4646 } 4646 }
4647 } 4647 }
4648 4648
4649 4649
4650 uint64_t run_auipc(int16_t offset) { 4650 uint64_t run_auipc(int16_t offset) {
4651 Isolate* isolate = CcTest::i_isolate(); 4651 Isolate* isolate = CcTest::i_isolate();
4652 HandleScope scope(isolate); 4652 HandleScope scope(isolate);
4653 4653
4654 MacroAssembler assm(isolate, NULL, 0); 4654 MacroAssembler assm(isolate, NULL, 0, true);
4655 4655
4656 __ auipc(v0, offset); 4656 __ auipc(v0, offset);
4657 __ jr(ra); 4657 __ jr(ra);
4658 __ nop(); 4658 __ nop();
4659 4659
4660 CodeDesc desc; 4660 CodeDesc desc;
4661 assm.GetCode(&desc); 4661 assm.GetCode(&desc);
4662 Handle<Code> code = isolate->factory()->NewCode( 4662 Handle<Code> code = isolate->factory()->NewCode(
4663 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 4663 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
4664 4664
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4698 CHECK_EQ(expected_res, res); 4698 CHECK_EQ(expected_res, res);
4699 } 4699 }
4700 } 4700 }
4701 } 4701 }
4702 4702
4703 4703
4704 uint64_t run_lwpc(int offset) { 4704 uint64_t run_lwpc(int offset) {
4705 Isolate* isolate = CcTest::i_isolate(); 4705 Isolate* isolate = CcTest::i_isolate();
4706 HandleScope scope(isolate); 4706 HandleScope scope(isolate);
4707 4707
4708 MacroAssembler assm(isolate, NULL, 0); 4708 MacroAssembler assm(isolate, NULL, 0, true);
4709 4709
4710 // 256k instructions; 2^8k 4710 // 256k instructions; 2^8k
4711 // addiu t3, a4, 0xffff; (0x250fffff) 4711 // addiu t3, a4, 0xffff; (0x250fffff)
4712 // ... 4712 // ...
4713 // addiu t0, a4, 0x0000; (0x250c0000) 4713 // addiu t0, a4, 0x0000; (0x250c0000)
4714 uint32_t addiu_start_1 = 0x25000000; 4714 uint32_t addiu_start_1 = 0x25000000;
4715 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 4715 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
4716 uint32_t addiu_new = addiu_start_1 + i; 4716 uint32_t addiu_new = addiu_start_1 + i;
4717 __ dd(addiu_new); 4717 __ dd(addiu_new);
4718 } 4718 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4774 CHECK_EQ(tc[i].expected_res, res); 4774 CHECK_EQ(tc[i].expected_res, res);
4775 } 4775 }
4776 } 4776 }
4777 } 4777 }
4778 4778
4779 4779
4780 uint64_t run_lwupc(int offset) { 4780 uint64_t run_lwupc(int offset) {
4781 Isolate* isolate = CcTest::i_isolate(); 4781 Isolate* isolate = CcTest::i_isolate();
4782 HandleScope scope(isolate); 4782 HandleScope scope(isolate);
4783 4783
4784 MacroAssembler assm(isolate, NULL, 0); 4784 MacroAssembler assm(isolate, NULL, 0, true);
4785 4785
4786 // 256k instructions; 2^8k 4786 // 256k instructions; 2^8k
4787 // addiu t3, a4, 0xffff; (0x250fffff) 4787 // addiu t3, a4, 0xffff; (0x250fffff)
4788 // ... 4788 // ...
4789 // addiu t0, a4, 0x0000; (0x250c0000) 4789 // addiu t0, a4, 0x0000; (0x250c0000)
4790 uint32_t addiu_start_1 = 0x25000000; 4790 uint32_t addiu_start_1 = 0x25000000;
4791 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 4791 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
4792 uint32_t addiu_new = addiu_start_1 + i; 4792 uint32_t addiu_new = addiu_start_1 + i;
4793 __ dd(addiu_new); 4793 __ dd(addiu_new);
4794 } 4794 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_jic(int16_t offset) { 4856 uint64_t run_jic(int16_t offset) {
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 Label get_program_counter, stop_execution; 4862 Label get_program_counter, stop_execution;
4863 __ push(ra); 4863 __ push(ra);
4864 __ li(v0, 0); 4864 __ li(v0, 0);
4865 __ li(t1, 0x66); 4865 __ li(t1, 0x66);
4866 4866
4867 __ addiu(v0, v0, 0x1); // <-- offset = -32 4867 __ addiu(v0, v0, 0x1); // <-- offset = -32
4868 __ addiu(v0, v0, 0x2); 4868 __ addiu(v0, v0, 0x2);
4869 __ addiu(v0, v0, 0x10); 4869 __ addiu(v0, v0, 0x10);
4870 __ addiu(v0, v0, 0x20); 4870 __ addiu(v0, v0, 0x20);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4931 CHECK_EQ(tc[i].expected_res, res); 4931 CHECK_EQ(tc[i].expected_res, res);
4932 } 4932 }
4933 } 4933 }
4934 } 4934 }
4935 4935
4936 4936
4937 uint64_t run_beqzc(int32_t value, int32_t offset) { 4937 uint64_t run_beqzc(int32_t value, int32_t offset) {
4938 Isolate* isolate = CcTest::i_isolate(); 4938 Isolate* isolate = CcTest::i_isolate();
4939 HandleScope scope(isolate); 4939 HandleScope scope(isolate);
4940 4940
4941 MacroAssembler assm(isolate, NULL, 0); 4941 MacroAssembler assm(isolate, NULL, 0, true);
4942 4942
4943 Label stop_execution; 4943 Label stop_execution;
4944 __ li(v0, 0); 4944 __ li(v0, 0);
4945 __ li(t1, 0x66); 4945 __ li(t1, 0x66);
4946 4946
4947 __ addiu(v0, v0, 0x1); // <-- offset = -8 4947 __ addiu(v0, v0, 0x1); // <-- offset = -8
4948 __ addiu(v0, v0, 0x2); 4948 __ addiu(v0, v0, 0x2);
4949 __ addiu(v0, v0, 0x10); 4949 __ addiu(v0, v0, 0x10);
4950 __ addiu(v0, v0, 0x20); 4950 __ addiu(v0, v0, 0x20);
4951 __ beq(v0, t1, &stop_execution); 4951 __ 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); 5004 CHECK_EQ(tc[i].expected_res, res);
5005 } 5005 }
5006 } 5006 }
5007 } 5007 }
5008 5008
5009 5009
5010 uint64_t run_jialc(int16_t offset) { 5010 uint64_t run_jialc(int16_t offset) {
5011 Isolate* isolate = CcTest::i_isolate(); 5011 Isolate* isolate = CcTest::i_isolate();
5012 HandleScope scope(isolate); 5012 HandleScope scope(isolate);
5013 5013
5014 MacroAssembler assm(isolate, NULL, 0); 5014 MacroAssembler assm(isolate, NULL, 0, true);
5015 5015
5016 Label main_block, get_program_counter; 5016 Label main_block, get_program_counter;
5017 __ push(ra); 5017 __ push(ra);
5018 __ li(v0, 0); 5018 __ li(v0, 0);
5019 __ beq(v0, v0, &main_block); 5019 __ beq(v0, v0, &main_block);
5020 __ nop(); 5020 __ nop();
5021 5021
5022 // Block 1 5022 // Block 1
5023 __ addiu(v0, v0, 0x1); // <-- offset = -40 5023 __ addiu(v0, v0, 0x1); // <-- offset = -40
5024 __ addiu(v0, v0, 0x2); 5024 __ addiu(v0, v0, 0x2);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
5098 CHECK_EQ(tc[i].expected_res, res); 5098 CHECK_EQ(tc[i].expected_res, res);
5099 } 5099 }
5100 } 5100 }
5101 } 5101 }
5102 5102
5103 5103
5104 uint64_t run_addiupc(int32_t imm19) { 5104 uint64_t run_addiupc(int32_t imm19) {
5105 Isolate* isolate = CcTest::i_isolate(); 5105 Isolate* isolate = CcTest::i_isolate();
5106 HandleScope scope(isolate); 5106 HandleScope scope(isolate);
5107 5107
5108 MacroAssembler assm(isolate, NULL, 0); 5108 MacroAssembler assm(isolate, NULL, 0, true);
5109 5109
5110 __ addiupc(v0, imm19); 5110 __ addiupc(v0, imm19);
5111 __ jr(ra); 5111 __ jr(ra);
5112 __ nop(); 5112 __ nop();
5113 5113
5114 CodeDesc desc; 5114 CodeDesc desc;
5115 assm.GetCode(&desc); 5115 assm.GetCode(&desc);
5116 Handle<Code> code = isolate->factory()->NewCode( 5116 Handle<Code> code = isolate->factory()->NewCode(
5117 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5117 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5118 5118
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 CHECK_EQ(expected_res, res); 5152 CHECK_EQ(expected_res, res);
5153 } 5153 }
5154 } 5154 }
5155 } 5155 }
5156 5156
5157 5157
5158 uint64_t run_ldpc(int offset) { 5158 uint64_t run_ldpc(int offset) {
5159 Isolate* isolate = CcTest::i_isolate(); 5159 Isolate* isolate = CcTest::i_isolate();
5160 HandleScope scope(isolate); 5160 HandleScope scope(isolate);
5161 5161
5162 MacroAssembler assm(isolate, NULL, 0); 5162 MacroAssembler assm(isolate, NULL, 0, true);
5163 5163
5164 // 256k instructions; 2 * 2^7k = 2^8k 5164 // 256k instructions; 2 * 2^7k = 2^8k
5165 // addiu t3, a4, 0xffff; (0x250fffff) 5165 // addiu t3, a4, 0xffff; (0x250fffff)
5166 // ... 5166 // ...
5167 // addiu t0, a4, 0x0000; (0x250c0000) 5167 // addiu t0, a4, 0x0000; (0x250c0000)
5168 uint32_t addiu_start_1 = 0x25000000; 5168 uint32_t addiu_start_1 = 0x25000000;
5169 for (int32_t i = 0xfffff; i >= 0xc0000; --i) { 5169 for (int32_t i = 0xfffff; i >= 0xc0000; --i) {
5170 uint32_t addiu_new = addiu_start_1 + i; 5170 uint32_t addiu_new = addiu_start_1 + i;
5171 __ dd(addiu_new); 5171 __ dd(addiu_new);
5172 } 5172 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5227 CHECK_EQ(tc[i].expected_res, res); 5227 CHECK_EQ(tc[i].expected_res, res);
5228 } 5228 }
5229 } 5229 }
5230 } 5230 }
5231 5231
5232 5232
5233 int64_t run_bc(int32_t offset) { 5233 int64_t run_bc(int32_t offset) {
5234 Isolate* isolate = CcTest::i_isolate(); 5234 Isolate* isolate = CcTest::i_isolate();
5235 HandleScope scope(isolate); 5235 HandleScope scope(isolate);
5236 5236
5237 MacroAssembler assm(isolate, NULL, 0); 5237 MacroAssembler assm(isolate, NULL, 0, true);
5238 5238
5239 Label continue_1, stop_execution; 5239 Label continue_1, stop_execution;
5240 __ push(ra); 5240 __ push(ra);
5241 __ li(v0, 0); 5241 __ li(v0, 0);
5242 __ li(t8, 0); 5242 __ li(t8, 0);
5243 __ li(t9, 2); // Condition for the stopping execution. 5243 __ li(t9, 2); // Condition for the stopping execution.
5244 5244
5245 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 5245 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1
5246 for (int32_t i = -100; i <= -11; ++i) { 5246 for (int32_t i = -100; i <= -11; ++i) {
5247 __ dd(instruction_addiu); 5247 __ dd(instruction_addiu);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5308 CHECK_EQ(tc[i].expected_res, res); 5308 CHECK_EQ(tc[i].expected_res, res);
5309 } 5309 }
5310 } 5310 }
5311 } 5311 }
5312 5312
5313 5313
5314 int64_t run_balc(int32_t offset) { 5314 int64_t run_balc(int32_t offset) {
5315 Isolate* isolate = CcTest::i_isolate(); 5315 Isolate* isolate = CcTest::i_isolate();
5316 HandleScope scope(isolate); 5316 HandleScope scope(isolate);
5317 5317
5318 MacroAssembler assm(isolate, NULL, 0); 5318 MacroAssembler assm(isolate, NULL, 0, true);
5319 5319
5320 Label continue_1, stop_execution; 5320 Label continue_1, stop_execution;
5321 __ push(ra); 5321 __ push(ra);
5322 __ li(v0, 0); 5322 __ li(v0, 0);
5323 __ li(t8, 0); 5323 __ li(t8, 0);
5324 __ li(t9, 2); // Condition for stopping execution. 5324 __ li(t9, 2); // Condition for stopping execution.
5325 5325
5326 __ beq(t8, t8, &continue_1); 5326 __ beq(t8, t8, &continue_1);
5327 __ nop(); 5327 __ nop();
5328 5328
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5389 CHECK_EQ(tc[i].expected_res, res); 5389 CHECK_EQ(tc[i].expected_res, res);
5390 } 5390 }
5391 } 5391 }
5392 } 5392 }
5393 5393
5394 5394
5395 uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) { 5395 uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) {
5396 Isolate* isolate = CcTest::i_isolate(); 5396 Isolate* isolate = CcTest::i_isolate();
5397 HandleScope scope(isolate); 5397 HandleScope scope(isolate);
5398 5398
5399 MacroAssembler assm(isolate, NULL, 0); 5399 MacroAssembler assm(isolate, NULL, 0, true);
5400 5400
5401 __ dsll(v0, a0, sa_value); 5401 __ dsll(v0, a0, sa_value);
5402 __ jr(ra); 5402 __ jr(ra);
5403 __ nop(); 5403 __ nop();
5404 5404
5405 CodeDesc desc; 5405 CodeDesc desc;
5406 assm.GetCode(&desc); 5406 assm.GetCode(&desc);
5407 Handle<Code> code = isolate->factory()->NewCode( 5407 Handle<Code> code = isolate->factory()->NewCode(
5408 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5408 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5409 5409
(...skipping 27 matching lines...) Expand all
5437 CHECK_EQ(tc[i].expected_res, 5437 CHECK_EQ(tc[i].expected_res,
5438 run_dsll(tc[i].rt_value, tc[i].sa_value)); 5438 run_dsll(tc[i].rt_value, tc[i].sa_value));
5439 } 5439 }
5440 } 5440 }
5441 5441
5442 5442
5443 uint64_t run_bal(int16_t offset) { 5443 uint64_t run_bal(int16_t offset) {
5444 Isolate* isolate = CcTest::i_isolate(); 5444 Isolate* isolate = CcTest::i_isolate();
5445 HandleScope scope(isolate); 5445 HandleScope scope(isolate);
5446 5446
5447 MacroAssembler assm(isolate, NULL, 0); 5447 MacroAssembler assm(isolate, NULL, 0, true);
5448 5448
5449 __ mov(t0, ra); 5449 __ mov(t0, ra);
5450 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset". 5450 __ bal(offset); // Equivalent for "BGEZAL zero_reg, offset".
5451 __ nop(); 5451 __ nop();
5452 5452
5453 __ mov(ra, t0); 5453 __ mov(ra, t0);
5454 __ jr(ra); 5454 __ jr(ra);
5455 __ nop(); 5455 __ nop();
5456 5456
5457 __ li(v0, 1); 5457 __ li(v0, 1);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5493 5493
5494 5494
5495 TEST(Trampoline) { 5495 TEST(Trampoline) {
5496 // Private member of Assembler class. 5496 // Private member of Assembler class.
5497 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; 5497 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1;
5498 5498
5499 CcTest::InitializeVM(); 5499 CcTest::InitializeVM();
5500 Isolate* isolate = CcTest::i_isolate(); 5500 Isolate* isolate = CcTest::i_isolate();
5501 HandleScope scope(isolate); 5501 HandleScope scope(isolate);
5502 5502
5503 MacroAssembler assm(isolate, nullptr, 0); 5503 MacroAssembler assm(isolate, nullptr, 0, true);
5504 Label done; 5504 Label done;
5505 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; 5505 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2;
5506 5506
5507 for (size_t i = 0; i < nr_calls; ++i) { 5507 for (size_t i = 0; i < nr_calls; ++i) {
5508 __ BranchShort(&done, eq, a0, Operand(a1)); 5508 __ BranchShort(&done, eq, a0, Operand(a1));
5509 } 5509 }
5510 __ bind(&done); 5510 __ bind(&done);
5511 __ Ret(USE_DELAY_SLOT); 5511 __ Ret(USE_DELAY_SLOT);
5512 __ mov(v0, zero_reg); 5512 __ mov(v0, zero_reg);
5513 5513
5514 CodeDesc desc; 5514 CodeDesc desc;
5515 assm.GetCode(&desc); 5515 assm.GetCode(&desc);
5516 Handle<Code> code = isolate->factory()->NewCode( 5516 Handle<Code> code = isolate->factory()->NewCode(
5517 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5517 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5518 F2 f = FUNCTION_CAST<F2>(code->entry()); 5518 F2 f = FUNCTION_CAST<F2>(code->entry());
5519 5519
5520 int64_t res = reinterpret_cast<int64_t>( 5520 int64_t res = reinterpret_cast<int64_t>(
5521 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5521 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5522 CHECK_EQ(res, 0); 5522 CHECK_EQ(res, 0);
5523 } 5523 }
5524 5524
5525 5525
5526 #undef __ 5526 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698