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

Side by Side Diff: test/cctest/test-macro-assembler-mips64.cc

Issue 2829073002: MIPS64: Move load/store instructions to macro-assembler. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « test/cctest/test-code-stubs-mips64.cc ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int64_t r6; 61 int64_t r6;
62 int64_t r7; 62 int64_t r7;
63 }; 63 };
64 T t; 64 T t;
65 65
66 MacroAssembler assembler(isolate, NULL, 0, 66 MacroAssembler assembler(isolate, NULL, 0,
67 v8::internal::CodeObjectRequired::kYes); 67 v8::internal::CodeObjectRequired::kYes);
68 68
69 MacroAssembler* masm = &assembler; 69 MacroAssembler* masm = &assembler;
70 70
71 __ ld(a4, MemOperand(a0, offsetof(T, r1))); 71 __ Ld(a4, MemOperand(a0, offsetof(T, r1)));
72 __ nop(); 72 __ nop();
73 __ ByteSwapSigned(a4, a4, 8); 73 __ ByteSwapSigned(a4, a4, 8);
74 __ sd(a4, MemOperand(a0, offsetof(T, r1))); 74 __ Sd(a4, MemOperand(a0, offsetof(T, r1)));
75 75
76 __ ld(a4, MemOperand(a0, offsetof(T, r2))); 76 __ Ld(a4, MemOperand(a0, offsetof(T, r2)));
77 __ nop(); 77 __ nop();
78 __ ByteSwapSigned(a4, a4, 4); 78 __ ByteSwapSigned(a4, a4, 4);
79 __ sd(a4, MemOperand(a0, offsetof(T, r2))); 79 __ Sd(a4, MemOperand(a0, offsetof(T, r2)));
80 80
81 __ ld(a4, MemOperand(a0, offsetof(T, r3))); 81 __ Ld(a4, MemOperand(a0, offsetof(T, r3)));
82 __ nop(); 82 __ nop();
83 __ ByteSwapSigned(a4, a4, 2); 83 __ ByteSwapSigned(a4, a4, 2);
84 __ sd(a4, MemOperand(a0, offsetof(T, r3))); 84 __ Sd(a4, MemOperand(a0, offsetof(T, r3)));
85 85
86 __ ld(a4, MemOperand(a0, offsetof(T, r4))); 86 __ Ld(a4, MemOperand(a0, offsetof(T, r4)));
87 __ nop(); 87 __ nop();
88 __ ByteSwapSigned(a4, a4, 1); 88 __ ByteSwapSigned(a4, a4, 1);
89 __ sd(a4, MemOperand(a0, offsetof(T, r4))); 89 __ Sd(a4, MemOperand(a0, offsetof(T, r4)));
90 90
91 __ ld(a4, MemOperand(a0, offsetof(T, r5))); 91 __ Ld(a4, MemOperand(a0, offsetof(T, r5)));
92 __ nop(); 92 __ nop();
93 __ ByteSwapUnsigned(a4, a4, 1); 93 __ ByteSwapUnsigned(a4, a4, 1);
94 __ sd(a4, MemOperand(a0, offsetof(T, r5))); 94 __ Sd(a4, MemOperand(a0, offsetof(T, r5)));
95 95
96 __ ld(a4, MemOperand(a0, offsetof(T, r6))); 96 __ Ld(a4, MemOperand(a0, offsetof(T, r6)));
97 __ nop(); 97 __ nop();
98 __ ByteSwapUnsigned(a4, a4, 2); 98 __ ByteSwapUnsigned(a4, a4, 2);
99 __ sd(a4, MemOperand(a0, offsetof(T, r6))); 99 __ Sd(a4, MemOperand(a0, offsetof(T, r6)));
100 100
101 __ ld(a4, MemOperand(a0, offsetof(T, r7))); 101 __ Ld(a4, MemOperand(a0, offsetof(T, r7)));
102 __ nop(); 102 __ nop();
103 __ ByteSwapUnsigned(a4, a4, 4); 103 __ ByteSwapUnsigned(a4, a4, 4);
104 __ sd(a4, MemOperand(a0, offsetof(T, r7))); 104 __ Sd(a4, MemOperand(a0, offsetof(T, r7)));
105 105
106 __ jr(ra); 106 __ jr(ra);
107 __ nop(); 107 __ nop();
108 108
109 CodeDesc desc; 109 CodeDesc desc;
110 masm->GetCode(&desc); 110 masm->GetCode(&desc);
111 Handle<Code> code = isolate->factory()->NewCode( 111 Handle<Code> code = isolate->factory()->NewCode(
112 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 112 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
113 ::F3 f = FUNCTION_CAST<::F3>(code->entry()); 113 ::F3 f = FUNCTION_CAST<::F3>(code->entry());
114 t.r1 = 0x5612FFCD9D327ACC; 114 t.r1 = 0x5612FFCD9D327ACC;
(...skipping 29 matching lines...) Expand all
144 } 144 }
145 145
146 MacroAssembler assembler(isolate, NULL, 0, 146 MacroAssembler assembler(isolate, NULL, 0,
147 v8::internal::CodeObjectRequired::kYes); 147 v8::internal::CodeObjectRequired::kYes);
148 MacroAssembler* masm = &assembler; 148 MacroAssembler* masm = &assembler;
149 149
150 __ mov(a4, a0); 150 __ mov(a4, a0);
151 for (int i = 0; i < 64; i++) { 151 for (int i = 0; i < 64; i++) {
152 // Load constant. 152 // Load constant.
153 __ li(a5, Operand(refConstants[i])); 153 __ li(a5, Operand(refConstants[i]));
154 __ sd(a5, MemOperand(a4)); 154 __ Sd(a5, MemOperand(a4));
155 __ Daddu(a4, a4, Operand(kPointerSize)); 155 __ Daddu(a4, a4, Operand(kPointerSize));
156 } 156 }
157 157
158 __ jr(ra); 158 __ jr(ra);
159 __ nop(); 159 __ nop();
160 160
161 CodeDesc desc; 161 CodeDesc desc;
162 masm->GetCode(&desc); 162 masm->GetCode(&desc);
163 Handle<Code> code = isolate->factory()->NewCode( 163 Handle<Code> code = isolate->factory()->NewCode(
164 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 164 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 __ nop(); 304 __ nop();
305 } 305 }
306 306
307 { 307 {
308 __ BlockTrampolinePoolFor(kNumCases * 2 + 6 + 1); 308 __ BlockTrampolinePoolFor(kNumCases * 2 + 6 + 1);
309 PredictableCodeSizeScope predictable( 309 PredictableCodeSizeScope predictable(
310 masm, kNumCases * kPointerSize + ((6 + 1) * Assembler::kInstrSize)); 310 masm, kNumCases * kPointerSize + ((6 + 1) * Assembler::kInstrSize));
311 311
312 __ addiupc(at, 6 + 1); 312 __ addiupc(at, 6 + 1);
313 __ Dlsa(at, at, a0, 3); 313 __ Dlsa(at, at, a0, 3);
314 __ ld(at, MemOperand(at)); 314 __ Ld(at, MemOperand(at));
315 __ jalr(at); 315 __ jalr(at);
316 __ nop(); // Branch delay slot nop. 316 __ nop(); // Branch delay slot nop.
317 __ bc(&done); 317 __ bc(&done);
318 // A nop instruction must be generated by the forbidden slot guard 318 // A nop instruction must be generated by the forbidden slot guard
319 // (Assembler::dd(Label*)) so the first label goes to an 8 bytes aligned 319 // (Assembler::dd(Label*)) so the first label goes to an 8 bytes aligned
320 // location. 320 // location.
321 for (int i = 0; i < kNumCases; ++i) { 321 for (int i = 0; i < kNumCases; ++i) {
322 __ dd(&labels[i]); 322 __ dd(&labels[i]);
323 } 323 }
324 } 324 }
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 float inputsf[kTableLength] = {3.0, 2.0, 0.0, -0.0, finf, 42.0, finf, 1495 float inputsf[kTableLength] = {3.0, 2.0, 0.0, -0.0, finf, 42.0, finf,
1496 fminf, 3.0, fnan, fnan, finf, fnan}; 1496 fminf, 3.0, fnan, fnan, finf, fnan};
1497 float outputsfmin[kTableLength] = {2.0, 2.0, -0.0, -0.0, 42.0, 42.0, fminf, 1497 float outputsfmin[kTableLength] = {2.0, 2.0, -0.0, -0.0, 42.0, 42.0, fminf,
1498 fminf, fnan, fnan, fnan, fnan, fnan}; 1498 fminf, fnan, fnan, fnan, fnan, fnan};
1499 float outputsfmax[kTableLength] = {3.0, 3.0, 0.0, 0.0, finf, finf, finf, 1499 float outputsfmax[kTableLength] = {3.0, 3.0, 0.0, 0.0, finf, finf, finf,
1500 finf, fnan, fnan, fnan, fnan, fnan}; 1500 finf, fnan, fnan, fnan, fnan, fnan};
1501 1501
1502 auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) { 1502 auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) {
1503 __ bind(nan); 1503 __ bind(nan);
1504 __ LoadRoot(at, Heap::kNanValueRootIndex); 1504 __ LoadRoot(at, Heap::kNanValueRootIndex);
1505 __ ldc1(dst, FieldMemOperand(at, HeapNumber::kValueOffset)); 1505 __ Ldc1(dst, FieldMemOperand(at, HeapNumber::kValueOffset));
1506 __ Branch(back); 1506 __ Branch(back);
1507 }; 1507 };
1508 1508
1509 auto handle_snan = [masm, fnan](FPURegister dst, Label* nan, Label* back) { 1509 auto handle_snan = [masm, fnan](FPURegister dst, Label* nan, Label* back) {
1510 __ bind(nan); 1510 __ bind(nan);
1511 __ Move(dst, fnan); 1511 __ Move(dst, fnan);
1512 __ Branch(back); 1512 __ Branch(back);
1513 }; 1513 };
1514 1514
1515 Label handle_mind_nan, handle_maxd_nan, handle_mins_nan, handle_maxs_nan; 1515 Label handle_mind_nan, handle_maxd_nan, handle_mins_nan, handle_maxs_nan;
1516 Label back_mind_nan, back_maxd_nan, back_mins_nan, back_maxs_nan; 1516 Label back_mind_nan, back_maxd_nan, back_mins_nan, back_maxs_nan;
1517 1517
1518 __ push(s6); 1518 __ push(s6);
1519 __ InitializeRootRegister(); 1519 __ InitializeRootRegister();
1520 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); 1520 __ Ldc1(f4, MemOperand(a0, offsetof(TestFloat, a)));
1521 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); 1521 __ Ldc1(f8, MemOperand(a0, offsetof(TestFloat, b)));
1522 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); 1522 __ Lwc1(f2, MemOperand(a0, offsetof(TestFloat, e)));
1523 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f))); 1523 __ Lwc1(f6, MemOperand(a0, offsetof(TestFloat, f)));
1524 __ Float64Min(f10, f4, f8, &handle_mind_nan); 1524 __ Float64Min(f10, f4, f8, &handle_mind_nan);
1525 __ bind(&back_mind_nan); 1525 __ bind(&back_mind_nan);
1526 __ Float64Max(f12, f4, f8, &handle_maxd_nan); 1526 __ Float64Max(f12, f4, f8, &handle_maxd_nan);
1527 __ bind(&back_maxd_nan); 1527 __ bind(&back_maxd_nan);
1528 __ Float32Min(f14, f2, f6, &handle_mins_nan); 1528 __ Float32Min(f14, f2, f6, &handle_mins_nan);
1529 __ bind(&back_mins_nan); 1529 __ bind(&back_mins_nan);
1530 __ Float32Max(f16, f2, f6, &handle_maxs_nan); 1530 __ Float32Max(f16, f2, f6, &handle_maxs_nan);
1531 __ bind(&back_maxs_nan); 1531 __ bind(&back_maxs_nan);
1532 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c))); 1532 __ Sdc1(f10, MemOperand(a0, offsetof(TestFloat, c)));
1533 __ sdc1(f12, MemOperand(a0, offsetof(TestFloat, d))); 1533 __ Sdc1(f12, MemOperand(a0, offsetof(TestFloat, d)));
1534 __ swc1(f14, MemOperand(a0, offsetof(TestFloat, g))); 1534 __ Swc1(f14, MemOperand(a0, offsetof(TestFloat, g)));
1535 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, h))); 1535 __ Swc1(f16, MemOperand(a0, offsetof(TestFloat, h)));
1536 __ pop(s6); 1536 __ pop(s6);
1537 __ jr(ra); 1537 __ jr(ra);
1538 __ nop(); 1538 __ nop();
1539 1539
1540 handle_dnan(f10, &handle_mind_nan, &back_mind_nan); 1540 handle_dnan(f10, &handle_mind_nan, &back_mind_nan);
1541 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan); 1541 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan);
1542 handle_snan(f14, &handle_mins_nan, &back_mins_nan); 1542 handle_snan(f14, &handle_mins_nan, &back_mins_nan);
1543 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan); 1543 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan);
1544 1544
1545 CodeDesc desc; 1545 CodeDesc desc;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 T b = T::from_code(6); // f6 1981 T b = T::from_code(6); // f6
1982 T c = T::from_code(8); // f8 1982 T c = T::from_code(8); // f8
1983 1983
1984 Label ool_min_abc, ool_min_aab, ool_min_aba; 1984 Label ool_min_abc, ool_min_aab, ool_min_aba;
1985 Label ool_max_abc, ool_max_aab, ool_max_aba; 1985 Label ool_max_abc, ool_max_aab, ool_max_aba;
1986 1986
1987 Label done_min_abc, done_min_aab, done_min_aba; 1987 Label done_min_abc, done_min_aab, done_min_aba;
1988 Label done_max_abc, done_max_aab, done_max_aba; 1988 Label done_max_abc, done_max_aab, done_max_aba;
1989 1989
1990 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \ 1990 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \
1991 __ lwc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \ 1991 __ Lwc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \
1992 __ lwc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \ 1992 __ Lwc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \
1993 __ fminmax(res, x, y, &ool); \ 1993 __ fminmax(res, x, y, &ool); \
1994 __ bind(&done); \ 1994 __ bind(&done); \
1995 __ swc1(a, MemOperand(a1, offsetof(Results, res_field))) 1995 __ Swc1(a, MemOperand(a1, offsetof(Results, res_field)))
1996 1996
1997 // a = min(b, c); 1997 // a = min(b, c);
1998 FLOAT_MIN_MAX(Float32Min, a, b, c, done_min_abc, ool_min_abc, min_abc_); 1998 FLOAT_MIN_MAX(Float32Min, a, b, c, done_min_abc, ool_min_abc, min_abc_);
1999 // a = min(a, b); 1999 // a = min(a, b);
2000 FLOAT_MIN_MAX(Float32Min, a, a, b, done_min_aab, ool_min_aab, min_aab_); 2000 FLOAT_MIN_MAX(Float32Min, a, a, b, done_min_aab, ool_min_aab, min_aab_);
2001 // a = min(b, a); 2001 // a = min(b, a);
2002 FLOAT_MIN_MAX(Float32Min, a, b, a, done_min_aba, ool_min_aba, min_aba_); 2002 FLOAT_MIN_MAX(Float32Min, a, b, a, done_min_aba, ool_min_aba, min_aba_);
2003 2003
2004 // a = max(b, c); 2004 // a = max(b, c);
2005 FLOAT_MIN_MAX(Float32Max, a, b, c, done_max_abc, ool_max_abc, max_abc_); 2005 FLOAT_MIN_MAX(Float32Max, a, b, c, done_max_abc, ool_max_abc, max_abc_);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 T b = T::from_code(6); // f6 2124 T b = T::from_code(6); // f6
2125 T c = T::from_code(8); // f8 2125 T c = T::from_code(8); // f8
2126 2126
2127 Label ool_min_abc, ool_min_aab, ool_min_aba; 2127 Label ool_min_abc, ool_min_aab, ool_min_aba;
2128 Label ool_max_abc, ool_max_aab, ool_max_aba; 2128 Label ool_max_abc, ool_max_aab, ool_max_aba;
2129 2129
2130 Label done_min_abc, done_min_aab, done_min_aba; 2130 Label done_min_abc, done_min_aab, done_min_aba;
2131 Label done_max_abc, done_max_aab, done_max_aba; 2131 Label done_max_abc, done_max_aab, done_max_aba;
2132 2132
2133 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \ 2133 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \
2134 __ ldc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \ 2134 __ Ldc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \
2135 __ ldc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \ 2135 __ Ldc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \
2136 __ fminmax(res, x, y, &ool); \ 2136 __ fminmax(res, x, y, &ool); \
2137 __ bind(&done); \ 2137 __ bind(&done); \
2138 __ sdc1(a, MemOperand(a1, offsetof(Results, res_field))) 2138 __ Sdc1(a, MemOperand(a1, offsetof(Results, res_field)))
2139 2139
2140 // a = min(b, c); 2140 // a = min(b, c);
2141 FLOAT_MIN_MAX(Float64Min, a, b, c, done_min_abc, ool_min_abc, min_abc_); 2141 FLOAT_MIN_MAX(Float64Min, a, b, c, done_min_abc, ool_min_abc, min_abc_);
2142 // a = min(a, b); 2142 // a = min(a, b);
2143 FLOAT_MIN_MAX(Float64Min, a, a, b, done_min_aab, ool_min_aab, min_aab_); 2143 FLOAT_MIN_MAX(Float64Min, a, a, b, done_min_aab, ool_min_aab, min_aab_);
2144 // a = min(b, a); 2144 // a = min(b, a);
2145 FLOAT_MIN_MAX(Float64Min, a, b, a, done_min_aba, ool_min_aba, min_aba_); 2145 FLOAT_MIN_MAX(Float64Min, a, b, a, done_min_aba, ool_min_aba, min_aba_);
2146 2146
2147 // a = max(b, c); 2147 // a = max(b, c);
2148 FLOAT_MIN_MAX(Float64Max, a, b, c, done_max_abc, ool_max_abc, max_abc_); 2148 FLOAT_MIN_MAX(Float64Max, a, b, c, done_max_abc, ool_max_abc, max_abc_);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 2255
2256 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a); 2256 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a);
2257 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a); 2257 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a);
2258 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); 2258 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a);
2259 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); 2259 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b);
2260 2260
2261 #undef CHECK_MINMAX 2261 #undef CHECK_MINMAX
2262 } 2262 }
2263 2263
2264 #undef __ 2264 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-code-stubs-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698