OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
Karl Klose
2011/04/06 06:52:56
2011
Søren Thygesen Gjesse
2011/04/06 08:00:09
Done.
| |
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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 21 matching lines...) Expand all Loading... | |
33 #include "arm/assembler-arm-inl.h" | 33 #include "arm/assembler-arm-inl.h" |
34 #include "cctest.h" | 34 #include "cctest.h" |
35 | 35 |
36 using namespace v8::internal; | 36 using namespace v8::internal; |
37 | 37 |
38 | 38 |
39 // Define these function prototypes to match JSEntryFunction in execution.cc. | 39 // Define these function prototypes to match JSEntryFunction in execution.cc. |
40 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); | 40 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); |
41 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); | 41 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); |
42 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); | 42 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); |
43 typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); | |
Karl Klose
2011/04/06 06:52:56
Please unify naming in F4 and F3.
Søren Thygesen Gjesse
2011/04/06 08:00:09
Done.
| |
43 | 44 |
44 | 45 |
45 static v8::Persistent<v8::Context> env; | 46 static v8::Persistent<v8::Context> env; |
46 | 47 |
47 | 48 |
48 static void InitializeVM() { | 49 static void InitializeVM() { |
49 if (env.IsEmpty()) { | 50 if (env.IsEmpty()) { |
50 env = v8::Context::New(); | 51 env = v8::Context::New(); |
51 } | 52 } |
52 } | 53 } |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 TestRoundingMode(u32_f64, RN, 123456.2, 123456); | 602 TestRoundingMode(u32_f64, RN, 123456.2, 123456); |
602 TestRoundingMode(u32_f64, RN, static_cast<double>(kMaxInt), kMaxInt); | 603 TestRoundingMode(u32_f64, RN, static_cast<double>(kMaxInt), kMaxInt); |
603 TestRoundingMode(u32_f64, RN, (kMaxInt + 0.49), kMaxInt); | 604 TestRoundingMode(u32_f64, RN, (kMaxInt + 0.49), kMaxInt); |
604 TestRoundingMode(u32_f64, RN, (kMaxInt + 0.5), | 605 TestRoundingMode(u32_f64, RN, (kMaxInt + 0.5), |
605 static_cast<uint32_t>(kMaxInt) + 1); | 606 static_cast<uint32_t>(kMaxInt) + 1); |
606 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.49), kMaxUInt); | 607 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.49), kMaxUInt); |
607 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.5), kMaxUInt, true); | 608 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.5), kMaxUInt, true); |
608 TestRoundingMode(u32_f64, RN, (kMaxUInt + 1.0), kMaxUInt, true); | 609 TestRoundingMode(u32_f64, RN, (kMaxUInt + 1.0), kMaxUInt, true); |
609 } | 610 } |
610 | 611 |
612 TEST(8) { | |
613 // Test VFP multi load/store. | |
614 InitializeVM(); | |
615 v8::HandleScope scope; | |
616 | |
617 typedef struct { | |
618 double a; | |
619 double b; | |
620 double c; | |
621 double d; | |
622 double e; | |
623 double f; | |
624 double g; | |
625 double h; | |
626 } D; | |
627 D d; | |
628 | |
629 typedef struct { | |
630 float a; | |
631 float b; | |
632 float c; | |
633 float d; | |
634 float e; | |
635 float f; | |
636 float g; | |
637 float h; | |
638 } F; | |
639 F f; | |
640 | |
641 // Create a function that uses vldm/vstm to move some double and | |
642 // single presision values around in memory. | |
Karl Klose
2011/04/06 06:52:56
presision -> precision
Søren Thygesen Gjesse
2011/04/06 08:00:09
Done.
| |
643 Assembler assm(Isolate::Current(), NULL, 0); | |
644 | |
645 if (CpuFeatures::IsSupported(VFP3)) { | |
646 CpuFeatures::Scope scope(VFP3); | |
647 | |
648 __ mov(ip, Operand(sp)); | |
649 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | |
650 __ sub(fp, ip, Operand(4)); | |
651 | |
652 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | |
653 __ vldm(ia_w, r4, d0, d3); | |
654 __ vldm(ia_w, r4, d4, d7); | |
655 | |
656 __ add(r4, r0, Operand(OFFSET_OF(D, a))); | |
657 __ vstm(ia_w, r4, d6, d7); | |
658 __ vstm(ia_w, r4, d0, d5); | |
659 | |
660 __ add(r4, r1, Operand(OFFSET_OF(F, a))); | |
661 __ vldm(ia_w, r4, s0, s3); | |
662 __ vldm(ia_w, r4, s4, s7); | |
663 | |
664 __ add(r4, r1, Operand(OFFSET_OF(F, a))); | |
665 __ vstm(ia_w, r4, s6, s7); | |
666 __ vstm(ia_w, r4, s0, s5); | |
667 | |
668 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | |
669 | |
670 CodeDesc desc; | |
671 assm.GetCode(&desc); | |
672 Object* code = HEAP->CreateCode( | |
673 desc, | |
674 Code::ComputeFlags(Code::STUB), | |
675 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); | |
676 CHECK(code->IsCode()); | |
677 #ifdef DEBUG | |
678 Code::cast(code)->Print(); | |
679 #endif | |
680 F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); | |
681 d.a = 1.1; | |
682 d.b = 2.2; | |
683 d.c = 3.3; | |
684 d.d = 4.4; | |
685 d.e = 5.5; | |
686 d.f = 6.6; | |
687 d.g = 7.7; | |
688 d.h = 8.8; | |
689 | |
690 f.a = 1.0; | |
691 f.b = 2.0; | |
692 f.c = 3.0; | |
693 f.d = 4.0; | |
694 f.e = 5.0; | |
695 f.f = 6.0; | |
696 f.g = 7.0; | |
697 f.h = 8.0; | |
698 | |
699 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); | |
700 USE(dummy); | |
701 | |
702 CHECK_EQ(7.7, d.a); | |
703 CHECK_EQ(8.8, d.b); | |
704 CHECK_EQ(1.1, d.c); | |
705 CHECK_EQ(2.2, d.d); | |
706 CHECK_EQ(3.3, d.e); | |
707 CHECK_EQ(4.4, d.f); | |
708 CHECK_EQ(5.5, d.g); | |
709 CHECK_EQ(6.6, d.h); | |
710 | |
711 CHECK_EQ(7.0, f.a); | |
712 CHECK_EQ(8.0, f.b); | |
713 CHECK_EQ(1.0, f.c); | |
714 CHECK_EQ(2.0, f.d); | |
715 CHECK_EQ(3.0, f.e); | |
716 CHECK_EQ(4.0, f.f); | |
717 CHECK_EQ(5.0, f.g); | |
718 CHECK_EQ(6.0, f.h); | |
719 } | |
720 } | |
721 | |
611 #undef __ | 722 #undef __ |
OLD | NEW |