diff --git a/.gitignore b/.gitignore index 4a0ad784a..8f68842de 100644 --- a/.gitignore +++ b/.gitignore @@ -96,3 +96,6 @@ third_party/binutils/powerpc-none-elf/ third_party/binutils/share/ third_party/binutils/binutils* third_party/vasm/ + +# Add back test bin: +!src/xenia/cpu/frontend/test/bin/ diff --git a/src/xenia/cpu/frontend/ppc_context.cc b/src/xenia/cpu/frontend/ppc_context.cc index 6dbca661f..473ae589b 100644 --- a/src/xenia/cpu/frontend/ppc_context.cc +++ b/src/xenia/cpu/frontend/ppc_context.cc @@ -19,7 +19,17 @@ uint64_t ParseInt64(const char* value) { return std::strtoull(value, nullptr, 0); } -double ParseFloat64(const char* value) { return std::strtod(value, nullptr); } +double ParseFloat64(const char* value) { + if (strstr(value, "0x") == value) { + union { + uint64_t ui; + double dbl; + } v; + v.ui = ParseInt64(value); + return v.dbl; + } + return std::strtod(value, nullptr); +} vec128_t ParseVec128(const char* value) { vec128_t v; diff --git a/src/xenia/cpu/frontend/ppc_emit_fpu.cc b/src/xenia/cpu/frontend/ppc_emit_fpu.cc index dd3342c88..519a401aa 100644 --- a/src/xenia/cpu/frontend/ppc_emit_fpu.cc +++ b/src/xenia/cpu/frontend/ppc_emit_fpu.cc @@ -505,8 +505,15 @@ XEEMITTER(fmrx, 0xFC000090, X)(PPCHIRBuilder& f, InstrData& i) { } XEEMITTER(fnabsx, 0xFC000110, X)(PPCHIRBuilder& f, InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; + // frD <- !abs(frB) + Value* v = f.Neg(f.Abs(f.LoadFPR(i.X.RB))); + f.StoreFPR(i.X.RT, v); + if (i.X.Rc) { + // e.update_cr_with_cond(1, v); + XEINSTRNOTIMPLEMENTED(); + return 1; + } + return 0; } XEEMITTER(fnegx, 0xFC000050, X)(PPCHIRBuilder& f, InstrData& i) { diff --git a/src/xenia/cpu/frontend/test/bin/instr_fnabs.bin b/src/xenia/cpu/frontend/test/bin/instr_fnabs.bin new file mode 100644 index 000000000..0b2457af8 Binary files /dev/null and b/src/xenia/cpu/frontend/test/bin/instr_fnabs.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_fnabs.dis b/src/xenia/cpu/frontend/test/bin/instr_fnabs.dis new file mode 100644 index 000000000..84fc1245d --- /dev/null +++ b/src/xenia/cpu/frontend/test/bin/instr_fnabs.dis @@ -0,0 +1,9 @@ + +/vagrant/src/xenia/cpu/frontend/test/bin//instr_fnabs.o: file format elf64-powerpc + + +Disassembly of section .text: + +0000000000100000 : + 100000: fc 40 09 10 fnabs f2,f1 + 100004: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_fnabs.map b/src/xenia/cpu/frontend/test/bin/instr_fnabs.map new file mode 100644 index 000000000..c54f67a05 --- /dev/null +++ b/src/xenia/cpu/frontend/test/bin/instr_fnabs.map @@ -0,0 +1 @@ +0000000000000000 t test_fnabs_1 diff --git a/src/xenia/cpu/frontend/test/instr_fnabs.s b/src/xenia/cpu/frontend/test/instr_fnabs.s new file mode 100644 index 000000000..73e2f70bc --- /dev/null +++ b/src/xenia/cpu/frontend/test/instr_fnabs.s @@ -0,0 +1,5 @@ +test_fnabs_1: + #_ REGISTER_IN f1 0x400C000000000000 + fnabs f2, f1 + blr + #_ REGISTER_OUT f2 0xC00C000000000000 diff --git a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj index 3cc6ae5c9..ac2d50db0 100644 --- a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj +++ b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj @@ -135,6 +135,7 @@ + diff --git a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj.filters b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj.filters index 8d959dd5f..771f18e12 100644 --- a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj.filters +++ b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.vcxproj.filters @@ -93,6 +93,7 @@ +