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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 for (int i = 0; i < kTableLength; i++) { | 1805 for (int i = 0; i < kTableLength; i++) { |
1806 test.a = inputs[i]; | 1806 test.a = inputs[i]; |
1807 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); | 1807 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
1808 CHECK_EQ(test.b, outputs[j][i]); | 1808 CHECK_EQ(test.b, outputs[j][i]); |
1809 } | 1809 } |
1810 } | 1810 } |
1811 } | 1811 } |
1812 } | 1812 } |
1813 | 1813 |
1814 | 1814 |
| 1815 TEST(Cvt_d_uw) { |
| 1816 if (IsMipsArchVariant(kMips32r2)) { |
| 1817 CcTest::InitializeVM(); |
| 1818 Isolate* isolate = CcTest::i_isolate(); |
| 1819 HandleScope scope(isolate); |
| 1820 MacroAssembler assm(isolate, NULL, 0, |
| 1821 v8::internal::CodeObjectRequired::kYes); |
| 1822 |
| 1823 typedef struct test_struct { |
| 1824 unsigned input; |
| 1825 uint64_t output; |
| 1826 } TestStruct; |
| 1827 |
| 1828 unsigned inputs[] = { |
| 1829 0x0, 0xffffffff, 0x80000000, 0x7fffffff |
| 1830 }; |
| 1831 |
| 1832 uint64_t outputs[] = { |
| 1833 0x0, 0x41efffffffe00000, |
| 1834 0x41e0000000000000, 0x41dfffffffc00000 |
| 1835 }; |
| 1836 |
| 1837 int kTableLength = sizeof(inputs)/sizeof(inputs[0]); |
| 1838 |
| 1839 TestStruct test; |
| 1840 |
| 1841 __ lw(t1, MemOperand(a0, offsetof(TestStruct, input))); |
| 1842 __ Cvt_d_uw(f4, t1, f6); |
| 1843 __ sdc1(f4, MemOperand(a0, offsetof(TestStruct, output))); |
| 1844 __ jr(ra); |
| 1845 __ nop(); |
| 1846 |
| 1847 CodeDesc desc; |
| 1848 assm.GetCode(&desc); |
| 1849 Handle<Code> code = isolate->factory()->NewCode( |
| 1850 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1851 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1852 for (int i = 0; i < kTableLength; i++) { |
| 1853 test.input = inputs[i]; |
| 1854 (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); |
| 1855 // Check outputs |
| 1856 CHECK_EQ(test.output, outputs[i]); |
| 1857 } |
| 1858 } |
| 1859 } |
| 1860 |
| 1861 |
1815 TEST(mina_maxa) { | 1862 TEST(mina_maxa) { |
1816 if (IsMipsArchVariant(kMips32r6)) { | 1863 if (IsMipsArchVariant(kMips32r6)) { |
1817 const int kTableLength = 15; | 1864 const int kTableLength = 15; |
1818 CcTest::InitializeVM(); | 1865 CcTest::InitializeVM(); |
1819 Isolate* isolate = CcTest::i_isolate(); | 1866 Isolate* isolate = CcTest::i_isolate(); |
1820 HandleScope scope(isolate); | 1867 HandleScope scope(isolate); |
1821 MacroAssembler assm(isolate, NULL, 0, | 1868 MacroAssembler assm(isolate, NULL, 0, |
1822 v8::internal::CodeObjectRequired::kYes); | 1869 v8::internal::CodeObjectRequired::kYes); |
1823 const double double_nan = std::numeric_limits<double>::quiet_NaN(); | 1870 const double double_nan = std::numeric_limits<double>::quiet_NaN(); |
1824 const float float_nan = std::numeric_limits<float>::quiet_NaN(); | 1871 const float float_nan = std::numeric_limits<float>::quiet_NaN(); |
(...skipping 3338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5163 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5210 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5164 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5211 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5165 | 5212 |
5166 int32_t res = reinterpret_cast<int32_t>( | 5213 int32_t res = reinterpret_cast<int32_t>( |
5167 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5214 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5168 CHECK_EQ(res, 0); | 5215 CHECK_EQ(res, 0); |
5169 } | 5216 } |
5170 | 5217 |
5171 | 5218 |
5172 #undef __ | 5219 #undef __ |
OLD | NEW |