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

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

Issue 12424004: MIPS: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/mips/stub-cache-mips.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 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 double i; 280 double i;
281 } T; 281 } T;
282 T t; 282 T t;
283 283
284 // Create a function that accepts &t, and loads, manipulates, and stores 284 // Create a function that accepts &t, and loads, manipulates, and stores
285 // the doubles t.a ... t.f. 285 // the doubles t.a ... t.f.
286 MacroAssembler assm(Isolate::Current(), NULL, 0); 286 MacroAssembler assm(Isolate::Current(), NULL, 0);
287 Label L, C; 287 Label L, C;
288 288
289 if (CpuFeatures::IsSupported(FPU)) { 289 if (CpuFeatures::IsSupported(FPU)) {
290 CpuFeatures::Scope scope(FPU); 290 CpuFeatureScope scope(&assm, FPU);
291 291
292 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 292 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
293 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 293 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
294 __ add_d(f8, f4, f6); 294 __ add_d(f8, f4, f6);
295 __ sdc1(f8, MemOperand(a0, OFFSET_OF(T, c)) ); // c = a + b. 295 __ sdc1(f8, MemOperand(a0, OFFSET_OF(T, c)) ); // c = a + b.
296 296
297 __ mov_d(f10, f8); // c 297 __ mov_d(f10, f8); // c
298 __ neg_d(f12, f6); // -b 298 __ neg_d(f12, f6); // -b
299 __ sub_d(f10, f10, f12); 299 __ sub_d(f10, f10, f12);
300 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, d)) ); // d = c - (-b). 300 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, d)) ); // d = c - (-b).
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 double a; 363 double a;
364 double b; 364 double b;
365 double c; 365 double c;
366 } T; 366 } T;
367 T t; 367 T t;
368 368
369 Assembler assm(Isolate::Current(), NULL, 0); 369 Assembler assm(Isolate::Current(), NULL, 0);
370 Label L, C; 370 Label L, C;
371 371
372 if (CpuFeatures::IsSupported(FPU)) { 372 if (CpuFeatures::IsSupported(FPU)) {
373 CpuFeatures::Scope scope(FPU); 373 CpuFeatureScope scope(&assm, FPU);
374 374
375 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 375 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
376 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 376 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
377 377
378 // Swap f4 and f6, by using four integer registers, t0-t3. 378 // Swap f4 and f6, by using four integer registers, t0-t3.
379 __ mfc1(t0, f4); 379 __ mfc1(t0, f4);
380 __ mfc1(t1, f5); 380 __ mfc1(t1, f5);
381 __ mfc1(t2, f6); 381 __ mfc1(t2, f6);
382 __ mfc1(t3, f7); 382 __ mfc1(t3, f7);
383 383
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 double b; 424 double b;
425 int i; 425 int i;
426 int j; 426 int j;
427 } T; 427 } T;
428 T t; 428 T t;
429 429
430 Assembler assm(Isolate::Current(), NULL, 0); 430 Assembler assm(Isolate::Current(), NULL, 0);
431 Label L, C; 431 Label L, C;
432 432
433 if (CpuFeatures::IsSupported(FPU)) { 433 if (CpuFeatures::IsSupported(FPU)) {
434 CpuFeatures::Scope scope(FPU); 434 CpuFeatureScope scope(&assm, FPU);
435 435
436 // Load all structure elements to registers. 436 // Load all structure elements to registers.
437 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 437 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
438 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 438 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
439 __ lw(t0, MemOperand(a0, OFFSET_OF(T, i)) ); 439 __ lw(t0, MemOperand(a0, OFFSET_OF(T, i)) );
440 __ lw(t1, MemOperand(a0, OFFSET_OF(T, j)) ); 440 __ lw(t1, MemOperand(a0, OFFSET_OF(T, j)) );
441 441
442 // Convert double in f4 to int in element i. 442 // Convert double in f4 to int in element i.
443 __ cvt_w_d(f8, f4); 443 __ cvt_w_d(f8, f4);
444 __ mfc1(t2, f8); 444 __ mfc1(t2, f8);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 int32_t result; 572 int32_t result;
573 } T; 573 } T;
574 T t; 574 T t;
575 575
576 // Create a function that accepts &t, and loads, manipulates, and stores 576 // Create a function that accepts &t, and loads, manipulates, and stores
577 // the doubles t.a ... t.f. 577 // the doubles t.a ... t.f.
578 MacroAssembler assm(Isolate::Current(), NULL, 0); 578 MacroAssembler assm(Isolate::Current(), NULL, 0);
579 Label neither_is_nan, less_than, outa_here; 579 Label neither_is_nan, less_than, outa_here;
580 580
581 if (CpuFeatures::IsSupported(FPU)) { 581 if (CpuFeatures::IsSupported(FPU)) {
582 CpuFeatures::Scope scope(FPU); 582 CpuFeatureScope scope(&assm, FPU);
583 583
584 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) ); 584 __ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
585 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) ); 585 __ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
586 __ c(UN, D, f4, f6); 586 __ c(UN, D, f4, f6);
587 __ bc1f(&neither_is_nan); 587 __ bc1f(&neither_is_nan);
588 __ nop(); 588 __ nop();
589 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) ); 589 __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) );
590 __ Branch(&outa_here); 590 __ Branch(&outa_here);
591 591
592 __ bind(&neither_is_nan); 592 __ bind(&neither_is_nan);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 int32_t long_lo; 785 int32_t long_lo;
786 int32_t b_long_hi; 786 int32_t b_long_hi;
787 int32_t b_long_lo; 787 int32_t b_long_lo;
788 } T; 788 } T;
789 T t; 789 T t;
790 790
791 Assembler assm(Isolate::Current(), NULL, 0); 791 Assembler assm(Isolate::Current(), NULL, 0);
792 Label L, C; 792 Label L, C;
793 793
794 if (CpuFeatures::IsSupported(FPU) && kArchVariant == kMips32r2) { 794 if (CpuFeatures::IsSupported(FPU) && kArchVariant == kMips32r2) {
795 CpuFeatures::Scope scope(FPU); 795 CpuFeatureScope scope(&assm, FPU);
796 796
797 // Load all structure elements to registers. 797 // Load all structure elements to registers.
798 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a))); 798 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, a)));
799 799
800 // Save the raw bits of the double. 800 // Save the raw bits of the double.
801 __ mfc1(t0, f0); 801 __ mfc1(t0, f0);
802 __ mfc1(t1, f1); 802 __ mfc1(t1, f1);
803 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant))); 803 __ sw(t0, MemOperand(a0, OFFSET_OF(T, dbl_mant)));
804 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp))); 804 __ sw(t1, MemOperand(a0, OFFSET_OF(T, dbl_exp)));
805 805
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 uint32_t trunc_big_out; 1090 uint32_t trunc_big_out;
1091 uint32_t trunc_small_out; 1091 uint32_t trunc_small_out;
1092 uint32_t cvt_big_in; 1092 uint32_t cvt_big_in;
1093 uint32_t cvt_small_in; 1093 uint32_t cvt_small_in;
1094 } T; 1094 } T;
1095 T t; 1095 T t;
1096 1096
1097 MacroAssembler assm(Isolate::Current(), NULL, 0); 1097 MacroAssembler assm(Isolate::Current(), NULL, 0);
1098 1098
1099 if (CpuFeatures::IsSupported(FPU)) { 1099 if (CpuFeatures::IsSupported(FPU)) {
1100 CpuFeatures::Scope scope(FPU); 1100 CpuFeatureScope scope(&assm, FPU);
1101 1101
1102 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_small_in))); 1102 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_small_in)));
1103 __ Cvt_d_uw(f10, t0, f22); 1103 __ Cvt_d_uw(f10, t0, f22);
1104 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, cvt_small_out))); 1104 __ sdc1(f10, MemOperand(a0, OFFSET_OF(T, cvt_small_out)));
1105 1105
1106 __ Trunc_uw_d(f10, f10, f22); 1106 __ Trunc_uw_d(f10, f10, f22);
1107 __ swc1(f10, MemOperand(a0, OFFSET_OF(T, trunc_small_out))); 1107 __ swc1(f10, MemOperand(a0, OFFSET_OF(T, trunc_small_out)));
1108 1108
1109 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_big_in))); 1109 __ sw(t0, MemOperand(a0, OFFSET_OF(T, cvt_big_in)));
1110 __ Cvt_d_uw(f8, t0, f22); 1110 __ Cvt_d_uw(f8, t0, f22);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 ROUND_STRUCT_ELEMENT(trunc) 1173 ROUND_STRUCT_ELEMENT(trunc)
1174 ROUND_STRUCT_ELEMENT(cvt) 1174 ROUND_STRUCT_ELEMENT(cvt)
1175 } T; 1175 } T;
1176 T t; 1176 T t;
1177 1177
1178 #undef ROUND_STRUCT_ELEMENT 1178 #undef ROUND_STRUCT_ELEMENT
1179 1179
1180 MacroAssembler assm(Isolate::Current(), NULL, 0); 1180 MacroAssembler assm(Isolate::Current(), NULL, 0);
1181 1181
1182 if (CpuFeatures::IsSupported(FPU)) { 1182 if (CpuFeatures::IsSupported(FPU)) {
1183 CpuFeatures::Scope scope(FPU); 1183 CpuFeatureScope scope(&assm, FPU);
1184 1184
1185 // Save FCSR. 1185 // Save FCSR.
1186 __ cfc1(a1, FCSR); 1186 __ cfc1(a1, FCSR);
1187 // Disable FPU exceptions. 1187 // Disable FPU exceptions.
1188 __ ctc1(zero_reg, FCSR); 1188 __ ctc1(zero_reg, FCSR);
1189 #define RUN_ROUND_TEST(x) \ 1189 #define RUN_ROUND_TEST(x) \
1190 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, round_up_in))); \ 1190 __ ldc1(f0, MemOperand(a0, OFFSET_OF(T, round_up_in))); \
1191 __ x##_w_d(f0, f0); \ 1191 __ x##_w_d(f0, f0); \
1192 __ swc1(f0, MemOperand(a0, OFFSET_OF(T, x##_up_out))); \ 1192 __ swc1(f0, MemOperand(a0, OFFSET_OF(T, x##_up_out))); \
1193 \ 1193 \
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 Label target; 1286 Label target;
1287 __ beq(v0, v1, &target); 1287 __ beq(v0, v1, &target);
1288 __ nop(); 1288 __ nop();
1289 __ bne(v0, v1, &target); 1289 __ bne(v0, v1, &target);
1290 __ nop(); 1290 __ nop();
1291 __ bind(&target); 1291 __ bind(&target);
1292 __ nop(); 1292 __ nop();
1293 } 1293 }
1294 1294
1295 #undef __ 1295 #undef __
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698