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

Unified Diff: runtime/vm/simulator_mips.cc

Issue 14672037: Implements FPU compare and branching for 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/simulator_mips.h ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_mips.cc
===================================================================
--- runtime/vm/simulator_mips.cc (revision 22705)
+++ runtime/vm/simulator_mips.cc (working copy)
@@ -559,6 +559,7 @@
for (int i = 0; i < kNumberOfFRegisters; i++) {
fregisters_[i] = 0.0;
}
+ fcsr_ = 0;
}
@@ -1375,34 +1376,66 @@
if (instr->HasFormat()) {
// If the rs field is a valid format, then the function field identifies the
// instruction.
+ ASSERT(instr->FormatField() == FMT_D); // Only D supported.
+ double fs_val = get_fregister_double(instr->FsField());
+ double ft_val = get_fregister_double(instr->FtField());
+ uint32_t cc, fcsr_cc;
+ cc = instr->FpuCCField();
+ fcsr_cc = get_fcsr_condition_bit(cc);
switch (instr->Cop1FunctionField()) {
case COP1_ADD: {
// Format(instr, "add.'fmt 'fd, 'fs, 'ft");
- if (instr->FormatField() == FMT_S) {
- float fs_val = get_fregister_float(instr->FsField());
- float ft_val = get_fregister_float(instr->FtField());
- set_fregister_float(instr->FdField(), fs_val + ft_val);
- } else {
- ASSERT(instr->FormatField() == FMT_D); // Only S and D supported.
- double fs_val = get_fregister_double(instr->FsField());
- double ft_val = get_fregister_double(instr->FtField());
- set_fregister_double(instr->FdField(), fs_val + ft_val);
- }
+ set_fregister_double(instr->FdField(), fs_val + ft_val);
break;
}
case COP1_MOV: {
// Format(instr, "mov.'fmt 'fd, 'fs");
- ASSERT(instr->FtField() == F0);
- if (instr->FormatField() == FMT_S) {
- float fs_val = get_fregister_float(instr->FsField());
- set_fregister_float(instr->FdField(), fs_val);
- } else {
- ASSERT(instr->FormatField() == FMT_D);
- double fs_val = get_fregister_double(instr->FsField());
- set_fregister_double(instr->FdField(), fs_val);
- }
+ set_fregister_double(instr->FdField(), fs_val);
break;
}
+ case COP1_C_F: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc, false);
+ break;
+ }
+ case COP1_C_UN: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc, isnan(fs_val) || isnan(ft_val));
+ break;
+ }
+ case COP1_C_EQ: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc, (fs_val == ft_val));
+ break;
+ }
+ case COP1_C_UEQ: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc,
+ (fs_val == ft_val) || isnan(fs_val) || isnan(ft_val));
+ break;
+ }
+ case COP1_C_OLT: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc, (fs_val < ft_val));
+ break;
+ }
+ case COP1_C_ULT: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc,
+ (fs_val < ft_val) || isnan(fs_val) || isnan(ft_val));
+ break;
+ }
+ case COP1_C_OLE: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc, (fs_val <= ft_val));
+ break;
+ }
+ case COP1_C_ULE: {
+ ASSERT(instr->FdField() == F0);
+ set_fcsr_bit(fcsr_cc,
+ (fs_val <= ft_val) || isnan(fs_val) || isnan(ft_val));
+ break;
+ }
default: {
OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits());
UnimplementedInstruction(instr);
@@ -1426,6 +1459,18 @@
set_fregister(instr->FsField(), rt_val);
break;
}
+ case COP1_BC: {
+ ASSERT(instr->Bit(17) == 0);
+ uint32_t cc, fcsr_cc;
+ cc = instr->Bits(18, 3);
+ fcsr_cc = get_fcsr_condition_bit(cc);
+ if (instr->Bit(16) == 1) { // Branch on true.
+ DoBranch(instr, test_fcsr_bit(fcsr_cc), false);
+ } else { // Branch on false.
+ DoBranch(instr, !test_fcsr_bit(fcsr_cc), false);
+ }
+ break;
+ }
default: {
OS::PrintErr("DecodeCop1: 0x%x\n", instr->InstructionBits());
UnimplementedInstruction(instr);
« no previous file with comments | « runtime/vm/simulator_mips.h ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698