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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 CHECK_EQ(ex, t.field[1]); \ | 1226 CHECK_EQ(ex, t.field[1]); \ |
1227 CHECK_EQ(ex, t.field[2]); \ | 1227 CHECK_EQ(ex, t.field[2]); \ |
1228 CHECK_EQ(ex, t.field[3]); | 1228 CHECK_EQ(ex, t.field[3]); |
1229 | 1229 |
1230 #define CHECK_EQ_32X4(field, ex0, ex1, ex2, ex3) \ | 1230 #define CHECK_EQ_32X4(field, ex0, ex1, ex2, ex3) \ |
1231 CHECK_EQ(ex0, t.field[0]); \ | 1231 CHECK_EQ(ex0, t.field[0]); \ |
1232 CHECK_EQ(ex1, t.field[1]); \ | 1232 CHECK_EQ(ex1, t.field[1]); \ |
1233 CHECK_EQ(ex2, t.field[2]); \ | 1233 CHECK_EQ(ex2, t.field[2]); \ |
1234 CHECK_EQ(ex3, t.field[3]); | 1234 CHECK_EQ(ex3, t.field[3]); |
1235 | 1235 |
| 1236 #define CHECK_ESTIMATE(expected, tolerance, value) \ |
| 1237 CHECK_LT((expected) - (tolerance), value); \ |
| 1238 CHECK_GT((expected) + (tolerance), value); |
| 1239 |
| 1240 #define CHECK_ESTIMATE_SPLAT(field, ex, tol) \ |
| 1241 CHECK_ESTIMATE(ex, tol, t.field[0]); \ |
| 1242 CHECK_ESTIMATE(ex, tol, t.field[1]); \ |
| 1243 CHECK_ESTIMATE(ex, tol, t.field[2]); \ |
| 1244 CHECK_ESTIMATE(ex, tol, t.field[3]); |
| 1245 |
1236 #define INT32_TO_FLOAT(val) \ | 1246 #define INT32_TO_FLOAT(val) \ |
1237 std::round(static_cast<float>(bit_cast<int32_t>(val))) | 1247 std::round(static_cast<float>(bit_cast<int32_t>(val))) |
1238 #define UINT32_TO_FLOAT(val) \ | 1248 #define UINT32_TO_FLOAT(val) \ |
1239 std::round(static_cast<float>(bit_cast<uint32_t>(val))) | 1249 std::round(static_cast<float>(bit_cast<uint32_t>(val))) |
1240 | 1250 |
1241 TEST(15) { | 1251 TEST(15) { |
1242 // Test the Neon instructions. | 1252 // Test the Neon instructions. |
1243 CcTest::InitializeVM(); | 1253 CcTest::InitializeVM(); |
1244 Isolate* isolate = CcTest::i_isolate(); | 1254 Isolate* isolate = CcTest::i_isolate(); |
1245 HandleScope scope(isolate); | 1255 HandleScope scope(isolate); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 CHECK_EQ_32X4(vabs_s16, 0x7f7f7f7fu, 0x01010101u, 0x00010001u, 0x7f807f80u); | 1825 CHECK_EQ_32X4(vabs_s16, 0x7f7f7f7fu, 0x01010101u, 0x00010001u, 0x7f807f80u); |
1816 CHECK_EQ_32X4(vabs_s32, 0x7f7f7f7fu, 0x01010101u, 0x00000001u, 0x7f7f7f80u); | 1826 CHECK_EQ_32X4(vabs_s32, 0x7f7f7f7fu, 0x01010101u, 0x00000001u, 0x7f7f7f80u); |
1817 CHECK_EQ_32X4(vneg_s8, 0x81818181u, 0xffffffffu, 0x01010101u, 0x80808080u); | 1827 CHECK_EQ_32X4(vneg_s8, 0x81818181u, 0xffffffffu, 0x01010101u, 0x80808080u); |
1818 CHECK_EQ_32X4(vneg_s16, 0x80818081u, 0xfefffeffu, 0x00010001u, 0x7f807f80u); | 1828 CHECK_EQ_32X4(vneg_s16, 0x80818081u, 0xfefffeffu, 0x00010001u, 0x7f807f80u); |
1819 CHECK_EQ_32X4(vneg_s32, 0x80808081u, 0xfefefeffu, 0x00000001u, 0x7f7f7f80u); | 1829 CHECK_EQ_32X4(vneg_s32, 0x80808081u, 0xfefefeffu, 0x00000001u, 0x7f7f7f80u); |
1820 | 1830 |
1821 CHECK_EQ_SPLAT(veor, 0x00ff00ffu); | 1831 CHECK_EQ_SPLAT(veor, 0x00ff00ffu); |
1822 CHECK_EQ_SPLAT(vaddf, 2.0); | 1832 CHECK_EQ_SPLAT(vaddf, 2.0); |
1823 CHECK_EQ_SPLAT(vsubf, -1.0); | 1833 CHECK_EQ_SPLAT(vsubf, -1.0); |
1824 CHECK_EQ_SPLAT(vmulf, 4.0); | 1834 CHECK_EQ_SPLAT(vmulf, 4.0); |
1825 CHECK_EQ_SPLAT(vrecpe, 0.5f); // 1 / 2 | 1835 CHECK_ESTIMATE_SPLAT(vrecpe, 0.5f, 0.1f); // 1 / 2 |
1826 CHECK_EQ_SPLAT(vrecps, -1.0f); // 2 - (2 * 1.5) | 1836 CHECK_EQ_SPLAT(vrecps, -1.0f); // 2 - (2 * 1.5) |
1827 CHECK_EQ_SPLAT(vrsqrte, 0.5f); // 1 / sqrt(4) | 1837 CHECK_ESTIMATE_SPLAT(vrsqrte, 0.5f, 0.1f); // 1 / sqrt(4) |
1828 CHECK_EQ_SPLAT(vrsqrts, -1.0f); // (3 - (2 * 2.5)) / 2 | 1838 CHECK_EQ_SPLAT(vrsqrts, -1.0f); // (3 - (2 * 2.5)) / 2 |
1829 CHECK_EQ_SPLAT(vceqf, 0xffffffffu); | 1839 CHECK_EQ_SPLAT(vceqf, 0xffffffffu); |
1830 // [0] >= [-1, 1, -0, 0] | 1840 // [0] >= [-1, 1, -0, 0] |
1831 CHECK_EQ_32X4(vcgef, 0u, 0xffffffffu, 0xffffffffu, 0xffffffffu); | 1841 CHECK_EQ_32X4(vcgef, 0u, 0xffffffffu, 0xffffffffu, 0xffffffffu); |
1832 CHECK_EQ_32X4(vcgtf, 0u, 0xffffffffu, 0u, 0u); | 1842 CHECK_EQ_32X4(vcgtf, 0u, 0xffffffffu, 0u, 0u); |
1833 CHECK_EQ_SPLAT(vadd8, 0x03030303u); | 1843 CHECK_EQ_SPLAT(vadd8, 0x03030303u); |
1834 CHECK_EQ_SPLAT(vadd16, 0x00030003u); | 1844 CHECK_EQ_SPLAT(vadd16, 0x00030003u); |
1835 CHECK_EQ_SPLAT(vadd32, 0x00000003u); | 1845 CHECK_EQ_SPLAT(vadd32, 0x00000003u); |
1836 CHECK_EQ_SPLAT(vsub8, 0xfefefefeu); | 1846 CHECK_EQ_SPLAT(vsub8, 0xfefefefeu); |
1837 CHECK_EQ_SPLAT(vsub16, 0xfffefffeu); | 1847 CHECK_EQ_SPLAT(vsub16, 0xfffefffeu); |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3551 HandleScope scope(isolate); | 3561 HandleScope scope(isolate); |
3552 | 3562 |
3553 Assembler assm(isolate, NULL, 0); | 3563 Assembler assm(isolate, NULL, 0); |
3554 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3564 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
3555 __ BlockConstPoolFor(1019); | 3565 __ BlockConstPoolFor(1019); |
3556 for (int i = 0; i < 1019; ++i) __ nop(); | 3566 for (int i = 0; i < 1019; ++i) __ nop(); |
3557 __ vldr(d0, MemOperand(r0, 0)); | 3567 __ vldr(d0, MemOperand(r0, 0)); |
3558 } | 3568 } |
3559 | 3569 |
3560 #undef __ | 3570 #undef __ |
OLD | NEW |