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 29 matching lines...) Expand all Loading... |
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* p0, int p1, int p2, int p3, int p4); | 42 typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); |
43 typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); | 43 typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); |
44 | 44 |
45 | 45 |
46 #define __ assm. | 46 #define __ assm. |
47 | 47 |
48 TEST(0) { | 48 TEST(0) { |
49 CcTest::InitializeVM(); | 49 CcTest::InitializeVM(); |
50 Isolate* isolate = Isolate::Current(); | 50 Isolate* isolate = CcTest::i_isolate(); |
51 HandleScope scope(isolate); | 51 HandleScope scope(isolate); |
52 | 52 |
53 Assembler assm(isolate, NULL, 0); | 53 Assembler assm(isolate, NULL, 0); |
54 | 54 |
55 __ add(r0, r0, Operand(r1)); | 55 __ add(r0, r0, Operand(r1)); |
56 __ mov(pc, Operand(lr)); | 56 __ mov(pc, Operand(lr)); |
57 | 57 |
58 CodeDesc desc; | 58 CodeDesc desc; |
59 assm.GetCode(&desc); | 59 assm.GetCode(&desc); |
60 Object* code = isolate->heap()->CreateCode( | 60 Object* code = isolate->heap()->CreateCode( |
61 desc, | 61 desc, |
62 Code::ComputeFlags(Code::STUB), | 62 Code::ComputeFlags(Code::STUB), |
63 Handle<Code>())->ToObjectChecked(); | 63 Handle<Code>())->ToObjectChecked(); |
64 CHECK(code->IsCode()); | 64 CHECK(code->IsCode()); |
65 #ifdef DEBUG | 65 #ifdef DEBUG |
66 Code::cast(code)->Print(); | 66 Code::cast(code)->Print(); |
67 #endif | 67 #endif |
68 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 68 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
69 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); | 69 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); |
70 ::printf("f() = %d\n", res); | 70 ::printf("f() = %d\n", res); |
71 CHECK_EQ(7, res); | 71 CHECK_EQ(7, res); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 TEST(1) { | 75 TEST(1) { |
76 CcTest::InitializeVM(); | 76 CcTest::InitializeVM(); |
77 Isolate* isolate = Isolate::Current(); | 77 Isolate* isolate = CcTest::i_isolate(); |
78 HandleScope scope(isolate); | 78 HandleScope scope(isolate); |
79 | 79 |
80 Assembler assm(isolate, NULL, 0); | 80 Assembler assm(isolate, NULL, 0); |
81 Label L, C; | 81 Label L, C; |
82 | 82 |
83 __ mov(r1, Operand(r0)); | 83 __ mov(r1, Operand(r0)); |
84 __ mov(r0, Operand::Zero()); | 84 __ mov(r0, Operand::Zero()); |
85 __ b(&C); | 85 __ b(&C); |
86 | 86 |
87 __ bind(&L); | 87 __ bind(&L); |
(...skipping 17 matching lines...) Expand all Loading... |
105 #endif | 105 #endif |
106 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 106 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
107 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); | 107 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); |
108 ::printf("f() = %d\n", res); | 108 ::printf("f() = %d\n", res); |
109 CHECK_EQ(5050, res); | 109 CHECK_EQ(5050, res); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 TEST(2) { | 113 TEST(2) { |
114 CcTest::InitializeVM(); | 114 CcTest::InitializeVM(); |
115 Isolate* isolate = Isolate::Current(); | 115 Isolate* isolate = CcTest::i_isolate(); |
116 HandleScope scope(isolate); | 116 HandleScope scope(isolate); |
117 | 117 |
118 Assembler assm(isolate, NULL, 0); | 118 Assembler assm(isolate, NULL, 0); |
119 Label L, C; | 119 Label L, C; |
120 | 120 |
121 __ mov(r1, Operand(r0)); | 121 __ mov(r1, Operand(r0)); |
122 __ mov(r0, Operand(1)); | 122 __ mov(r0, Operand(1)); |
123 __ b(&C); | 123 __ b(&C); |
124 | 124 |
125 __ bind(&L); | 125 __ bind(&L); |
(...skipping 26 matching lines...) Expand all Loading... |
152 #endif | 152 #endif |
153 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 153 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
154 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); | 154 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); |
155 ::printf("f() = %d\n", res); | 155 ::printf("f() = %d\n", res); |
156 CHECK_EQ(3628800, res); | 156 CHECK_EQ(3628800, res); |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 TEST(3) { | 160 TEST(3) { |
161 CcTest::InitializeVM(); | 161 CcTest::InitializeVM(); |
162 Isolate* isolate = Isolate::Current(); | 162 Isolate* isolate = CcTest::i_isolate(); |
163 HandleScope scope(isolate); | 163 HandleScope scope(isolate); |
164 | 164 |
165 typedef struct { | 165 typedef struct { |
166 int i; | 166 int i; |
167 char c; | 167 char c; |
168 int16_t s; | 168 int16_t s; |
169 } T; | 169 } T; |
170 T t; | 170 T t; |
171 | 171 |
172 Assembler assm(isolate, NULL, 0); | 172 Assembler assm(isolate, NULL, 0); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 CHECK_EQ(101010, res); | 208 CHECK_EQ(101010, res); |
209 CHECK_EQ(100000/2, t.i); | 209 CHECK_EQ(100000/2, t.i); |
210 CHECK_EQ(10*4, t.c); | 210 CHECK_EQ(10*4, t.c); |
211 CHECK_EQ(1000/8, t.s); | 211 CHECK_EQ(1000/8, t.s); |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 TEST(4) { | 215 TEST(4) { |
216 // Test the VFP floating point instructions. | 216 // Test the VFP floating point instructions. |
217 CcTest::InitializeVM(); | 217 CcTest::InitializeVM(); |
218 Isolate* isolate = Isolate::Current(); | 218 Isolate* isolate = CcTest::i_isolate(); |
219 HandleScope scope(isolate); | 219 HandleScope scope(isolate); |
220 | 220 |
221 typedef struct { | 221 typedef struct { |
222 double a; | 222 double a; |
223 double b; | 223 double b; |
224 double c; | 224 double c; |
225 double d; | 225 double d; |
226 double e; | 226 double e; |
227 double f; | 227 double f; |
228 double g; | 228 double g; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 CHECK_EQ(4.25, t.c); | 356 CHECK_EQ(4.25, t.c); |
357 CHECK_EQ(-4.1875, t.b); | 357 CHECK_EQ(-4.1875, t.b); |
358 CHECK_EQ(1.5, t.a); | 358 CHECK_EQ(1.5, t.a); |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 TEST(5) { | 363 TEST(5) { |
364 // Test the ARMv7 bitfield instructions. | 364 // Test the ARMv7 bitfield instructions. |
365 CcTest::InitializeVM(); | 365 CcTest::InitializeVM(); |
366 Isolate* isolate = Isolate::Current(); | 366 Isolate* isolate = CcTest::i_isolate(); |
367 HandleScope scope(isolate); | 367 HandleScope scope(isolate); |
368 | 368 |
369 Assembler assm(isolate, NULL, 0); | 369 Assembler assm(isolate, NULL, 0); |
370 | 370 |
371 if (CpuFeatures::IsSupported(ARMv7)) { | 371 if (CpuFeatures::IsSupported(ARMv7)) { |
372 CpuFeatureScope scope(&assm, ARMv7); | 372 CpuFeatureScope scope(&assm, ARMv7); |
373 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. | 373 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. |
374 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 | 374 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
375 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 | 375 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
376 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 | 376 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
(...skipping 16 matching lines...) Expand all Loading... |
393 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); | 393 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); |
394 ::printf("f() = %d\n", res); | 394 ::printf("f() = %d\n", res); |
395 CHECK_EQ(-7, res); | 395 CHECK_EQ(-7, res); |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
399 | 399 |
400 TEST(6) { | 400 TEST(6) { |
401 // Test saturating instructions. | 401 // Test saturating instructions. |
402 CcTest::InitializeVM(); | 402 CcTest::InitializeVM(); |
403 Isolate* isolate = Isolate::Current(); | 403 Isolate* isolate = CcTest::i_isolate(); |
404 HandleScope scope(isolate); | 404 HandleScope scope(isolate); |
405 | 405 |
406 Assembler assm(isolate, NULL, 0); | 406 Assembler assm(isolate, NULL, 0); |
407 | 407 |
408 if (CpuFeatures::IsSupported(ARMv7)) { | 408 if (CpuFeatures::IsSupported(ARMv7)) { |
409 CpuFeatureScope scope(&assm, ARMv7); | 409 CpuFeatureScope scope(&assm, ARMv7); |
410 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. | 410 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. |
411 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. | 411 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. |
412 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. | 412 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. |
413 __ add(r0, r1, Operand(r2)); | 413 __ add(r0, r1, Operand(r2)); |
(...skipping 23 matching lines...) Expand all Loading... |
437 s32_f64, | 437 s32_f64, |
438 u32_f64 | 438 u32_f64 |
439 }; | 439 }; |
440 | 440 |
441 static void TestRoundingMode(VCVTTypes types, | 441 static void TestRoundingMode(VCVTTypes types, |
442 VFPRoundingMode mode, | 442 VFPRoundingMode mode, |
443 double value, | 443 double value, |
444 int expected, | 444 int expected, |
445 bool expected_exception = false) { | 445 bool expected_exception = false) { |
446 CcTest::InitializeVM(); | 446 CcTest::InitializeVM(); |
447 Isolate* isolate = Isolate::Current(); | 447 Isolate* isolate = CcTest::i_isolate(); |
448 HandleScope scope(isolate); | 448 HandleScope scope(isolate); |
449 | 449 |
450 Assembler assm(isolate, NULL, 0); | 450 Assembler assm(isolate, NULL, 0); |
451 | 451 |
452 if (CpuFeatures::IsSupported(VFP3)) { | 452 if (CpuFeatures::IsSupported(VFP3)) { |
453 CpuFeatureScope scope(&assm, VFP3); | 453 CpuFeatureScope scope(&assm, VFP3); |
454 | 454 |
455 Label wrong_exception; | 455 Label wrong_exception; |
456 | 456 |
457 __ vmrs(r1); | 457 __ vmrs(r1); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 static_cast<uint32_t>(kMaxInt) + 1); | 616 static_cast<uint32_t>(kMaxInt) + 1); |
617 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.49), kMaxUInt); | 617 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.49), kMaxUInt); |
618 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.5), kMaxUInt, true); | 618 TestRoundingMode(u32_f64, RN, (kMaxUInt + 0.5), kMaxUInt, true); |
619 TestRoundingMode(u32_f64, RN, (kMaxUInt + 1.0), kMaxUInt, true); | 619 TestRoundingMode(u32_f64, RN, (kMaxUInt + 1.0), kMaxUInt, true); |
620 } | 620 } |
621 | 621 |
622 | 622 |
623 TEST(8) { | 623 TEST(8) { |
624 // Test VFP multi load/store with ia_w. | 624 // Test VFP multi load/store with ia_w. |
625 CcTest::InitializeVM(); | 625 CcTest::InitializeVM(); |
626 Isolate* isolate = Isolate::Current(); | 626 Isolate* isolate = CcTest::i_isolate(); |
627 HandleScope scope(isolate); | 627 HandleScope scope(isolate); |
628 | 628 |
629 typedef struct { | 629 typedef struct { |
630 double a; | 630 double a; |
631 double b; | 631 double b; |
632 double c; | 632 double c; |
633 double d; | 633 double d; |
634 double e; | 634 double e; |
635 double f; | 635 double f; |
636 double g; | 636 double g; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 CHECK_EQ(3.0, f.e); | 724 CHECK_EQ(3.0, f.e); |
725 CHECK_EQ(4.0, f.f); | 725 CHECK_EQ(4.0, f.f); |
726 CHECK_EQ(5.0, f.g); | 726 CHECK_EQ(5.0, f.g); |
727 CHECK_EQ(6.0, f.h); | 727 CHECK_EQ(6.0, f.h); |
728 } | 728 } |
729 | 729 |
730 | 730 |
731 TEST(9) { | 731 TEST(9) { |
732 // Test VFP multi load/store with ia. | 732 // Test VFP multi load/store with ia. |
733 CcTest::InitializeVM(); | 733 CcTest::InitializeVM(); |
734 Isolate* isolate = Isolate::Current(); | 734 Isolate* isolate = CcTest::i_isolate(); |
735 HandleScope scope(isolate); | 735 HandleScope scope(isolate); |
736 | 736 |
737 typedef struct { | 737 typedef struct { |
738 double a; | 738 double a; |
739 double b; | 739 double b; |
740 double c; | 740 double c; |
741 double d; | 741 double d; |
742 double e; | 742 double e; |
743 double f; | 743 double f; |
744 double g; | 744 double g; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 CHECK_EQ(3.0, f.e); | 836 CHECK_EQ(3.0, f.e); |
837 CHECK_EQ(4.0, f.f); | 837 CHECK_EQ(4.0, f.f); |
838 CHECK_EQ(5.0, f.g); | 838 CHECK_EQ(5.0, f.g); |
839 CHECK_EQ(6.0, f.h); | 839 CHECK_EQ(6.0, f.h); |
840 } | 840 } |
841 | 841 |
842 | 842 |
843 TEST(10) { | 843 TEST(10) { |
844 // Test VFP multi load/store with db_w. | 844 // Test VFP multi load/store with db_w. |
845 CcTest::InitializeVM(); | 845 CcTest::InitializeVM(); |
846 Isolate* isolate = Isolate::Current(); | 846 Isolate* isolate = CcTest::i_isolate(); |
847 HandleScope scope(isolate); | 847 HandleScope scope(isolate); |
848 | 848 |
849 typedef struct { | 849 typedef struct { |
850 double a; | 850 double a; |
851 double b; | 851 double b; |
852 double c; | 852 double c; |
853 double d; | 853 double d; |
854 double e; | 854 double e; |
855 double f; | 855 double f; |
856 double g; | 856 double g; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 CHECK_EQ(3.0, f.e); | 944 CHECK_EQ(3.0, f.e); |
945 CHECK_EQ(4.0, f.f); | 945 CHECK_EQ(4.0, f.f); |
946 CHECK_EQ(5.0, f.g); | 946 CHECK_EQ(5.0, f.g); |
947 CHECK_EQ(6.0, f.h); | 947 CHECK_EQ(6.0, f.h); |
948 } | 948 } |
949 | 949 |
950 | 950 |
951 TEST(11) { | 951 TEST(11) { |
952 // Test instructions using the carry flag. | 952 // Test instructions using the carry flag. |
953 CcTest::InitializeVM(); | 953 CcTest::InitializeVM(); |
954 Isolate* isolate = Isolate::Current(); | 954 Isolate* isolate = CcTest::i_isolate(); |
955 HandleScope scope(isolate); | 955 HandleScope scope(isolate); |
956 | 956 |
957 typedef struct { | 957 typedef struct { |
958 int32_t a; | 958 int32_t a; |
959 int32_t b; | 959 int32_t b; |
960 int32_t c; | 960 int32_t c; |
961 int32_t d; | 961 int32_t d; |
962 } I; | 962 } I; |
963 I i; | 963 I i; |
964 | 964 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 CHECK_EQ(0xabcd0001, i.a); | 1010 CHECK_EQ(0xabcd0001, i.a); |
1011 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); | 1011 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); |
1012 CHECK_EQ(0x00000000, i.c); | 1012 CHECK_EQ(0x00000000, i.c); |
1013 CHECK_EQ(0xffffffff, i.d); | 1013 CHECK_EQ(0xffffffff, i.d); |
1014 } | 1014 } |
1015 | 1015 |
1016 | 1016 |
1017 TEST(12) { | 1017 TEST(12) { |
1018 // Test chaining of label usages within instructions (issue 1644). | 1018 // Test chaining of label usages within instructions (issue 1644). |
1019 CcTest::InitializeVM(); | 1019 CcTest::InitializeVM(); |
1020 Isolate* isolate = Isolate::Current(); | 1020 Isolate* isolate = CcTest::i_isolate(); |
1021 HandleScope scope(isolate); | 1021 HandleScope scope(isolate); |
1022 | 1022 |
1023 Assembler assm(isolate, NULL, 0); | 1023 Assembler assm(isolate, NULL, 0); |
1024 Label target; | 1024 Label target; |
1025 __ b(eq, &target); | 1025 __ b(eq, &target); |
1026 __ b(ne, &target); | 1026 __ b(ne, &target); |
1027 __ bind(&target); | 1027 __ bind(&target); |
1028 __ nop(); | 1028 __ nop(); |
1029 } | 1029 } |
1030 | 1030 |
1031 | 1031 |
1032 TEST(13) { | 1032 TEST(13) { |
1033 // Test VFP instructions using registers d16-d31. | 1033 // Test VFP instructions using registers d16-d31. |
1034 CcTest::InitializeVM(); | 1034 CcTest::InitializeVM(); |
1035 Isolate* isolate = Isolate::Current(); | 1035 Isolate* isolate = CcTest::i_isolate(); |
1036 HandleScope scope(isolate); | 1036 HandleScope scope(isolate); |
1037 | 1037 |
1038 if (!CpuFeatures::IsSupported(VFP32DREGS)) { | 1038 if (!CpuFeatures::IsSupported(VFP32DREGS)) { |
1039 return; | 1039 return; |
1040 } | 1040 } |
1041 | 1041 |
1042 typedef struct { | 1042 typedef struct { |
1043 double a; | 1043 double a; |
1044 double b; | 1044 double b; |
1045 double c; | 1045 double c; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 CHECK_EQ(73.8818412254460241, t.k); | 1153 CHECK_EQ(73.8818412254460241, t.k); |
1154 CHECK_EQ(372106121, t.low); | 1154 CHECK_EQ(372106121, t.low); |
1155 CHECK_EQ(1079146608, t.high); | 1155 CHECK_EQ(1079146608, t.high); |
1156 } | 1156 } |
1157 } | 1157 } |
1158 | 1158 |
1159 | 1159 |
1160 TEST(14) { | 1160 TEST(14) { |
1161 // Test the VFP Canonicalized Nan mode. | 1161 // Test the VFP Canonicalized Nan mode. |
1162 CcTest::InitializeVM(); | 1162 CcTest::InitializeVM(); |
1163 Isolate* isolate = Isolate::Current(); | 1163 Isolate* isolate = CcTest::i_isolate(); |
1164 HandleScope scope(isolate); | 1164 HandleScope scope(isolate); |
1165 | 1165 |
1166 typedef struct { | 1166 typedef struct { |
1167 double left; | 1167 double left; |
1168 double right; | 1168 double right; |
1169 double add_result; | 1169 double add_result; |
1170 double sub_result; | 1170 double sub_result; |
1171 double mul_result; | 1171 double mul_result; |
1172 double div_result; | 1172 double div_result; |
1173 } T; | 1173 } T; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); | 1233 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); |
1234 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.mul_result) & 0xffffffffu); | 1234 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.mul_result) & 0xffffffffu); |
1235 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.div_result) >> 32) & 0x7fffffff); | 1235 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.div_result) >> 32) & 0x7fffffff); |
1236 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.div_result) & 0xffffffffu); | 1236 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.div_result) & 0xffffffffu); |
1237 } | 1237 } |
1238 | 1238 |
1239 | 1239 |
1240 TEST(15) { | 1240 TEST(15) { |
1241 // Test the Neon instructions. | 1241 // Test the Neon instructions. |
1242 CcTest::InitializeVM(); | 1242 CcTest::InitializeVM(); |
1243 Isolate* isolate = Isolate::Current(); | 1243 Isolate* isolate = CcTest::i_isolate(); |
1244 HandleScope scope(isolate); | 1244 HandleScope scope(isolate); |
1245 | 1245 |
1246 typedef struct { | 1246 typedef struct { |
1247 uint32_t src0; | 1247 uint32_t src0; |
1248 uint32_t src1; | 1248 uint32_t src1; |
1249 uint32_t src2; | 1249 uint32_t src2; |
1250 uint32_t src3; | 1250 uint32_t src3; |
1251 uint32_t src4; | 1251 uint32_t src4; |
1252 uint32_t src5; | 1252 uint32_t src5; |
1253 uint32_t src6; | 1253 uint32_t src6; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 CHECK_EQ(0x00410042, t.dstA1); | 1340 CHECK_EQ(0x00410042, t.dstA1); |
1341 CHECK_EQ(0x00830084, t.dstA2); | 1341 CHECK_EQ(0x00830084, t.dstA2); |
1342 CHECK_EQ(0x00810082, t.dstA3); | 1342 CHECK_EQ(0x00810082, t.dstA3); |
1343 } | 1343 } |
1344 } | 1344 } |
1345 | 1345 |
1346 | 1346 |
1347 TEST(16) { | 1347 TEST(16) { |
1348 // Test the pkh, uxtb, uxtab and uxtb16 instructions. | 1348 // Test the pkh, uxtb, uxtab and uxtb16 instructions. |
1349 CcTest::InitializeVM(); | 1349 CcTest::InitializeVM(); |
1350 Isolate* isolate = Isolate::Current(); | 1350 Isolate* isolate = CcTest::i_isolate(); |
1351 HandleScope scope(isolate); | 1351 HandleScope scope(isolate); |
1352 | 1352 |
1353 typedef struct { | 1353 typedef struct { |
1354 uint32_t src0; | 1354 uint32_t src0; |
1355 uint32_t src1; | 1355 uint32_t src1; |
1356 uint32_t src2; | 1356 uint32_t src2; |
1357 uint32_t dst0; | 1357 uint32_t dst0; |
1358 uint32_t dst1; | 1358 uint32_t dst1; |
1359 uint32_t dst2; | 1359 uint32_t dst2; |
1360 uint32_t dst3; | 1360 uint32_t dst3; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 CHECK_EQ(0x00010003, t.dst2); | 1416 CHECK_EQ(0x00010003, t.dst2); |
1417 CHECK_EQ(0x00000003, t.dst3); | 1417 CHECK_EQ(0x00000003, t.dst3); |
1418 CHECK_EQ(0x11121313, t.dst4); | 1418 CHECK_EQ(0x11121313, t.dst4); |
1419 } | 1419 } |
1420 | 1420 |
1421 | 1421 |
1422 TEST(17) { | 1422 TEST(17) { |
1423 // Test generating labels at high addresses. | 1423 // Test generating labels at high addresses. |
1424 // Should not assert. | 1424 // Should not assert. |
1425 CcTest::InitializeVM(); | 1425 CcTest::InitializeVM(); |
1426 Isolate* isolate = Isolate::Current(); | 1426 Isolate* isolate = CcTest::i_isolate(); |
1427 HandleScope scope(isolate); | 1427 HandleScope scope(isolate); |
1428 | 1428 |
1429 // Generate a code segment that will be longer than 2^24 bytes. | 1429 // Generate a code segment that will be longer than 2^24 bytes. |
1430 Assembler assm(isolate, NULL, 0); | 1430 Assembler assm(isolate, NULL, 0); |
1431 for (size_t i = 0; i < 1 << 23 ; ++i) { // 2^23 | 1431 for (size_t i = 0; i < 1 << 23 ; ++i) { // 2^23 |
1432 __ nop(); | 1432 __ nop(); |
1433 } | 1433 } |
1434 | 1434 |
1435 Label target; | 1435 Label target; |
1436 __ b(eq, &target); | 1436 __ b(eq, &target); |
1437 __ bind(&target); | 1437 __ bind(&target); |
1438 __ nop(); | 1438 __ nop(); |
1439 } | 1439 } |
1440 | 1440 |
1441 | 1441 |
1442 TEST(code_relative_offset) { | 1442 TEST(code_relative_offset) { |
1443 // Test extracting the offset of a label from the beginning of the code | 1443 // Test extracting the offset of a label from the beginning of the code |
1444 // in a register. | 1444 // in a register. |
1445 CcTest::InitializeVM(); | 1445 CcTest::InitializeVM(); |
1446 Isolate* isolate = Isolate::Current(); | 1446 Isolate* isolate = CcTest::i_isolate(); |
1447 HandleScope scope(isolate); | 1447 HandleScope scope(isolate); |
1448 // Initialize a code object that will contain the code. | 1448 // Initialize a code object that will contain the code. |
1449 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate); | 1449 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate); |
1450 | 1450 |
1451 Assembler assm(isolate, NULL, 0); | 1451 Assembler assm(isolate, NULL, 0); |
1452 | 1452 |
1453 Label start, target_away, target_faraway; | 1453 Label start, target_away, target_faraway; |
1454 | 1454 |
1455 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit()); | 1455 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit()); |
1456 | 1456 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 Handle<Code> code = isolate->factory()->NewCode(desc, | 1504 Handle<Code> code = isolate->factory()->NewCode(desc, |
1505 Code::ComputeFlags(Code::STUB), code_object); | 1505 Code::ComputeFlags(Code::STUB), code_object); |
1506 CHECK(code->IsCode()); | 1506 CHECK(code->IsCode()); |
1507 F1 f = FUNCTION_CAST<F1>(code->entry()); | 1507 F1 f = FUNCTION_CAST<F1>(code->entry()); |
1508 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); | 1508 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); |
1509 ::printf("f() = %d\n", res); | 1509 ::printf("f() = %d\n", res); |
1510 CHECK_EQ(42, res); | 1510 CHECK_EQ(42, res); |
1511 } | 1511 } |
1512 | 1512 |
1513 #undef __ | 1513 #undef __ |
OLD | NEW |