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 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 for (int i = 0; i < kTableLength; i++) { | 1796 for (int i = 0; i < kTableLength; i++) { |
1797 test.a = inputs[i]; | 1797 test.a = inputs[i]; |
1798 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); | 1798 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
1799 CHECK_EQ(test.b, outputs[j][i]); | 1799 CHECK_EQ(test.b, outputs[j][i]); |
1800 } | 1800 } |
1801 } | 1801 } |
1802 } | 1802 } |
1803 } | 1803 } |
1804 | 1804 |
1805 | 1805 |
| 1806 TEST(Cvt_d_uw) { |
| 1807 if (IsMipsArchVariant(kMips32r2)) { |
| 1808 CcTest::InitializeVM(); |
| 1809 Isolate* isolate = CcTest::i_isolate(); |
| 1810 HandleScope scope(isolate); |
| 1811 MacroAssembler assm(isolate, NULL, 0); |
| 1812 |
| 1813 typedef struct test_struct { |
| 1814 unsigned input; |
| 1815 uint64_t output; |
| 1816 } TestStruct; |
| 1817 |
| 1818 unsigned inputs[] = { |
| 1819 0x0, 0xffffffff, 0x80000000, 0x7fffffff |
| 1820 }; |
| 1821 |
| 1822 uint64_t outputs[] = { |
| 1823 0x0, 0x41efffffffe00000, |
| 1824 0x41e0000000000000, 0x41dfffffffc00000 |
| 1825 }; |
| 1826 |
| 1827 int kTableLength = sizeof(inputs)/sizeof(inputs[0]); |
| 1828 |
| 1829 TestStruct test; |
| 1830 |
| 1831 __ lw(t1, MemOperand(a0, offsetof(TestStruct, input))); |
| 1832 __ Cvt_d_uw(f4, t1, f6); |
| 1833 __ sdc1(f4, MemOperand(a0, offsetof(TestStruct, output))); |
| 1834 __ jr(ra); |
| 1835 __ nop(); |
| 1836 |
| 1837 CodeDesc desc; |
| 1838 assm.GetCode(&desc); |
| 1839 Handle<Code> code = isolate->factory()->NewCode( |
| 1840 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1841 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1842 for (int i = 0; i < kTableLength; i++) { |
| 1843 test.input = inputs[i]; |
| 1844 (CALL_GENERATED_CODE(f, &test, 0, 0, 0, 0)); |
| 1845 // Check outputs |
| 1846 CHECK_EQ(test.output, outputs[i]); |
| 1847 } |
| 1848 } |
| 1849 } |
| 1850 |
| 1851 |
1806 TEST(mina_maxa) { | 1852 TEST(mina_maxa) { |
1807 if (IsMipsArchVariant(kMips32r6)) { | 1853 if (IsMipsArchVariant(kMips32r6)) { |
1808 const int kTableLength = 15; | 1854 const int kTableLength = 15; |
1809 CcTest::InitializeVM(); | 1855 CcTest::InitializeVM(); |
1810 Isolate* isolate = CcTest::i_isolate(); | 1856 Isolate* isolate = CcTest::i_isolate(); |
1811 HandleScope scope(isolate); | 1857 HandleScope scope(isolate); |
1812 MacroAssembler assm(isolate, NULL, 0); | 1858 MacroAssembler assm(isolate, NULL, 0); |
1813 const double double_nan = std::numeric_limits<double>::quiet_NaN(); | 1859 const double double_nan = std::numeric_limits<double>::quiet_NaN(); |
1814 const float float_nan = std::numeric_limits<float>::quiet_NaN(); | 1860 const float float_nan = std::numeric_limits<float>::quiet_NaN(); |
1815 | 1861 |
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5142 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5188 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5143 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5189 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5144 | 5190 |
5145 int32_t res = | 5191 int32_t res = |
5146 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(f, 42, 42, 0, 0, 0)); | 5192 reinterpret_cast<int32_t>(CALL_GENERATED_CODE(f, 42, 42, 0, 0, 0)); |
5147 CHECK_EQ(res, 0); | 5193 CHECK_EQ(res, 0); |
5148 } | 5194 } |
5149 | 5195 |
5150 | 5196 |
5151 #undef __ | 5197 #undef __ |
OLD | NEW |