OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... | |
41 using namespace v8::internal; | 41 using namespace v8::internal; |
42 | 42 |
43 | 43 |
44 // Define these function prototypes to match JSEntryFunction in execution.cc. | 44 // Define these function prototypes to match JSEntryFunction in execution.cc. |
45 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); | 45 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); |
46 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); | 46 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); |
47 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); | 47 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); |
48 | 48 |
49 | 49 |
50 #define __ assm. | 50 #define __ assm. |
51 TEST(MIPS16) { | |
52 CcTest::InitializeVM(); | |
paul.l...
2015/03/31 04:02:01
Test needs to be run only on mips32r6 - it uses r6
| |
53 Isolate* isolate = CcTest::i_isolate(); | |
54 HandleScope scope(isolate); | |
55 MacroAssembler assm(isolate, NULL, 0); | |
56 | |
57 typedef struct test { | |
58 int a; | |
59 int b; | |
60 int c; | |
61 int d; | |
62 double e; | |
63 double f; | |
64 double g; | |
65 double h; | |
66 double i; | |
67 double j; | |
68 double k; | |
69 double l; | |
70 } Test; | |
71 | |
72 Test test; | |
73 // integer part of test | |
74 __ addiu(t1, zero_reg, 1); // t1=1 | |
75 __ seleqz(t1, zero_reg, t3); // t3=1 | |
76 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, a))); // a=1 | |
77 __ seleqz(t1, t1, t2); // t2=0 | |
78 __ sw(t2, MemOperand(a0, OFFSET_OF(Test, b))); // b=0 | |
79 __ selnez(t1, zero_reg, t3); // t3=1; | |
80 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, c))); // c=0 | |
81 __ selnez(t1, t1, t3); // t3=1 | |
82 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, d))); // d=1 | |
83 // floating point part of test S format | |
84 __ li(t0, 0x80); | |
85 __ mtc1(t0, f4); | |
86 __ cvt_d_w(f4, f4); // f4=0x80 | |
87 __ li(t0, 0xf3); | |
88 __ mtc1(t0, f6); | |
89 __ cvt_d_w(f6, f6); // f6=0xf3 | |
90 __ seleqz(S, f8, f4, f6); // f8=0xf3 | |
91 __ seleqz(S, f10, f6, f6); // f10=0 | |
92 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, e))); // e=0xf3 | |
93 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, f))); // f=0 | |
94 __ selnez(S, f8, f4, f6); // f8=0 | |
95 __ selnez(S, f10, f6, f6); // f10=0xf3*/ | |
96 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, g))); // g=0 | |
97 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, h))); // h=0xf3 | |
98 | |
99 __ li(t0, 0x80); | |
100 __ mtc1(t0, f4); | |
101 __ cvt_d_w(f4, f4); // f4=0x80 | |
102 __ li(t0, 0xf3); | |
103 __ mtc1(t0, f6); | |
104 __ cvt_d_w(f6, f6); // f6=0xf3 | |
105 __ seleqz(D, f8, f4, f6); // f8=0xf3 | |
106 __ seleqz(D, f10, f6, f6); // f10=0 | |
107 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, i))); // i=0xf3 | |
108 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, j))); // j=0 | |
109 __ selnez(S, f8, f4, f6); // f8=0 | |
110 __ selnez(S, f10, f6, f6); // f10=0xf3*/ | |
111 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, k))); // k=0 | |
112 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, l))); // l=0xf3 | |
113 __ jr(ra); | |
114 __ nop(); | |
115 CodeDesc desc; | |
116 assm.GetCode(&desc); | |
117 Handle<Code> code = isolate->factory()->NewCode( | |
118 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | |
119 F3 f = FUNCTION_CAST<F3>(code->entry()); | |
120 | |
121 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | |
122 | |
123 CHECK_EQ(test.a, 1); | |
124 CHECK_EQ(test.b, 0); | |
125 CHECK_EQ(test.c, 0); | |
126 CHECK_EQ(test.d, 1); | |
127 | |
128 CHECK_EQ(test.e, 0xf3); | |
129 CHECK_EQ(test.f, 0x0); | |
130 CHECK_EQ(test.g, 0); | |
131 CHECK_EQ(test.h, 0xf3); | |
132 | |
133 CHECK_EQ(test.i, 0xf3); | |
134 CHECK_EQ(test.j, 0x0); | |
135 CHECK_EQ(test.k, 0); | |
136 CHECK_EQ(test.l, 0xf3); | |
137 } | |
51 | 138 |
52 | 139 |
53 TEST(MIPS0) { | 140 TEST(MIPS0) { |
54 CcTest::InitializeVM(); | 141 CcTest::InitializeVM(); |
55 Isolate* isolate = CcTest::i_isolate(); | 142 Isolate* isolate = CcTest::i_isolate(); |
56 HandleScope scope(isolate); | 143 HandleScope scope(isolate); |
57 | 144 |
58 MacroAssembler assm(isolate, NULL, 0); | 145 MacroAssembler assm(isolate, NULL, 0); |
59 | 146 |
60 // Addition. | 147 // Addition. |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 ::printf("f(%d) = ", i); | 1568 ::printf("f(%d) = ", i); |
1482 result->Print(std::cout); | 1569 result->Print(std::cout); |
1483 ::printf("\n"); | 1570 ::printf("\n"); |
1484 #endif | 1571 #endif |
1485 CHECK(values[i].is_identical_to(result)); | 1572 CHECK(values[i].is_identical_to(result)); |
1486 } | 1573 } |
1487 } | 1574 } |
1488 | 1575 |
1489 | 1576 |
1490 #undef __ | 1577 #undef __ |
OLD | NEW |