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

Unified Diff: runtime/vm/assembler_mips_test.cc

Issue 15038008: Impelemnts some FPU arithmetic function for the MIPS simulator, assembler, disassembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/constants_mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips_test.cc
===================================================================
--- runtime/vm/assembler_mips_test.cc (revision 22804)
+++ runtime/vm/assembler_mips_test.cc (working copy)
@@ -1282,6 +1282,77 @@
}
+ASSEMBLER_TEST_GENERATE(Subd, assembler) {
+ __ LoadImmediate(F0, 2.5);
+ __ LoadImmediate(F2, 1.5);
+ __ subd(F4, F0, F2);
+ __ mfc1(V0, F4);
+ __ mfc1(V1, F5);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Subd, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
+ EXPECT_FLOAT_EQ(1.0, res, 0.001);
+}
+
+
+ASSEMBLER_TEST_GENERATE(Muld, assembler) {
+ __ LoadImmediate(F0, 6.0);
+ __ LoadImmediate(F2, 7.0);
+ __ muld(F4, F0, F2);
+ __ mfc1(V0, F4);
+ __ mfc1(V1, F5);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Muld, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
+ EXPECT_FLOAT_EQ(42.0, res, 0.001);
+}
+
+
+ASSEMBLER_TEST_GENERATE(Divd, assembler) {
+ __ LoadImmediate(F0, 42.0);
+ __ LoadImmediate(F2, 7.0);
+ __ divd(F4, F0, F2);
+ __ mfc1(V0, F4);
+ __ mfc1(V1, F5);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Divd, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
+ EXPECT_FLOAT_EQ(6.0, res, 0.001);
+}
+
+
+ASSEMBLER_TEST_GENERATE(Sqrtd, assembler) {
+ __ LoadImmediate(F0, 36.0);
+ __ sqrtd(F4, F0);
+ __ mfc1(V0, F4);
+ __ mfc1(V1, F5);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Sqrtd, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ double res = EXECUTE_TEST_CODE_DOUBLE(SimpleCode, test->entry());
+ EXPECT_FLOAT_EQ(6.0, res, 0.001);
+}
+
+
ASSEMBLER_TEST_GENERATE(Cop1CUN, assembler) {
Label is_true;
@@ -1558,6 +1629,36 @@
}
+ASSEMBLER_TEST_GENERATE(Cop1CvtWD, assembler) {
+ __ LoadImmediate(F0, 42.0);
+ __ cvtwd(F2, F0);
+ __ mfc1(V0, F2);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Cop1CvtWD, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
+}
+
+
+ASSEMBLER_TEST_GENERATE(Cop1CvtWD_neg, assembler) {
+ __ LoadImmediate(F0, -42.0);
+ __ cvtwd(F2, F0);
+ __ mfc1(V0, F2);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(Cop1CvtWD_neg, test) {
+ typedef double (*SimpleCode)();
+ EXPECT(test != NULL);
+ EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT32(SimpleCode, test->entry()));
+}
+
+
// Called from assembler_test.cc.
// RA: return address.
// A0: context.
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/constants_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698