Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1006)

Side by Side Diff: test/cctest/test-assembler-mips.cc

Issue 6965006: Update mips infrastructure files. (Closed) Base URL: http://github.com/v8/v8.git@bleeding_edge
Patch Set: Fix additional style issues. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/mips/assembler-mips-inl.h ('K') | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 59
60 #define __ assm. 60 #define __ assm.
61 61
62 62
63 TEST(MIPS0) { 63 TEST(MIPS0) {
64 InitializeVM(); 64 InitializeVM();
65 v8::HandleScope scope; 65 v8::HandleScope scope;
66 66
67 MacroAssembler assm(NULL, 0); 67 MacroAssembler assm(Isolate::Current(), NULL, 0);
68 68
69 // Addition. 69 // Addition.
70 __ addu(v0, a0, a1); 70 __ addu(v0, a0, a1);
71 __ jr(ra); 71 __ jr(ra);
72 __ nop(); 72 __ nop();
73 73
74 CodeDesc desc; 74 CodeDesc desc;
75 assm.GetCode(&desc); 75 assm.GetCode(&desc);
76 Object* code = HEAP->CreateCode( 76 Object* code = HEAP->CreateCode(
77 desc, 77 desc,
78 Code::ComputeFlags(Code::STUB), 78 Code::ComputeFlags(Code::STUB),
79 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked(); 79 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
80 CHECK(code->IsCode()); 80 CHECK(code->IsCode());
81 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); 81 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry());
82 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); 82 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0));
83 ::printf("f() = %d\n", res); 83 ::printf("f() = %d\n", res);
84 CHECK_EQ(0xabc, res); 84 CHECK_EQ(0xabc, res);
85 } 85 }
86 86
87 87
88 TEST(MIPS1) { 88 TEST(MIPS1) {
89 InitializeVM(); 89 InitializeVM();
90 v8::HandleScope scope; 90 v8::HandleScope scope;
91 91
92 MacroAssembler assm(NULL, 0); 92 MacroAssembler assm(Isolate::Current(), NULL, 0);
93 Label L, C; 93 Label L, C;
94 94
95 __ mov(a1, a0); 95 __ mov(a1, a0);
96 __ li(v0, 0); 96 __ li(v0, 0);
97 __ b(&C); 97 __ b(&C);
98 __ nop(); 98 __ nop();
99 99
100 __ bind(&L); 100 __ bind(&L);
101 __ addu(v0, v0, a1); 101 __ addu(v0, v0, a1);
102 __ addiu(a1, a1, -1); 102 __ addiu(a1, a1, -1);
(...skipping 17 matching lines...) Expand all
120 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); 120 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0));
121 ::printf("f() = %d\n", res); 121 ::printf("f() = %d\n", res);
122 CHECK_EQ(1275, res); 122 CHECK_EQ(1275, res);
123 } 123 }
124 124
125 125
126 TEST(MIPS2) { 126 TEST(MIPS2) {
127 InitializeVM(); 127 InitializeVM();
128 v8::HandleScope scope; 128 v8::HandleScope scope;
129 129
130 MacroAssembler assm(NULL, 0); 130 MacroAssembler assm(Isolate::Current(), NULL, 0);
131 131
132 Label exit, error; 132 Label exit, error;
133 133
134 // ----- Test all instructions. 134 // ----- Test all instructions.
135 135
136 // Test lui, ori, and addiu, used in the li pseudo-instruction. 136 // Test lui, ori, and addiu, used in the li pseudo-instruction.
137 // This way we can then safely load registers with chosen values. 137 // This way we can then safely load registers with chosen values.
138 138
139 __ ori(t0, zero_reg, 0); 139 __ ori(t0, zero_reg, 0);
140 __ lui(t0, 0x1234); 140 __ lui(t0, 0x1234);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 double c; 274 double c;
275 double d; 275 double d;
276 double e; 276 double e;
277 double f; 277 double f;
278 double g; 278 double g;
279 } T; 279 } T;
280 T t; 280 T t;
281 281
282 // Create a function that accepts &t, and loads, manipulates, and stores 282 // Create a function that accepts &t, and loads, manipulates, and stores
283 // the doubles t.a ... t.f. 283 // the doubles t.a ... t.f.
284 MacroAssembler assm(NULL, 0); 284 MacroAssembler assm(Isolate::Current(), NULL, 0);
285 Label L, C; 285 Label L, C;
286 286
287 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 287 if (CpuFeatures::IsSupported(FPU)) {
288 CpuFeatures::Scope scope(FPU); 288 CpuFeatures::Scope scope(FPU);
289 289
290 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 290 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
291 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 291 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
292 __ add_d(f8, f4, f6); 292 __ add_d(f8, f4, f6);
293 __ sdc1(f8, MemOperand(a0, OFFSET_OF(T, c)) ); // c = a + b. 293 __ sdc1(f8, MemOperand(a0, OFFSET_OF(T, c)) ); // c = a + b.
294 294
295 __ mov_d(f10, f8); // c 295 __ mov_d(f10, f8); // c
296 __ neg_d(f12, f6); // -b 296 __ neg_d(f12, f6); // -b
297 __ sub_d(f10, f10, f12); 297 __ sub_d(f10, f10, f12);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 InitializeVM(); 347 InitializeVM();
348 v8::HandleScope scope; 348 v8::HandleScope scope;
349 349
350 typedef struct { 350 typedef struct {
351 double a; 351 double a;
352 double b; 352 double b;
353 double c; 353 double c;
354 } T; 354 } T;
355 T t; 355 T t;
356 356
357 Assembler assm(NULL, 0); 357 Assembler assm(Isolate::Current(), NULL, 0);
358 Label L, C; 358 Label L, C;
359 359
360 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 360 if (CpuFeatures::IsSupported(FPU)) {
361 CpuFeatures::Scope scope(FPU); 361 CpuFeatures::Scope scope(FPU);
362 362
363 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 363 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
364 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 364 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
365 365
366 // Swap f4 and f6, by using four integer registers, t0-t3. 366 // Swap f4 and f6, by using four integer registers, t0-t3.
367 __ mfc1(t0, f4); 367 __ mfc1(t0, f4);
368 __ mfc1(t1, f5); 368 __ mfc1(t1, f5);
369 __ mfc1(t2, f6); 369 __ mfc1(t2, f6);
370 __ mfc1(t3, f7); 370 __ mfc1(t3, f7);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 v8::HandleScope scope; 408 v8::HandleScope scope;
409 409
410 typedef struct { 410 typedef struct {
411 double a; 411 double a;
412 double b; 412 double b;
413 int i; 413 int i;
414 int j; 414 int j;
415 } T; 415 } T;
416 T t; 416 T t;
417 417
418 Assembler assm(NULL, 0); 418 Assembler assm(Isolate::Current(), NULL, 0);
419 Label L, C; 419 Label L, C;
420 420
421 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 421 if (CpuFeatures::IsSupported(FPU)) {
422 CpuFeatures::Scope scope(FPU); 422 CpuFeatures::Scope scope(FPU);
423 423
424 // Load all structure elements to registers. 424 // Load all structure elements to registers.
425 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 425 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
426 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 426 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
427 __ lw(t0, MemOperand(a0, OFFSET_OF(T, i)) ); 427 __ lw(t0, MemOperand(a0, OFFSET_OF(T, i)) );
428 __ lw(t1, MemOperand(a0, OFFSET_OF(T, j)) ); 428 __ lw(t1, MemOperand(a0, OFFSET_OF(T, j)) );
429 429
430 // Convert double in f4 to int in element i. 430 // Convert double in f4 to int in element i.
431 __ cvt_w_d(f8, f4); 431 __ cvt_w_d(f8, f4);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 int32_t si; 483 int32_t si;
484 int32_t r1; 484 int32_t r1;
485 int32_t r2; 485 int32_t r2;
486 int32_t r3; 486 int32_t r3;
487 int32_t r4; 487 int32_t r4;
488 int32_t r5; 488 int32_t r5;
489 int32_t r6; 489 int32_t r6;
490 } T; 490 } T;
491 T t; 491 T t;
492 492
493 Assembler assm(NULL, 0); 493 Assembler assm(Isolate::Current(), NULL, 0);
494 Label L, C; 494 Label L, C;
495 495
496 // Basic word load/store. 496 // Basic word load/store.
497 __ lw(t0, MemOperand(a0, OFFSET_OF(T, ui)) ); 497 __ lw(t0, MemOperand(a0, OFFSET_OF(T, ui)) );
498 __ sw(t0, MemOperand(a0, OFFSET_OF(T, r1)) ); 498 __ sw(t0, MemOperand(a0, OFFSET_OF(T, r1)) );
499 499
500 // lh with positive data. 500 // lh with positive data.
501 __ lh(t1, MemOperand(a0, OFFSET_OF(T, ui)) ); 501 __ lh(t1, MemOperand(a0, OFFSET_OF(T, ui)) );
502 __ sw(t1, MemOperand(a0, OFFSET_OF(T, r2)) ); 502 __ sw(t1, MemOperand(a0, OFFSET_OF(T, r2)) );
503 503
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 double c; 556 double c;
557 double d; 557 double d;
558 double e; 558 double e;
559 double f; 559 double f;
560 int32_t result; 560 int32_t result;
561 } T; 561 } T;
562 T t; 562 T t;
563 563
564 // Create a function that accepts &t, and loads, manipulates, and stores 564 // Create a function that accepts &t, and loads, manipulates, and stores
565 // the doubles t.a ... t.f. 565 // the doubles t.a ... t.f.
566 MacroAssembler assm(NULL, 0); 566 MacroAssembler assm(Isolate::Current(), NULL, 0);
567 Label neither_is_nan, less_than, outa_here; 567 Label neither_is_nan, less_than, outa_here;
568 568
569 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 569 if (CpuFeatures::IsSupported(FPU)) {
570 CpuFeatures::Scope scope(FPU); 570 CpuFeatures::Scope scope(FPU);
571 571
572 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 572 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
573 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 573 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
574 __ c(UN, D, f4, f6); 574 __ c(UN, D, f4, f6);
575 __ bc1f(&neither_is_nan); 575 __ bc1f(&neither_is_nan);
576 __ nop(); 576 __ nop();
577 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) ); 577 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) );
578 __ Branch(&outa_here); 578 __ Branch(&outa_here);
579 579
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 int32_t result_rotrv_4; 638 int32_t result_rotrv_4;
639 int32_t result_rotrv_8; 639 int32_t result_rotrv_8;
640 int32_t result_rotrv_12; 640 int32_t result_rotrv_12;
641 int32_t result_rotrv_16; 641 int32_t result_rotrv_16;
642 int32_t result_rotrv_20; 642 int32_t result_rotrv_20;
643 int32_t result_rotrv_24; 643 int32_t result_rotrv_24;
644 int32_t result_rotrv_28; 644 int32_t result_rotrv_28;
645 } T; 645 } T;
646 T t; 646 T t;
647 647
648 MacroAssembler assm(NULL, 0); 648 MacroAssembler assm(Isolate::Current(), NULL, 0);
649 649
650 // Basic word load. 650 // Basic word load.
651 __ lw(t0, MemOperand(a0, OFFSET_OF(T, input)) ); 651 __ lw(t0, MemOperand(a0, OFFSET_OF(T, input)) );
652 652
653 // ROTR instruction (called through the Ror macro). 653 // ROTR instruction (called through the Ror macro).
654 __ Ror(t1, t0, 0x0004); 654 __ Ror(t1, t0, 0x0004);
655 __ Ror(t2, t0, 0x0008); 655 __ Ror(t2, t0, 0x0008);
656 __ Ror(t3, t0, 0x000c); 656 __ Ror(t3, t0, 0x000c);
657 __ Ror(t4, t0, 0x0010); 657 __ Ror(t4, t0, 0x0010);
658 __ Ror(t5, t0, 0x0014); 658 __ Ror(t5, t0, 0x0014);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 CHECK_EQ(0x34567812, t.result_rotrv_24); 723 CHECK_EQ(0x34567812, t.result_rotrv_24);
724 CHECK_EQ(0x23456781, t.result_rotrv_28); 724 CHECK_EQ(0x23456781, t.result_rotrv_28);
725 } 725 }
726 726
727 727
728 TEST(MIPS9) { 728 TEST(MIPS9) {
729 // Test BRANCH improvements. 729 // Test BRANCH improvements.
730 InitializeVM(); 730 InitializeVM();
731 v8::HandleScope scope; 731 v8::HandleScope scope;
732 732
733 MacroAssembler assm(NULL, 0); 733 MacroAssembler assm(Isolate::Current(), NULL, 0);
734 Label exit, exit2, exit3; 734 Label exit, exit2, exit3;
735 735
736 __ Branch(&exit, ge, a0, Operand(0x00000000)); 736 __ Branch(&exit, ge, a0, Operand(0x00000000));
737 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); 737 __ Branch(&exit2, ge, a0, Operand(0x00001FFF));
738 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); 738 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF));
739 739
740 __ bind(&exit); 740 __ bind(&exit);
741 __ bind(&exit2); 741 __ bind(&exit2);
742 __ bind(&exit3); 742 __ bind(&exit3);
743 __ jr(ra); 743 __ jr(ra);
(...skipping 20 matching lines...) Expand all
764 double b; 764 double b;
765 int32_t dbl_mant; 765 int32_t dbl_mant;
766 int32_t dbl_exp; 766 int32_t dbl_exp;
767 int32_t long_hi; 767 int32_t long_hi;
768 int32_t long_lo; 768 int32_t long_lo;
769 int32_t b_long_hi; 769 int32_t b_long_hi;
770 int32_t b_long_lo; 770 int32_t b_long_lo;
771 } T; 771 } T;
772 T t; 772 T t;
773 773
774 Assembler assm(NULL, 0); 774 Assembler assm(Isolate::Current(), NULL, 0);
775 Label L, C; 775 Label L, C;
776 776
777 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 777 if (CpuFeatures::IsSupported(FPU)) {
778 CpuFeatures::Scope scope(FPU); 778 CpuFeatures::Scope scope(FPU);
779 779
780 // Load all structure elements to registers. 780 // Load all structure elements to registers.
781 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a))); 781 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a)));
782 782
783 // Save the raw bits of the double. 783 // Save the raw bits of the double.
784 __ mfc1(t0, f0); 784 __ mfc1(t0, f0);
785 __ mfc1(t1, f1); 785 __ mfc1(t1, f1);
786 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant))); 786 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant)));
787 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp))); 787 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp)));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 int32_t swl_1; 848 int32_t swl_1;
849 int32_t swl_2; 849 int32_t swl_2;
850 int32_t swl_3; 850 int32_t swl_3;
851 int32_t swr_0; 851 int32_t swr_0;
852 int32_t swr_1; 852 int32_t swr_1;
853 int32_t swr_2; 853 int32_t swr_2;
854 int32_t swr_3; 854 int32_t swr_3;
855 } T; 855 } T;
856 T t; 856 T t;
857 857
858 Assembler assm(NULL, 0); 858 Assembler assm(Isolate::Current(), NULL, 0);
859 859
860 // Test all combinations of LWL and vAddr. 860 // Test all combinations of LWL and vAddr.
861 __ lw(t0, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 861 __ lw(t0, MemOperand(a0, OFFSET_OF(T, reg_init)) );
862 __ lwl(t0, MemOperand(a0, OFFSET_OF(T, mem_init)) ); 862 __ lwl(t0, MemOperand(a0, OFFSET_OF(T, mem_init)) );
863 __ sw(t0, MemOperand(a0, OFFSET_OF(T, lwl_0)) ); 863 __ sw(t0, MemOperand(a0, OFFSET_OF(T, lwl_0)) );
864 864
865 __ lw(t1, MemOperand(a0, OFFSET_OF(T, reg_init)) ); 865 __ lw(t1, MemOperand(a0, OFFSET_OF(T, reg_init)) );
866 __ lwl(t1, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) ); 866 __ lwl(t1, MemOperand(a0, OFFSET_OF(T, mem_init) + 1) );
867 __ sw(t1, MemOperand(a0, OFFSET_OF(T, lwl_1)) ); 867 __ sw(t1, MemOperand(a0, OFFSET_OF(T, lwl_1)) );
868 868
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 typedef struct { 979 typedef struct {
980 int32_t x; 980 int32_t x;
981 int32_t y; 981 int32_t y;
982 int32_t y1; 982 int32_t y1;
983 int32_t y2; 983 int32_t y2;
984 int32_t y3; 984 int32_t y3;
985 int32_t y4; 985 int32_t y4;
986 } T; 986 } T;
987 T t; 987 T t;
988 988
989 MacroAssembler assm(NULL, 0); 989 MacroAssembler assm(Isolate::Current(), NULL, 0);
990 990
991 __ mov(t6, fp); // Save frame pointer. 991 __ mov(t6, fp); // Save frame pointer.
992 __ mov(fp, a0); // Access struct T by fp. 992 __ mov(fp, a0); // Access struct T by fp.
993 __ lw(t0, MemOperand(a0, OFFSET_OF(T, y)) ); 993 __ lw(t0, MemOperand(a0, OFFSET_OF(T, y)) );
994 __ lw(t3, MemOperand(a0, OFFSET_OF(T, y4)) ); 994 __ lw(t3, MemOperand(a0, OFFSET_OF(T, y4)) );
995 995
996 __ addu(t1, t0, t3); 996 __ addu(t1, t0, t3);
997 __ subu(t4, t0, t3); 997 __ subu(t4, t0, t3);
998 __ nop(); 998 __ nop();
999 __ Push(t0); // These instructions disappear after opt. 999 __ push(t0); // These instructions disappear after opt.
1000 __ Pop(); 1000 __ Pop();
1001 __ addu(t0, t0, t0); 1001 __ addu(t0, t0, t0);
1002 __ nop(); 1002 __ nop();
1003 __ Pop(); // These instructions disappear after opt. 1003 __ Pop(); // These instructions disappear after opt.
1004 __ Push(t3); 1004 __ push(t3);
1005 __ nop(); 1005 __ nop();
1006 __ Push(t3); // These instructions disappear after opt. 1006 __ push(t3); // These instructions disappear after opt.
1007 __ Pop(t3); 1007 __ pop(t3);
1008 __ nop(); 1008 __ nop();
1009 __ Push(t3); 1009 __ push(t3);
1010 __ Pop(t4); 1010 __ pop(t4);
1011 __ nop(); 1011 __ nop();
1012 __ sw(t0, MemOperand(fp, OFFSET_OF(T, y)) ); 1012 __ sw(t0, MemOperand(fp, OFFSET_OF(T, y)) );
1013 __ lw(t0, MemOperand(fp, OFFSET_OF(T, y)) ); 1013 __ lw(t0, MemOperand(fp, OFFSET_OF(T, y)) );
1014 __ nop(); 1014 __ nop();
1015 __ sw(t0, MemOperand(fp, OFFSET_OF(T, y)) ); 1015 __ sw(t0, MemOperand(fp, OFFSET_OF(T, y)) );
1016 __ lw(t1, MemOperand(fp, OFFSET_OF(T, y)) ); 1016 __ lw(t1, MemOperand(fp, OFFSET_OF(T, y)) );
1017 __ nop(); 1017 __ nop();
1018 __ Push(t1); 1018 __ push(t1);
1019 __ lw(t1, MemOperand(fp, OFFSET_OF(T, y)) ); 1019 __ lw(t1, MemOperand(fp, OFFSET_OF(T, y)) );
1020 __ Pop(t1); 1020 __ pop(t1);
1021 __ nop(); 1021 __ nop();
1022 __ Push(t1); 1022 __ push(t1);
1023 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) ); 1023 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) );
1024 __ Pop(t1); 1024 __ pop(t1);
1025 __ nop(); 1025 __ nop();
1026 __ Push(t1); 1026 __ push(t1);
1027 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) ); 1027 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) );
1028 __ Pop(t2); 1028 __ pop(t2);
1029 __ nop(); 1029 __ nop();
1030 __ Push(t2); 1030 __ push(t2);
1031 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) ); 1031 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) );
1032 __ Pop(t1); 1032 __ pop(t1);
1033 __ nop(); 1033 __ nop();
1034 __ Push(t1); 1034 __ push(t1);
1035 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) ); 1035 __ lw(t2, MemOperand(fp, OFFSET_OF(T, y)) );
1036 __ Pop(t3); 1036 __ pop(t3);
1037 __ nop(); 1037 __ nop();
1038 1038
1039 __ mov(fp, t6); 1039 __ mov(fp, t6);
1040 __ jr(ra); 1040 __ jr(ra);
1041 __ nop(); 1041 __ nop();
1042 1042
1043 CodeDesc desc; 1043 CodeDesc desc;
1044 assm.GetCode(&desc); 1044 assm.GetCode(&desc);
1045 Object* code = HEAP->CreateCode( 1045 Object* code = HEAP->CreateCode(
1046 desc, 1046 desc,
(...skipping 23 matching lines...) Expand all
1070 typedef struct { 1070 typedef struct {
1071 double cvt_big_out; 1071 double cvt_big_out;
1072 double cvt_small_out; 1072 double cvt_small_out;
1073 uint32_t trunc_big_out; 1073 uint32_t trunc_big_out;
1074 uint32_t trunc_small_out; 1074 uint32_t trunc_small_out;
1075 uint32_t cvt_big_in; 1075 uint32_t cvt_big_in;
1076 uint32_t cvt_small_in; 1076 uint32_t cvt_small_in;
1077 } T; 1077 } T;
1078 T t; 1078 T t;
1079 1079
1080 MacroAssembler assm(NULL, 0); 1080 MacroAssembler assm(Isolate::Current(), NULL, 0);
1081 1081
1082 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 1082 if (CpuFeatures::IsSupported(FPU)) {
1083 CpuFeatures::Scope scope(FPU); 1083 CpuFeatures::Scope scope(FPU);
1084 1084
1085 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_small_in))); 1085 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_small_in)));
1086 __ Cvt_d_uw(f10, t0); 1086 __ Cvt_d_uw(f10, t0);
1087 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, cvt_small_out))); 1087 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, cvt_small_out)));
1088 1088
1089 __ Trunc_uw_d(f10, f10); 1089 __ Trunc_uw_d(f10, f10);
1090 __ swc1(f10, MemOperand(a0, OFFSET_OF(T, trunc_small_out))); 1090 __ swc1(f10, MemOperand(a0, OFFSET_OF(T, trunc_small_out)));
1091 1091
1092 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_big_in))); 1092 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_big_in)));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 TEST(MIPS14) { 1127 TEST(MIPS14) {
1128 // Test round, floor, ceil, trunc, cvt. 1128 // Test round, floor, ceil, trunc, cvt.
1129 InitializeVM(); 1129 InitializeVM();
1130 v8::HandleScope scope; 1130 v8::HandleScope scope;
1131 1131
1132 #define ROUND_STRUCT_ELEMENT(x) \ 1132 #define ROUND_STRUCT_ELEMENT(x) \
1133 int32_t x##_up_out; \ 1133 int32_t x##_up_out; \
1134 int32_t x##_down_out; \ 1134 int32_t x##_down_out; \
1135 int32_t neg_##x##_up_out; \ 1135 int32_t neg_##x##_up_out; \
1136 int32_t neg_##x##_down_out; \ 1136 int32_t neg_##x##_down_out; \
1137 int32_t x##_err1_out; \ 1137 uint32_t x##_err1_out; \
1138 int32_t x##_err2_out; \ 1138 uint32_t x##_err2_out; \
1139 int32_t x##_err3_out; \ 1139 uint32_t x##_err3_out; \
1140 int32_t x##_err4_out; \ 1140 uint32_t x##_err4_out; \
1141 int32_t x##_invalid_result; 1141 int32_t x##_invalid_result;
1142 1142
1143 typedef struct { 1143 typedef struct {
1144 double round_up_in; 1144 double round_up_in;
1145 double round_down_in; 1145 double round_down_in;
1146 double neg_round_up_in; 1146 double neg_round_up_in;
1147 double neg_round_down_in; 1147 double neg_round_down_in;
1148 double err1_in; 1148 double err1_in;
1149 double err2_in; 1149 double err2_in;
1150 double err3_in; 1150 double err3_in;
1151 double err4_in; 1151 double err4_in;
1152 1152
1153 ROUND_STRUCT_ELEMENT(round) 1153 ROUND_STRUCT_ELEMENT(round)
1154 ROUND_STRUCT_ELEMENT(floor) 1154 ROUND_STRUCT_ELEMENT(floor)
1155 ROUND_STRUCT_ELEMENT(ceil) 1155 ROUND_STRUCT_ELEMENT(ceil)
1156 ROUND_STRUCT_ELEMENT(trunc) 1156 ROUND_STRUCT_ELEMENT(trunc)
1157 ROUND_STRUCT_ELEMENT(cvt) 1157 ROUND_STRUCT_ELEMENT(cvt)
1158 } T; 1158 } T;
1159 T t; 1159 T t;
1160 1160
1161 #undef ROUND_STRUCT_ELEMENT 1161 #undef ROUND_STRUCT_ELEMENT
1162 1162
1163 MacroAssembler assm(NULL, 0); 1163 MacroAssembler assm(Isolate::Current(), NULL, 0);
1164 1164
1165 if (Isolate::Current()->cpu_features()->IsSupported(FPU)) { 1165 if (CpuFeatures::IsSupported(FPU)) {
1166 CpuFeatures::Scope scope(FPU); 1166 CpuFeatures::Scope scope(FPU);
1167 1167
1168 // Save FCSR. 1168 // Save FCSR.
1169 __ cfc1(a1, FCSR); 1169 __ cfc1(a1, FCSR);
1170 // Disable FPU exceptions. 1170 // Disable FPU exceptions.
1171 __ ctc1(zero_reg, FCSR); 1171 __ ctc1(zero_reg, FCSR);
1172 #define RUN_ROUND_TEST(x) \ 1172 #define RUN_ROUND_TEST(x) \
1173 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, round_up_in))); \ 1173 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, round_up_in))); \
1174 __ x##_w_d(f0, f0); \ 1174 __ x##_w_d(f0, f0); \
1175 __ swc1(f0, MemOperand(a0, OFFSET_OF(T, x##_up_out))); \ 1175 __ swc1(f0, MemOperand(a0, OFFSET_OF(T, x##_up_out))); \
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 t.neg_round_up_in = -123.5; 1239 t.neg_round_up_in = -123.5;
1240 t.neg_round_down_in = -123.49; 1240 t.neg_round_down_in = -123.49;
1241 t.err1_in = 123.51; 1241 t.err1_in = 123.51;
1242 t.err2_in = 1; 1242 t.err2_in = 1;
1243 t.err3_in = static_cast<double>(1) + 0xFFFFFFFF; 1243 t.err3_in = static_cast<double>(1) + 0xFFFFFFFF;
1244 t.err4_in = NAN; 1244 t.err4_in = NAN;
1245 1245
1246 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1246 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
1247 USE(dummy); 1247 USE(dummy);
1248 1248
1249 #define GET_FPU_ERR(x) ((x >> 2) & (32 - 1)) 1249 #define GET_FPU_ERR(x) (static_cast<int>((x >> kFCSRFlagShift) & kFCSRFlagMask))
1250 1250
1251 CHECK_EQ(124, t.round_up_out); 1251 CHECK_EQ(124, t.round_up_out);
1252 CHECK_EQ(123, t.round_down_out); 1252 CHECK_EQ(123, t.round_down_out);
1253 CHECK_EQ(-124, t.neg_round_up_out); 1253 CHECK_EQ(-124, t.neg_round_up_out);
1254 CHECK_EQ(-123, t.neg_round_down_out); 1254 CHECK_EQ(-123, t.neg_round_down_out);
1255 1255
1256 // Inaccurate. 1256 // Inexact.
1257 CHECK_EQ(1, GET_FPU_ERR(t.round_err1_out)); 1257 CHECK_EQ(kFCSRInexactFlagBit, GET_FPU_ERR(t.round_err1_out));
1258 // No error. 1258 // No error.
1259 CHECK_EQ(0, GET_FPU_ERR(t.round_err2_out)); 1259 CHECK_EQ(0, GET_FPU_ERR(t.round_err2_out));
1260 // Invalid operation. 1260 // Invalid operation.
1261 CHECK_EQ(16, GET_FPU_ERR(t.round_err3_out)); 1261 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.round_err3_out));
1262 CHECK_EQ(16, GET_FPU_ERR(t.round_err4_out)); 1262 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.round_err4_out));
1263 CHECK_EQ(kFPUInvalidResult, t.round_invalid_result); 1263 CHECK_EQ(kFPUInvalidResult, t.round_invalid_result);
1264 1264
1265 CHECK_EQ(123, t.floor_up_out); 1265 CHECK_EQ(123, t.floor_up_out);
1266 CHECK_EQ(123, t.floor_down_out); 1266 CHECK_EQ(123, t.floor_down_out);
1267 CHECK_EQ(-124, t.neg_floor_up_out); 1267 CHECK_EQ(-124, t.neg_floor_up_out);
1268 CHECK_EQ(-124, t.neg_floor_down_out); 1268 CHECK_EQ(-124, t.neg_floor_down_out);
1269 1269
1270 // Inaccurate. 1270 // Inexact.
1271 CHECK_EQ(1, GET_FPU_ERR(t.floor_err1_out)); 1271 CHECK_EQ(kFCSRInexactFlagBit, GET_FPU_ERR(t.floor_err1_out));
1272 // No error. 1272 // No error.
1273 CHECK_EQ(0, GET_FPU_ERR(t.floor_err2_out)); 1273 CHECK_EQ(0, GET_FPU_ERR(t.floor_err2_out));
1274 // Invalid operation. 1274 // Invalid operation.
1275 CHECK_EQ(16, GET_FPU_ERR(t.floor_err3_out)); 1275 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.floor_err3_out));
1276 CHECK_EQ(16, GET_FPU_ERR(t.floor_err4_out)); 1276 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.floor_err4_out));
1277 CHECK_EQ(kFPUInvalidResult, t.floor_invalid_result); 1277 CHECK_EQ(kFPUInvalidResult, t.floor_invalid_result);
1278 1278
1279 CHECK_EQ(124, t.ceil_up_out); 1279 CHECK_EQ(124, t.ceil_up_out);
1280 CHECK_EQ(124, t.ceil_down_out); 1280 CHECK_EQ(124, t.ceil_down_out);
1281 CHECK_EQ(-123, t.neg_ceil_up_out); 1281 CHECK_EQ(-123, t.neg_ceil_up_out);
1282 CHECK_EQ(-123, t.neg_ceil_down_out); 1282 CHECK_EQ(-123, t.neg_ceil_down_out);
1283 1283
1284 // Inaccurate. 1284 // Inexact.
1285 CHECK_EQ(1, GET_FPU_ERR(t.ceil_err1_out)); 1285 CHECK_EQ(kFCSRInexactFlagBit, GET_FPU_ERR(t.ceil_err1_out));
1286 // No error. 1286 // No error.
1287 CHECK_EQ(0, GET_FPU_ERR(t.ceil_err2_out)); 1287 CHECK_EQ(0, GET_FPU_ERR(t.ceil_err2_out));
1288 // Invalid operation. 1288 // Invalid operation.
1289 CHECK_EQ(16, GET_FPU_ERR(t.ceil_err3_out)); 1289 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.ceil_err3_out));
1290 CHECK_EQ(16, GET_FPU_ERR(t.ceil_err4_out)); 1290 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.ceil_err4_out));
1291 CHECK_EQ(kFPUInvalidResult, t.ceil_invalid_result); 1291 CHECK_EQ(kFPUInvalidResult, t.ceil_invalid_result);
1292 1292
1293 // In rounding mode 0 cvt should behave like round. 1293 // In rounding mode 0 cvt should behave like round.
1294 CHECK_EQ(t.round_up_out, t.cvt_up_out); 1294 CHECK_EQ(t.round_up_out, t.cvt_up_out);
1295 CHECK_EQ(t.round_down_out, t.cvt_down_out); 1295 CHECK_EQ(t.round_down_out, t.cvt_down_out);
1296 CHECK_EQ(t.neg_round_up_out, t.neg_cvt_up_out); 1296 CHECK_EQ(t.neg_round_up_out, t.neg_cvt_up_out);
1297 CHECK_EQ(t.neg_round_down_out, t.neg_cvt_down_out); 1297 CHECK_EQ(t.neg_round_down_out, t.neg_cvt_down_out);
1298 1298
1299 // Inaccurate. 1299 // Inexact.
1300 CHECK_EQ(1, GET_FPU_ERR(t.cvt_err1_out)); 1300 CHECK_EQ(kFCSRInexactFlagBit, GET_FPU_ERR(t.cvt_err1_out));
1301 // No error. 1301 // No error.
1302 CHECK_EQ(0, GET_FPU_ERR(t.cvt_err2_out)); 1302 CHECK_EQ(0, GET_FPU_ERR(t.cvt_err2_out));
1303 // Invalid operation. 1303 // Invalid operation.
1304 CHECK_EQ(16, GET_FPU_ERR(t.cvt_err3_out)); 1304 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.cvt_err3_out));
1305 CHECK_EQ(16, GET_FPU_ERR(t.cvt_err4_out)); 1305 CHECK_EQ(kFCSRInvalidOpFlagBit, GET_FPU_ERR(t.cvt_err4_out));
1306 CHECK_EQ(kFPUInvalidResult, t.cvt_invalid_result); 1306 CHECK_EQ(kFPUInvalidResult, t.cvt_invalid_result);
1307 } 1307 }
1308 } 1308 }
1309 1309
1310 1310
1311 #undef __ 1311 #undef __
OLDNEW
« src/mips/assembler-mips-inl.h ('K') | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698