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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 T t; | 245 T t; |
246 | 246 |
247 // Create a function that accepts &t, and loads, manipulates, and stores | 247 // Create a function that accepts &t, and loads, manipulates, and stores |
248 // the doubles and floats. | 248 // the doubles and floats. |
249 Isolate* isolate = Isolate::Current(); | 249 Isolate* isolate = Isolate::Current(); |
250 Assembler assm(isolate, NULL, 0); | 250 Assembler assm(isolate, NULL, 0); |
251 Label L, C; | 251 Label L, C; |
252 | 252 |
253 | 253 |
254 if (CpuFeatures::IsSupported(VFP3)) { | 254 if (CpuFeatures::IsSupported(VFP3)) { |
255 CpuFeatures::Scope scope(VFP3); | 255 CpuFeatureScope scope(&assm, VFP3); |
256 | 256 |
257 __ mov(ip, Operand(sp)); | 257 __ mov(ip, Operand(sp)); |
258 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 258 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
259 __ sub(fp, ip, Operand(4)); | 259 __ sub(fp, ip, Operand(4)); |
260 | 260 |
261 __ mov(r4, Operand(r0)); | 261 __ mov(r4, Operand(r0)); |
262 __ vldr(d6, r4, OFFSET_OF(T, a)); | 262 __ vldr(d6, r4, OFFSET_OF(T, a)); |
263 __ vldr(d7, r4, OFFSET_OF(T, b)); | 263 __ vldr(d7, r4, OFFSET_OF(T, b)); |
264 __ vadd(d5, d6, d7); | 264 __ vadd(d5, d6, d7); |
265 __ vstr(d5, r4, OFFSET_OF(T, c)); | 265 __ vstr(d5, r4, OFFSET_OF(T, c)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 TEST(5) { | 364 TEST(5) { |
365 // Test the ARMv7 bitfield instructions. | 365 // Test the ARMv7 bitfield instructions. |
366 InitializeVM(); | 366 InitializeVM(); |
367 v8::HandleScope scope; | 367 v8::HandleScope scope; |
368 | 368 |
369 Isolate* isolate = Isolate::Current(); | 369 Isolate* isolate = Isolate::Current(); |
370 Assembler assm(isolate, NULL, 0); | 370 Assembler assm(isolate, NULL, 0); |
371 | 371 |
372 if (CpuFeatures::IsSupported(ARMv7)) { | 372 if (CpuFeatures::IsSupported(ARMv7)) { |
373 CpuFeatures::Scope scope(ARMv7); | 373 CpuFeatureScope scope(&assm, ARMv7); |
374 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. | 374 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. |
375 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 | 375 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
376 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 | 376 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
377 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 | 377 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
378 __ mov(r1, Operand(7)); | 378 __ mov(r1, Operand(7)); |
379 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 | 379 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 |
380 __ mov(pc, Operand(lr)); | 380 __ mov(pc, Operand(lr)); |
381 | 381 |
382 CodeDesc desc; | 382 CodeDesc desc; |
383 assm.GetCode(&desc); | 383 assm.GetCode(&desc); |
(...skipping 16 matching lines...) Expand all Loading... |
400 | 400 |
401 TEST(6) { | 401 TEST(6) { |
402 // Test saturating instructions. | 402 // Test saturating instructions. |
403 InitializeVM(); | 403 InitializeVM(); |
404 v8::HandleScope scope; | 404 v8::HandleScope scope; |
405 | 405 |
406 Isolate* isolate = Isolate::Current(); | 406 Isolate* isolate = Isolate::Current(); |
407 Assembler assm(isolate, NULL, 0); | 407 Assembler assm(isolate, NULL, 0); |
408 | 408 |
409 if (CpuFeatures::IsSupported(ARMv7)) { | 409 if (CpuFeatures::IsSupported(ARMv7)) { |
410 CpuFeatures::Scope scope(ARMv7); | 410 CpuFeatureScope scope(&assm, ARMv7); |
411 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. | 411 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. |
412 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. | 412 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. |
413 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. | 413 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. |
414 __ add(r0, r1, Operand(r2)); | 414 __ add(r0, r1, Operand(r2)); |
415 __ add(r0, r0, Operand(r3)); | 415 __ add(r0, r0, Operand(r3)); |
416 __ mov(pc, Operand(lr)); | 416 __ mov(pc, Operand(lr)); |
417 | 417 |
418 CodeDesc desc; | 418 CodeDesc desc; |
419 assm.GetCode(&desc); | 419 assm.GetCode(&desc); |
420 Object* code = isolate->heap()->CreateCode( | 420 Object* code = isolate->heap()->CreateCode( |
(...skipping 23 matching lines...) Expand all Loading... |
444 double value, | 444 double value, |
445 int expected, | 445 int expected, |
446 bool expected_exception = false) { | 446 bool expected_exception = false) { |
447 InitializeVM(); | 447 InitializeVM(); |
448 v8::HandleScope scope; | 448 v8::HandleScope scope; |
449 | 449 |
450 Isolate* isolate = Isolate::Current(); | 450 Isolate* isolate = Isolate::Current(); |
451 Assembler assm(isolate, NULL, 0); | 451 Assembler assm(isolate, NULL, 0); |
452 | 452 |
453 if (CpuFeatures::IsSupported(VFP3)) { | 453 if (CpuFeatures::IsSupported(VFP3)) { |
454 CpuFeatures::Scope scope(VFP3); | 454 CpuFeatureScope scope(&assm, VFP3); |
455 | 455 |
456 Label wrong_exception; | 456 Label wrong_exception; |
457 | 457 |
458 __ vmrs(r1); | 458 __ vmrs(r1); |
459 // Set custom FPSCR. | 459 // Set custom FPSCR. |
460 __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); | 460 __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); |
461 __ orr(r2, r2, Operand(mode)); | 461 __ orr(r2, r2, Operand(mode)); |
462 __ vmsr(r2); | 462 __ vmsr(r2); |
463 | 463 |
464 // Load value, convert, and move back result to r0 if everything went well. | 464 // Load value, convert, and move back result to r0 if everything went well. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 float h; | 648 float h; |
649 } F; | 649 } F; |
650 F f; | 650 F f; |
651 | 651 |
652 // Create a function that uses vldm/vstm to move some double and | 652 // Create a function that uses vldm/vstm to move some double and |
653 // single precision values around in memory. | 653 // single precision values around in memory. |
654 Isolate* isolate = Isolate::Current(); | 654 Isolate* isolate = Isolate::Current(); |
655 Assembler assm(isolate, NULL, 0); | 655 Assembler assm(isolate, NULL, 0); |
656 | 656 |
657 if (CpuFeatures::IsSupported(VFP2)) { | 657 if (CpuFeatures::IsSupported(VFP2)) { |
658 CpuFeatures::Scope scope(VFP2); | 658 CpuFeatureScope scope(&assm, VFP2); |
659 | 659 |
660 __ mov(ip, Operand(sp)); | 660 __ mov(ip, Operand(sp)); |
661 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 661 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
662 __ sub(fp, ip, Operand(4)); | 662 __ sub(fp, ip, Operand(4)); |
663 | 663 |
664 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 664 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
665 __ vldm(ia_w, r4, d0, d3); | 665 __ vldm(ia_w, r4, d0, d3); |
666 __ vldm(ia_w, r4, d4, d7); | 666 __ vldm(ia_w, r4, d4, d7); |
667 | 667 |
668 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 668 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 float h; | 760 float h; |
761 } F; | 761 } F; |
762 F f; | 762 F f; |
763 | 763 |
764 // Create a function that uses vldm/vstm to move some double and | 764 // Create a function that uses vldm/vstm to move some double and |
765 // single precision values around in memory. | 765 // single precision values around in memory. |
766 Isolate* isolate = Isolate::Current(); | 766 Isolate* isolate = Isolate::Current(); |
767 Assembler assm(isolate, NULL, 0); | 767 Assembler assm(isolate, NULL, 0); |
768 | 768 |
769 if (CpuFeatures::IsSupported(VFP2)) { | 769 if (CpuFeatures::IsSupported(VFP2)) { |
770 CpuFeatures::Scope scope(VFP2); | 770 CpuFeatureScope scope(&assm, VFP2); |
771 | 771 |
772 __ mov(ip, Operand(sp)); | 772 __ mov(ip, Operand(sp)); |
773 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 773 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
774 __ sub(fp, ip, Operand(4)); | 774 __ sub(fp, ip, Operand(4)); |
775 | 775 |
776 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | 776 __ add(r4, r0, Operand(OFFSET_OF(D, a))); |
777 __ vldm(ia, r4, d0, d3); | 777 __ vldm(ia, r4, d0, d3); |
778 __ add(r4, r4, Operand(4 * 8)); | 778 __ add(r4, r4, Operand(4 * 8)); |
779 __ vldm(ia, r4, d4, d7); | 779 __ vldm(ia, r4, d4, d7); |
780 | 780 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 float h; | 876 float h; |
877 } F; | 877 } F; |
878 F f; | 878 F f; |
879 | 879 |
880 // Create a function that uses vldm/vstm to move some double and | 880 // Create a function that uses vldm/vstm to move some double and |
881 // single precision values around in memory. | 881 // single precision values around in memory. |
882 Isolate* isolate = Isolate::Current(); | 882 Isolate* isolate = Isolate::Current(); |
883 Assembler assm(isolate, NULL, 0); | 883 Assembler assm(isolate, NULL, 0); |
884 | 884 |
885 if (CpuFeatures::IsSupported(VFP2)) { | 885 if (CpuFeatures::IsSupported(VFP2)) { |
886 CpuFeatures::Scope scope(VFP2); | 886 CpuFeatureScope scope(&assm, VFP2); |
887 | 887 |
888 __ mov(ip, Operand(sp)); | 888 __ mov(ip, Operand(sp)); |
889 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | 889 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); |
890 __ sub(fp, ip, Operand(4)); | 890 __ sub(fp, ip, Operand(4)); |
891 | 891 |
892 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); | 892 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); |
893 __ vldm(db_w, r4, d4, d7); | 893 __ vldm(db_w, r4, d4, d7); |
894 __ vldm(db_w, r4, d0, d3); | 894 __ vldm(db_w, r4, d0, d3); |
895 | 895 |
896 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); | 896 __ add(r4, r0, Operand(OFFSET_OF(D, h) + 8)); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 T t; | 1063 T t; |
1064 | 1064 |
1065 // Create a function that accepts &t, and loads, manipulates, and stores | 1065 // Create a function that accepts &t, and loads, manipulates, and stores |
1066 // the doubles and floats. | 1066 // the doubles and floats. |
1067 Isolate* isolate = Isolate::Current(); | 1067 Isolate* isolate = Isolate::Current(); |
1068 Assembler assm(isolate, NULL, 0); | 1068 Assembler assm(isolate, NULL, 0); |
1069 Label L, C; | 1069 Label L, C; |
1070 | 1070 |
1071 | 1071 |
1072 if (CpuFeatures::IsSupported(VFP3)) { | 1072 if (CpuFeatures::IsSupported(VFP3)) { |
1073 CpuFeatures::Scope scope(VFP3); | 1073 CpuFeatureScope scope(&assm, VFP3); |
1074 | 1074 |
1075 __ stm(db_w, sp, r4.bit() | lr.bit()); | 1075 __ stm(db_w, sp, r4.bit() | lr.bit()); |
1076 | 1076 |
1077 // Load a, b, c into d16, d17, d18. | 1077 // Load a, b, c into d16, d17, d18. |
1078 __ mov(r4, Operand(r0)); | 1078 __ mov(r4, Operand(r0)); |
1079 __ vldr(d16, r4, OFFSET_OF(T, a)); | 1079 __ vldr(d16, r4, OFFSET_OF(T, a)); |
1080 __ vldr(d17, r4, OFFSET_OF(T, b)); | 1080 __ vldr(d17, r4, OFFSET_OF(T, b)); |
1081 __ vldr(d18, r4, OFFSET_OF(T, c)); | 1081 __ vldr(d18, r4, OFFSET_OF(T, c)); |
1082 | 1082 |
1083 __ vneg(d25, d16); | 1083 __ vneg(d25, d16); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 CHECK_EQ(2.75, t.x); | 1152 CHECK_EQ(2.75, t.x); |
1153 CHECK_EQ(1.5, t.y); | 1153 CHECK_EQ(1.5, t.y); |
1154 CHECK_EQ(17.0, t.z); | 1154 CHECK_EQ(17.0, t.z); |
1155 CHECK_EQ(14.7610017472335499, t.i); | 1155 CHECK_EQ(14.7610017472335499, t.i); |
1156 CHECK_EQ(16.0, t.j); | 1156 CHECK_EQ(16.0, t.j); |
1157 CHECK_EQ(73.8818412254460241, t.k); | 1157 CHECK_EQ(73.8818412254460241, t.k); |
1158 } | 1158 } |
1159 } | 1159 } |
1160 | 1160 |
1161 #undef __ | 1161 #undef __ |
OLD | NEW |