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

Unified Diff: test/cctest/test-assembler-mips64.cc

Issue 1047213002: Finish 'MIPS: [turbofan] Add backend support for float32 operations.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix #1 Created 5 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 side-by-side diff with in-line comments
Download patch
« test/cctest/test-assembler-mips.cc ('K') | « test/cctest/test-assembler-mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-mips64.cc
diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc
index dd8841a26a84be03a2d5259d000ca74767bae58d..b2f7ba8b8d9e0283cf9e37be498640569e7238ee 100644
--- a/test/cctest/test-assembler-mips64.cc
+++ b/test/cctest/test-assembler-mips64.cc
@@ -45,6 +45,8 @@ typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4);
typedef Object* (*F2)(int x, int y, int p2, int p3, int p4);
typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4);
+// clang-format off
+
#define __ assm.
@@ -337,6 +339,13 @@ TEST(MIPS3) {
double g;
double h;
double i;
+ float fa;
+ float fb;
+ float fc;
+ float fd;
+ float fe;
+ float ff;
+ float fg;
} T;
T t;
@@ -345,6 +354,7 @@ TEST(MIPS3) {
MacroAssembler assm(isolate, NULL, 0);
Label L, C;
+ // Double precision floating point instructions.
__ ldc1(f4, MemOperand(a0, OFFSET_OF(T, a)) );
__ ldc1(f6, MemOperand(a0, OFFSET_OF(T, b)) );
__ add_d(f8, f4, f6);
@@ -377,6 +387,30 @@ TEST(MIPS3) {
__ sdc1(f14, MemOperand(a0, OFFSET_OF(T, h)) );
}
+ // Single precision floating point instructions.
+ __ lwc1(f4, MemOperand(a0, OFFSET_OF(T, fa)) );
+ __ lwc1(f6, MemOperand(a0, OFFSET_OF(T, fb)) );
+ __ add_s(f8, f4, f6);
+ __ swc1(f8, MemOperand(a0, OFFSET_OF(T, fc)) ); // fc = fa + fb.
+
+ __ neg_s(f10, f6); // -fb
+ __ sub_s(f10, f8, f10);
+ __ swc1(f10, MemOperand(a0, OFFSET_OF(T, fd)) ); // fd = fc - (-fb).
+
+ __ swc1(f4, MemOperand(a0, OFFSET_OF(T, fb)) ); // fb = fa.
+
+ __ li(t0, 120);
+ __ mtc1(t0, f14);
+ __ cvt_s_w(f14, f14); // f14 = 120.0.
+ __ mul_s(f10, f10, f14);
+ __ swc1(f10, MemOperand(a0, OFFSET_OF(T, fe)) ); // fe = fd * 120
+
+ __ div_s(f12, f10, f4);
+ __ swc1(f12, MemOperand(a0, OFFSET_OF(T, ff)) ); // ff = fe / fa
+
+ __ sqrt_s(f14, f12);
+ __ swc1(f14, MemOperand(a0, OFFSET_OF(T, fg)) );
+
__ jr(ra);
__ nop();
@@ -385,6 +419,7 @@ TEST(MIPS3) {
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
+ // Double test values.
t.a = 1.5e14;
t.b = 2.75e11;
t.c = 0.0;
@@ -393,8 +428,16 @@ TEST(MIPS3) {
t.f = 0.0;
t.h = 1.5;
t.i = 2.75;
+ // Single test values.
+ t.fa = 1.5e6;
+ t.fb = 2.75e4;
+ t.fc = 0.0;
+ t.fd = 0.0;
+ t.fe = 0.0;
+ t.ff = 0.0;
Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
USE(dummy);
+ // Expected double results.
CHECK_EQ(1.5e14, t.a);
CHECK_EQ(1.5e14, t.b);
CHECK_EQ(1.50275e14, t.c);
@@ -405,6 +448,14 @@ TEST(MIPS3) {
if (kArchVariant == kMips64r2) {
CHECK_EQ(6.875, t.h);
}
+ // Expected single results.
+ CHECK_EQ(1.5e6, t.fa);
+ CHECK_EQ(1.5e6, t.fb);
+ CHECK_EQ(1.5275e06, t.fc);
+ CHECK_EQ(1.5550e06, t.fd);
+ CHECK_EQ(1.866e08, t.fe);
+ CHECK_EQ(124.40000152587890625, t.ff);
+ CHECK_EQ(11.1534748077392578125, t.fg);
}
« test/cctest/test-assembler-mips.cc ('K') | « test/cctest/test-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698