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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-assembler-a64.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // Test hos the long ints map to FP regs pairs. 758 // Test hos the long ints map to FP regs pairs.
759 CcTest::InitializeVM(); 759 CcTest::InitializeVM();
760 Isolate* isolate = CcTest::i_isolate(); 760 Isolate* isolate = CcTest::i_isolate();
761 HandleScope scope(isolate); 761 HandleScope scope(isolate);
762 762
763 typedef struct { 763 typedef struct {
764 double a; 764 double a;
765 double b; 765 double b;
766 int32_t dbl_mant; 766 int32_t dbl_mant;
767 int32_t dbl_exp; 767 int32_t dbl_exp;
768 int32_t long_hi; 768 int32_t word;
769 int32_t long_lo; 769 int32_t b_word;
770 int32_t b_long_hi;
771 int32_t b_long_lo;
772 } T; 770 } T;
773 T t; 771 T t;
774 772
775 Assembler assm(isolate, NULL, 0); 773 Assembler assm(isolate, NULL, 0);
776 Label L, C; 774 Label L, C;
777 775
778 if (kArchVariant == kMips32r2) { 776 if (kArchVariant == kMips32r2) {
779 // Load all structure elements to registers. 777 // Load all structure elements to registers.
780 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a))); 778 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a)));
781 779
782 // Save the raw bits of the double. 780 // Save the raw bits of the double.
783 __ mfc1(t0, f0); 781 __ mfc1(t0, f0);
784 __ mfc1(t1, f1); 782 __ mfc1(t1, f1);
785 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant))); 783 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant)));
786 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp))); 784 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp)));
787 785
788 // Convert double in f0 to long, save hi/lo parts. 786 // Convert double in f0 to long, save hi/lo parts.
789 __ cvt_l_d(f0, f0); 787 __ cvt_w_d(f0, f0);
790 __ mfc1(t0, f0); // f0 has LS 32 bits of long. 788 __ mfc1(t0, f0); // f0 has a 32-bits word.
791 __ mfc1(t1, f1); // f1 has MS 32 bits of long. 789 __ sw(t0, MemOperand(a0, OFFSET_OF(T, word)));
792 __ sw(t0, MemOperand(a0, OFFSET_OF(T, long_lo)));
793 __ sw(t1, MemOperand(a0, OFFSET_OF(T, long_hi)));
794 790
795 // Convert the b long integers to double b. 791 // Convert the b long integers to double b.
796 __ lw(t0, MemOperand(a0, OFFSET_OF(T, b_long_lo))); 792 __ lw(t0, MemOperand(a0, OFFSET_OF(T, b_word)));
797 __ lw(t1, MemOperand(a0, OFFSET_OF(T, b_long_hi))); 793 __ mtc1(t0, f8); // f8 has a 32-bits word.
798 __ mtc1(t0, f8); // f8 has LS 32-bits. 794 __ cvt_d_w(f10, f8);
799 __ mtc1(t1, f9); // f9 has MS 32-bits.
800 __ cvt_d_l(f10, f8);
801 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, b))); 795 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, b)));
802 796
803 __ jr(ra); 797 __ jr(ra);
804 __ nop(); 798 __ nop();
805 799
806 CodeDesc desc; 800 CodeDesc desc;
807 assm.GetCode(&desc); 801 assm.GetCode(&desc);
808 Object* code = CcTest::heap()->CreateCode( 802 Object* code = CcTest::heap()->CreateCode(
809 desc, 803 desc,
810 Code::ComputeFlags(Code::STUB), 804 Code::ComputeFlags(Code::STUB),
811 Handle<Code>())->ToObjectChecked(); 805 Handle<Code>())->ToObjectChecked();
812 CHECK(code->IsCode()); 806 CHECK(code->IsCode());
813 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); 807 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
814 t.a = 2.147483647e9; // 0x7fffffff -> 0x41DFFFFFFFC00000 as double. 808 t.a = 2.147483646e+09; // 0x7FFFFFFE -> 0xFF80000041DFFFFF as double.
815 t.b_long_hi = 0x000000ff; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. 809 t.b_word = 0x0ff00ff0; // 0x0FF00FF0 -> 0x as double.
816 t.b_long_lo = 0x00ff00ff;
817 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 810 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
818 USE(dummy); 811 USE(dummy);
819 812
820 CHECK_EQ(0x41DFFFFF, t.dbl_exp); 813 CHECK_EQ(0x41DFFFFF, t.dbl_exp);
821 CHECK_EQ(0xFFC00000, t.dbl_mant); 814 CHECK_EQ(0xFF800000, t.dbl_mant);
822 CHECK_EQ(0, t.long_hi); 815 CHECK_EQ(0X7FFFFFFE, t.word);
823 CHECK_EQ(0x7fffffff, t.long_lo); 816 // 0x0FF00FF0 -> 2.6739096+e08
824 // 0xFF00FF00FF -> 1.095233372415e12. 817 CHECK_EQ(2.6739096e08, t.b);
825 CHECK_EQ(1.095233372415e12, t.b);
826 } 818 }
827 } 819 }
828 820
829 821
830 TEST(MIPS11) { 822 TEST(MIPS11) {
831 // Test LWL, LWR, SWL and SWR instructions. 823 // Test LWL, LWR, SWL and SWR instructions.
832 CcTest::InitializeVM(); 824 CcTest::InitializeVM();
833 Isolate* isolate = CcTest::i_isolate(); 825 Isolate* isolate = CcTest::i_isolate();
834 HandleScope scope(isolate); 826 HandleScope scope(isolate);
835 827
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 Label target; 1257 Label target;
1266 __ beq(v0, v1, &target); 1258 __ beq(v0, v1, &target);
1267 __ nop(); 1259 __ nop();
1268 __ bne(v0, v1, &target); 1260 __ bne(v0, v1, &target);
1269 __ nop(); 1261 __ nop();
1270 __ bind(&target); 1262 __ bind(&target);
1271 __ nop(); 1263 __ nop();
1272 } 1264 }
1273 1265
1274 #undef __ 1266 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-a64.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698