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 | 41 |
42 | 42 |
43 // Define these function prototypes to match JSEntryFunction in execution.cc. | 43 // Define these function prototypes to match JSEntryFunction in execution.cc. |
44 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); | 44 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); |
45 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); | 45 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); |
46 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); | 46 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); |
47 | 47 |
48 | 48 |
49 #define __ assm. | 49 #define __ assm. |
50 | 50 |
| 51 TEST(MIPS17) { |
| 52 if (kArchVariant == kMips64r6) { |
| 53 CcTest::InitializeVM(); |
| 54 Isolate* isolate = CcTest::i_isolate(); |
| 55 HandleScope scope(isolate); |
| 56 MacroAssembler assm(isolate, NULL, 0); |
| 57 |
| 58 typedef struct test { |
| 59 int a; |
| 60 int b; |
| 61 int c; |
| 62 int d; |
| 63 double i; |
| 64 double j; |
| 65 double k; |
| 66 double l; |
| 67 } Test; |
| 68 |
| 69 Test test; |
| 70 // integer part of test |
| 71 __ addiu(t1, zero_reg, 1); // t1=1 |
| 72 __ seleqz(t1, zero_reg, t3); // t3=1 |
| 73 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, a))); // a=1 |
| 74 __ seleqz(t1, t1, t2); // t2=0 |
| 75 __ sw(t2, MemOperand(a0, OFFSET_OF(Test, b))); // b=0 |
| 76 __ selnez(t1, zero_reg, t3); // t3=1; |
| 77 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, c))); // c=0 |
| 78 __ selnez(t1, t1, t3); // t3=1 |
| 79 __ sw(t3, MemOperand(a0, OFFSET_OF(Test, d))); // d=1 |
| 80 // floating point part of test |
| 81 __ li(t0, 0x80); |
| 82 __ mtc1(t0, f4); |
| 83 __ cvt_d_w(f4, f4); // f4=0x80 |
| 84 __ li(t0, 0xf3); |
| 85 __ mtc1(t0, f6); |
| 86 __ cvt_d_w(f6, f6); // f6=0xf3 |
| 87 __ seleqz(D, f8, f4, f6); // f8=0xf3 |
| 88 __ seleqz(D, f10, f6, f6); // f10=0 |
| 89 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, i))); // i=0xf3 |
| 90 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, j))); // j=0 |
| 91 __ selnez(D, f8, f4, f6); // f8=0 |
| 92 __ selnez(D, f10, f6, f6); // f10=0xf3*/ |
| 93 __ sdc1(f8, MemOperand(a0, OFFSET_OF(Test, k))); // k=0 |
| 94 __ sdc1(f10, MemOperand(a0, OFFSET_OF(Test, l))); // l=0xf3 |
| 95 __ jr(ra); |
| 96 __ nop(); |
| 97 CodeDesc desc; |
| 98 assm.GetCode(&desc); |
| 99 Handle<Code> code = isolate->factory()->NewCode( |
| 100 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 101 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 102 |
| 103 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
| 104 |
| 105 CHECK_EQ(test.a, 1); |
| 106 CHECK_EQ(test.b, 0); |
| 107 CHECK_EQ(test.c, 0); |
| 108 CHECK_EQ(test.d, 1); |
| 109 |
| 110 CHECK_EQ(test.i, 0xf3); |
| 111 CHECK_EQ(test.j, 0x0); |
| 112 CHECK_EQ(test.k, 0); |
| 113 CHECK_EQ(test.l, 0xf3); |
| 114 } |
| 115 } |
| 116 |
51 | 117 |
52 TEST(MIPS0) { | 118 TEST(MIPS0) { |
53 CcTest::InitializeVM(); | 119 CcTest::InitializeVM(); |
54 Isolate* isolate = CcTest::i_isolate(); | 120 Isolate* isolate = CcTest::i_isolate(); |
55 HandleScope scope(isolate); | 121 HandleScope scope(isolate); |
56 | 122 |
57 MacroAssembler assm(isolate, NULL, 0); | 123 MacroAssembler assm(isolate, NULL, 0); |
58 | 124 |
59 // Addition. | 125 // Addition. |
60 __ addu(v0, a0, a1); | 126 __ addu(v0, a0, a1); |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 ::printf("f(%d) = ", i); | 1669 ::printf("f(%d) = ", i); |
1604 result->Print(std::cout); | 1670 result->Print(std::cout); |
1605 ::printf("\n"); | 1671 ::printf("\n"); |
1606 #endif | 1672 #endif |
1607 CHECK(values[i].is_identical_to(result)); | 1673 CHECK(values[i].is_identical_to(result)); |
1608 } | 1674 } |
1609 } | 1675 } |
1610 | 1676 |
1611 | 1677 |
1612 #undef __ | 1678 #undef __ |
OLD | NEW |