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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 uint32_t srcA0; | 1248 uint32_t srcA0; |
1249 uint32_t srcA1; | 1249 uint32_t srcA1; |
1250 uint32_t dstA0; | 1250 uint32_t dstA0; |
1251 uint32_t dstA1; | 1251 uint32_t dstA1; |
1252 uint32_t dstA2; | 1252 uint32_t dstA2; |
1253 uint32_t dstA3; | 1253 uint32_t dstA3; |
1254 uint32_t dstA4; | 1254 uint32_t dstA4; |
1255 uint32_t dstA5; | 1255 uint32_t dstA5; |
1256 uint32_t dstA6; | 1256 uint32_t dstA6; |
1257 uint32_t dstA7; | 1257 uint32_t dstA7; |
| 1258 uint32_t vmov_src[4], vmov_dst[4]; |
| 1259 uint32_t veor_src[4], veor_dst[4]; |
1258 } T; | 1260 } T; |
1259 T t; | 1261 T t; |
1260 | 1262 |
1261 // Create a function that accepts &t, and loads, manipulates, and stores | 1263 // Create a function that accepts &t, and loads, manipulates, and stores |
1262 // the doubles and floats. | 1264 // the doubles and floats. |
1263 Assembler assm(isolate, NULL, 0); | 1265 Assembler assm(isolate, NULL, 0); |
1264 | 1266 |
1265 | 1267 |
1266 if (CpuFeatures::IsSupported(NEON)) { | 1268 if (CpuFeatures::IsSupported(NEON)) { |
1267 CpuFeatureScope scope(&assm, NEON); | 1269 CpuFeatureScope scope(&assm, NEON); |
(...skipping 12 matching lines...) Expand all Loading... |
1280 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA0)))); | 1282 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA0)))); |
1281 __ vst1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); | 1283 __ vst1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); |
1282 | 1284 |
1283 // The same expansion, but with different source and destination registers. | 1285 // The same expansion, but with different source and destination registers. |
1284 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0)))); | 1286 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, srcA0)))); |
1285 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4)); | 1287 __ vld1(Neon8, NeonListOperand(d1), NeonMemOperand(r4)); |
1286 __ vmovl(NeonU8, q1, d1); | 1288 __ vmovl(NeonU8, q1, d1); |
1287 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA4)))); | 1289 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, dstA4)))); |
1288 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); | 1290 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); |
1289 | 1291 |
| 1292 // Test vmov for q-registers. |
| 1293 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_src)))); |
| 1294 __ vld1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); |
| 1295 __ vmov(q1, q0); |
| 1296 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmov_dst)))); |
| 1297 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); |
| 1298 |
| 1299 // Test veor for q-registers. |
| 1300 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor_src)))); |
| 1301 __ vld1(Neon8, NeonListOperand(d0, 2), NeonMemOperand(r4)); |
| 1302 __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor_dst)))); |
| 1303 __ vld1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); |
| 1304 __ veor(q1, q1, q0); |
| 1305 __ vst1(Neon8, NeonListOperand(d2, 2), NeonMemOperand(r4)); |
| 1306 |
| 1307 // Restore and return. |
1290 __ ldm(ia_w, sp, r4.bit() | pc.bit()); | 1308 __ ldm(ia_w, sp, r4.bit() | pc.bit()); |
1291 | 1309 |
1292 CodeDesc desc; | 1310 CodeDesc desc; |
1293 assm.GetCode(&desc); | 1311 assm.GetCode(&desc); |
1294 Handle<Code> code = isolate->factory()->NewCode( | 1312 Handle<Code> code = isolate->factory()->NewCode( |
1295 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1313 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1296 #ifdef DEBUG | 1314 #ifdef DEBUG |
1297 OFStream os(stdout); | 1315 OFStream os(stdout); |
1298 code->Print(os); | 1316 code->Print(os); |
1299 #endif | 1317 #endif |
(...skipping 17 matching lines...) Expand all Loading... |
1317 t.srcA0 = 0x41424344; | 1335 t.srcA0 = 0x41424344; |
1318 t.srcA1 = 0x81828384; | 1336 t.srcA1 = 0x81828384; |
1319 t.dstA0 = 0; | 1337 t.dstA0 = 0; |
1320 t.dstA1 = 0; | 1338 t.dstA1 = 0; |
1321 t.dstA2 = 0; | 1339 t.dstA2 = 0; |
1322 t.dstA3 = 0; | 1340 t.dstA3 = 0; |
1323 t.dstA4 = 0; | 1341 t.dstA4 = 0; |
1324 t.dstA5 = 0; | 1342 t.dstA5 = 0; |
1325 t.dstA6 = 0; | 1343 t.dstA6 = 0; |
1326 t.dstA7 = 0; | 1344 t.dstA7 = 0; |
| 1345 t.vmov_src[0] = t.vmov_src[1] = t.vmov_src[2] = t.vmov_src[3] = 1; |
| 1346 t.vmov_dst[0] = t.vmov_dst[1] = t.vmov_dst[2] = t.vmov_dst[3] = 0; |
| 1347 t.veor_src[0] = t.veor_src[1] = t.veor_src[2] = t.veor_src[3] = 0xAA; |
| 1348 t.veor_dst[0] = t.veor_dst[1] = t.veor_dst[2] = t.veor_dst[3] = 0x55; |
1327 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 1349 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
1328 USE(dummy); | 1350 USE(dummy); |
1329 CHECK_EQ(0x01020304u, t.dst0); | 1351 CHECK_EQ(0x01020304u, t.dst0); |
1330 CHECK_EQ(0x11121314u, t.dst1); | 1352 CHECK_EQ(0x11121314u, t.dst1); |
1331 CHECK_EQ(0x21222324u, t.dst2); | 1353 CHECK_EQ(0x21222324u, t.dst2); |
1332 CHECK_EQ(0x31323334u, t.dst3); | 1354 CHECK_EQ(0x31323334u, t.dst3); |
1333 CHECK_EQ(0x41424344u, t.dst4); | 1355 CHECK_EQ(0x41424344u, t.dst4); |
1334 CHECK_EQ(0x51525354u, t.dst5); | 1356 CHECK_EQ(0x51525354u, t.dst5); |
1335 CHECK_EQ(0x61626364u, t.dst6); | 1357 CHECK_EQ(0x61626364u, t.dst6); |
1336 CHECK_EQ(0x71727374u, t.dst7); | 1358 CHECK_EQ(0x71727374u, t.dst7); |
1337 CHECK_EQ(0x00430044u, t.dstA0); | 1359 CHECK_EQ(0x00430044u, t.dstA0); |
1338 CHECK_EQ(0x00410042u, t.dstA1); | 1360 CHECK_EQ(0x00410042u, t.dstA1); |
1339 CHECK_EQ(0x00830084u, t.dstA2); | 1361 CHECK_EQ(0x00830084u, t.dstA2); |
1340 CHECK_EQ(0x00810082u, t.dstA3); | 1362 CHECK_EQ(0x00810082u, t.dstA3); |
1341 CHECK_EQ(0x00430044u, t.dstA4); | 1363 CHECK_EQ(0x00430044u, t.dstA4); |
1342 CHECK_EQ(0x00410042u, t.dstA5); | 1364 CHECK_EQ(0x00410042u, t.dstA5); |
1343 CHECK_EQ(0x00830084u, t.dstA6); | 1365 CHECK_EQ(0x00830084u, t.dstA6); |
1344 CHECK_EQ(0x00810082u, t.dstA7); | 1366 CHECK_EQ(0x00810082u, t.dstA7); |
| 1367 CHECK_EQ(1u, t.vmov_dst[0]); |
| 1368 CHECK_EQ(1u, t.vmov_dst[1]); |
| 1369 CHECK_EQ(1u, t.vmov_dst[2]); |
| 1370 CHECK_EQ(1u, t.vmov_dst[3]); |
| 1371 CHECK_EQ(0xFFu, t.veor_dst[0]); |
| 1372 CHECK_EQ(0xFFu, t.veor_dst[1]); |
| 1373 CHECK_EQ(0xFFu, t.veor_dst[2]); |
| 1374 CHECK_EQ(0xFFu, t.veor_dst[3]); |
1345 } | 1375 } |
1346 } | 1376 } |
1347 | 1377 |
1348 | 1378 |
1349 TEST(16) { | 1379 TEST(16) { |
1350 // Test the pkh, uxtb, uxtab and uxtb16 instructions. | 1380 // Test the pkh, uxtb, uxtab and uxtb16 instructions. |
1351 CcTest::InitializeVM(); | 1381 CcTest::InitializeVM(); |
1352 Isolate* isolate = CcTest::i_isolate(); | 1382 Isolate* isolate = CcTest::i_isolate(); |
1353 HandleScope scope(isolate); | 1383 HandleScope scope(isolate); |
1354 | 1384 |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 { | 2904 { |
2875 uint64_t strh = 0; | 2905 uint64_t strh = 0; |
2876 uint64_t str = 0; | 2906 uint64_t str = 0; |
2877 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 3, 0xfedcba98, 0); | 2907 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 3, 0xfedcba98, 0); |
2878 CHECK_EQ(UINT64_C(0x000000ba98000000), strh); | 2908 CHECK_EQ(UINT64_C(0x000000ba98000000), strh); |
2879 CHECK_EQ(UINT64_C(0x00fedcba98000000), str); | 2909 CHECK_EQ(UINT64_C(0x00fedcba98000000), str); |
2880 } | 2910 } |
2881 } | 2911 } |
2882 | 2912 |
2883 TEST(vswp) { | 2913 TEST(vswp) { |
| 2914 if (!CpuFeatures::IsSupported(NEON)) return; |
| 2915 |
2884 CcTest::InitializeVM(); | 2916 CcTest::InitializeVM(); |
2885 Isolate* isolate = CcTest::i_isolate(); | 2917 Isolate* isolate = CcTest::i_isolate(); |
2886 HandleScope scope(isolate); | 2918 HandleScope scope(isolate); |
2887 Assembler assm(isolate, NULL, 0); | 2919 Assembler assm(isolate, NULL, 0); |
2888 | 2920 |
2889 typedef struct { | 2921 typedef struct { |
2890 double result0; | 2922 double result0; |
2891 double result1; | 2923 double result1; |
2892 double result2; | 2924 double result2; |
2893 double result3; | 2925 double result3; |
| 2926 double result4; |
| 2927 double result5; |
| 2928 double result6; |
| 2929 double result7; |
2894 } T; | 2930 } T; |
2895 T t; | 2931 T t; |
2896 | 2932 |
2897 __ vmov(d0, 1.0); | 2933 __ vmov(d0, 1.0); |
2898 __ vmov(d1, -1.0); | 2934 __ vmov(d1, -1.0); |
2899 __ vswp(d0, d1); | 2935 __ vswp(d0, d1); |
2900 __ vstr(d0, r0, offsetof(T, result0)); | 2936 __ vstr(d0, r0, offsetof(T, result0)); |
2901 __ vstr(d1, r0, offsetof(T, result1)); | 2937 __ vstr(d1, r0, offsetof(T, result1)); |
2902 | 2938 |
2903 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2939 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2904 __ vmov(d30, 1.0); | 2940 __ vmov(d30, 1.0); |
2905 __ vmov(d31, -1.0); | 2941 __ vmov(d31, -1.0); |
2906 __ vswp(d30, d31); | 2942 __ vswp(d30, d31); |
2907 __ vstr(d30, r0, offsetof(T, result2)); | 2943 __ vstr(d30, r0, offsetof(T, result2)); |
2908 __ vstr(d31, r0, offsetof(T, result3)); | 2944 __ vstr(d31, r0, offsetof(T, result3)); |
2909 } | 2945 } |
2910 | 2946 |
| 2947 // q-register swap. |
| 2948 __ vmov(d8, 1.0); |
| 2949 __ vmov(d9, 2.0); |
| 2950 __ vmov(d10, 3.0); |
| 2951 __ vmov(d11, 4.0); |
| 2952 __ vswp(q4, q5); |
| 2953 __ vstr(d8, r0, offsetof(T, result4)); |
| 2954 __ vstr(d9, r0, offsetof(T, result5)); |
| 2955 __ vstr(d10, r0, offsetof(T, result6)); |
| 2956 __ vstr(d11, r0, offsetof(T, result7)); |
| 2957 |
2911 __ bx(lr); | 2958 __ bx(lr); |
2912 | 2959 |
2913 CodeDesc desc; | 2960 CodeDesc desc; |
2914 assm.GetCode(&desc); | 2961 assm.GetCode(&desc); |
2915 Handle<Code> code = isolate->factory()->NewCode( | 2962 Handle<Code> code = isolate->factory()->NewCode( |
2916 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 2963 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
2917 #ifdef DEBUG | 2964 #ifdef DEBUG |
2918 OFStream os(stdout); | 2965 OFStream os(stdout); |
2919 code->Print(os); | 2966 code->Print(os); |
2920 #endif | 2967 #endif |
2921 F3 f = FUNCTION_CAST<F3>(code->entry()); | 2968 F3 f = FUNCTION_CAST<F3>(code->entry()); |
2922 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 2969 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
2923 USE(dummy); | 2970 USE(dummy); |
2924 CHECK_EQ(-1.0, t.result0); | 2971 CHECK_EQ(-1.0, t.result0); |
2925 CHECK_EQ(1.0, t.result1); | 2972 CHECK_EQ(1.0, t.result1); |
2926 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2973 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2927 CHECK_EQ(-1.0, t.result2); | 2974 CHECK_EQ(-1.0, t.result2); |
2928 CHECK_EQ(1.0, t.result3); | 2975 CHECK_EQ(1.0, t.result3); |
2929 } | 2976 } |
| 2977 CHECK_EQ(3.0, t.result4); |
| 2978 CHECK_EQ(4.0, t.result5); |
| 2979 CHECK_EQ(1.0, t.result6); |
| 2980 CHECK_EQ(2.0, t.result7); |
2930 } | 2981 } |
2931 | 2982 |
2932 TEST(regress4292_b) { | 2983 TEST(regress4292_b) { |
2933 CcTest::InitializeVM(); | 2984 CcTest::InitializeVM(); |
2934 Isolate* isolate = CcTest::i_isolate(); | 2985 Isolate* isolate = CcTest::i_isolate(); |
2935 HandleScope scope(isolate); | 2986 HandleScope scope(isolate); |
2936 | 2987 |
2937 Assembler assm(isolate, NULL, 0); | 2988 Assembler assm(isolate, NULL, 0); |
2938 Label end; | 2989 Label end; |
2939 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2990 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 HandleScope scope(isolate); | 3031 HandleScope scope(isolate); |
2981 | 3032 |
2982 Assembler assm(isolate, NULL, 0); | 3033 Assembler assm(isolate, NULL, 0); |
2983 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3034 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2984 __ BlockConstPoolFor(1019); | 3035 __ BlockConstPoolFor(1019); |
2985 for (int i = 0; i < 1019; ++i) __ nop(); | 3036 for (int i = 0; i < 1019; ++i) __ nop(); |
2986 __ vldr(d0, MemOperand(r0, 0)); | 3037 __ vldr(d0, MemOperand(r0, 0)); |
2987 } | 3038 } |
2988 | 3039 |
2989 #undef __ | 3040 #undef __ |
OLD | NEW |