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

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

Issue 1646813003: Revert of MIPS: Add FPXX support to MIPS32R2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « src/mips/macro-assembler-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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 CHECK_EQ(1.5e6, t.fb); 377 CHECK_EQ(1.5e6, t.fb);
378 CHECK_EQ(1.5275e06, t.fc); 378 CHECK_EQ(1.5275e06, t.fc);
379 CHECK_EQ(1.5550e06, t.fd); 379 CHECK_EQ(1.5550e06, t.fd);
380 CHECK_EQ(1.866e08, t.fe); 380 CHECK_EQ(1.866e08, t.fe);
381 CHECK_EQ(124.40000152587890625, t.ff); 381 CHECK_EQ(124.40000152587890625, t.ff);
382 CHECK_EQ(11.1534748077392578125, t.fg); 382 CHECK_EQ(11.1534748077392578125, t.fg);
383 } 383 }
384 384
385 385
386 TEST(MIPS4) { 386 TEST(MIPS4) {
387 // Exchange between GP anf FP registers is done through memory
388 // on FPXX compiled binaries and architectures that do not support
389 // MTHC1 and MTFC1. If this is the case, skipping this test.
390 if (IsFpxxMode() &&
391 (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson))) {
392 return;
393 }
394
395 // Test moves between floating point and integer registers. 387 // Test moves between floating point and integer registers.
396 CcTest::InitializeVM(); 388 CcTest::InitializeVM();
397 Isolate* isolate = CcTest::i_isolate(); 389 Isolate* isolate = CcTest::i_isolate();
398 HandleScope scope(isolate); 390 HandleScope scope(isolate);
399 391
400 typedef struct { 392 typedef struct {
401 double a; 393 double a;
402 double b; 394 double b;
403 double c; 395 double c;
404 } T; 396 } T;
405 T t; 397 T t;
406 398
407 Assembler assm(isolate, NULL, 0); 399 Assembler assm(isolate, NULL, 0);
408 Label L, C; 400 Label L, C;
409 401
410 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) ); 402 __ ldc1(f4, MemOperand(a0, offsetof(T, a)) );
411 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) ); 403 __ ldc1(f6, MemOperand(a0, offsetof(T, b)) );
412 404
413 // Swap f4 and f6, by using four integer registers, t0-t3. 405 // Swap f4 and f6, by using four integer registers, t0-t3.
414 if (IsFp32Mode()) { 406 if (!IsFp64Mode()) {
415 __ mfc1(t0, f4); 407 __ mfc1(t0, f4);
416 __ mfc1(t1, f5); 408 __ mfc1(t1, f5);
417 __ mfc1(t2, f6); 409 __ mfc1(t2, f6);
418 __ mfc1(t3, f7); 410 __ mfc1(t3, f7);
419 411
420 __ mtc1(t0, f6); 412 __ mtc1(t0, f6);
421 __ mtc1(t1, f7); 413 __ mtc1(t1, f7);
422 __ mtc1(t2, f4); 414 __ mtc1(t2, f4);
423 __ mtc1(t3, f5); 415 __ mtc1(t3, f5);
424 } else { 416 } else {
425 CHECK(!IsMipsArchVariant(kMips32r1) && !IsMipsArchVariant(kLoongson)); 417 CHECK(!IsMipsArchVariant(kMips32r1) && !IsMipsArchVariant(kLoongson));
426 DCHECK(IsFp64Mode() || IsFpxxMode());
427 __ mfc1(t0, f4); 418 __ mfc1(t0, f4);
428 __ mfhc1(t1, f4); 419 __ mfhc1(t1, f4);
429 __ mfc1(t2, f6); 420 __ mfc1(t2, f6);
430 __ mfhc1(t3, f6); 421 __ mfhc1(t3, f6);
431 422
432 __ mtc1(t0, f6); 423 __ mtc1(t0, f6);
433 __ mthc1(t1, f6); 424 __ mthc1(t1, f6);
434 __ mtc1(t2, f4); 425 __ mtc1(t2, f4);
435 __ mthc1(t3, f4); 426 __ mthc1(t3, f4);
436 } 427 }
437
438 // Store the swapped f4 and f5 back to memory. 428 // Store the swapped f4 and f5 back to memory.
439 __ sdc1(f4, MemOperand(a0, offsetof(T, a)) ); 429 __ sdc1(f4, MemOperand(a0, offsetof(T, a)) );
440 __ sdc1(f6, MemOperand(a0, offsetof(T, c)) ); 430 __ sdc1(f6, MemOperand(a0, offsetof(T, c)) );
441 431
442 __ jr(ra); 432 __ jr(ra);
443 __ nop(); 433 __ nop();
444 434
445 CodeDesc desc; 435 CodeDesc desc;
446 assm.GetCode(&desc); 436 assm.GetCode(&desc);
447 Handle<Code> code = isolate->factory()->NewCode( 437 Handle<Code> code = isolate->factory()->NewCode(
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 804
815 CodeDesc desc; 805 CodeDesc desc;
816 assm.GetCode(&desc); 806 assm.GetCode(&desc);
817 isolate->factory()->NewCode( 807 isolate->factory()->NewCode(
818 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 808 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
819 } 809 }
820 810
821 811
822 TEST(MIPS10) { 812 TEST(MIPS10) {
823 // Test conversions between doubles and words. 813 // Test conversions between doubles and words.
814 // Test maps double to FP reg pairs in fp32 mode
815 // and into FP reg in fp64 mode.
824 CcTest::InitializeVM(); 816 CcTest::InitializeVM();
825 Isolate* isolate = CcTest::i_isolate(); 817 Isolate* isolate = CcTest::i_isolate();
826 HandleScope scope(isolate); 818 HandleScope scope(isolate);
827 819
828 typedef struct { 820 typedef struct {
829 double a; 821 double a;
830 double b; 822 double b;
831 int32_t dbl_mant; 823 int32_t dbl_mant;
832 int32_t dbl_exp; 824 int32_t dbl_exp;
833 int32_t word; 825 int32_t word;
834 int32_t b_word; 826 int32_t b_word;
835 } T; 827 } T;
836 T t; 828 T t;
837 829
838 Assembler assm(isolate, NULL, 0); 830 Assembler assm(isolate, NULL, 0);
839 Label L, C; 831 Label L, C;
840 832
841 if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) return; 833 if (!IsMipsArchVariant(kMips32r2)) return;
842 834
843 // Load all structure elements to registers. 835 // Load all structure elements to registers.
844 // (f0, f1) = a (fp32), f0 = a (fp64) 836 // (f0, f1) = a (fp32), f0 = a (fp64)
845 __ ldc1(f0, MemOperand(a0, offsetof(T, a))); 837 __ ldc1(f0, MemOperand(a0, offsetof(T, a)));
846 838
847 __ mfc1(t0, f0); // t0 = f0(31..0) 839 if (IsFp64Mode()) {
848 __ mfhc1(t1, f0); // t1 = sign_extend(f0(63..32)) 840 __ mfc1(t0, f0); // t0 = f0(31..0)
849 __ sw(t0, MemOperand(a0, offsetof(T, dbl_mant))); // dbl_mant = t0 841 __ mfhc1(t1, f0); // t1 = sign_extend(f0(63..32))
850 __ sw(t1, MemOperand(a0, offsetof(T, dbl_exp))); // dbl_exp = t1 842 __ sw(t0, MemOperand(a0, offsetof(T, dbl_mant))); // dbl_mant = t0
843 __ sw(t1, MemOperand(a0, offsetof(T, dbl_exp))); // dbl_exp = t1
844 } else {
845 // Save the raw bits of the double.
846 __ mfc1(t0, f0); // t0 = a1
847 __ mfc1(t1, f1); // t1 = a2
848 __ sw(t0, MemOperand(a0, offsetof(T, dbl_mant))); // dbl_mant = t0
849 __ sw(t1, MemOperand(a0, offsetof(T, dbl_exp))); // dbl_exp = t1
850 }
851 851
852 // Convert double in f0 to word, save hi/lo parts. 852 // Convert double in f0 to word, save hi/lo parts.
853 __ cvt_w_d(f0, f0); // a_word = (word)a 853 __ cvt_w_d(f0, f0); // a_word = (word)a
854 __ mfc1(t0, f0); // f0 has a 32-bits word. t0 = a_word 854 __ mfc1(t0, f0); // f0 has a 32-bits word. t0 = a_word
855 __ sw(t0, MemOperand(a0, offsetof(T, word))); // word = a_word 855 __ sw(t0, MemOperand(a0, offsetof(T, word))); // word = a_word
856 856
857 // Convert the b word to double b. 857 // Convert the b word to double b.
858 __ lw(t0, MemOperand(a0, offsetof(T, b_word))); 858 __ lw(t0, MemOperand(a0, offsetof(T, b_word)));
859 __ mtc1(t0, f8); // f8 has a 32-bits word. 859 __ mtc1(t0, f8); // f8 has a 32-bits word.
860 __ cvt_d_w(f10, f8); 860 __ cvt_d_w(f10, f8);
(...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 Handle<Code> code = isolate->factory()->NewCode( 5447 Handle<Code> code = isolate->factory()->NewCode(
5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5449 F2 f = FUNCTION_CAST<F2>(code->entry()); 5449 F2 f = FUNCTION_CAST<F2>(code->entry());
5450 5450
5451 int32_t res = reinterpret_cast<int32_t>( 5451 int32_t res = reinterpret_cast<int32_t>(
5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5453 CHECK_EQ(res, 0); 5453 CHECK_EQ(res, 0);
5454 } 5454 }
5455 5455
5456 #undef __ 5456 #undef __
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698