![]() |
|
[Question] floating point operations - Printable Version +- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org) +-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support) +--- Forum: Development Discussion (https://forums.dolphin-emu.org/Forum-development-discussion) +--- Thread: [Question] floating point operations (/Thread-question-floating-point-operations) |
[Question] floating point operations - nk18 - 10-16-2018 According to Gekko User's Manual, floating point operation with record bit set should update field 1 of condition register (namely, cr1). However, on dolphin, condition register is not changed regardless record bit is set. e.g., ; f0 = 1.0, f1 = 2.0, cr = 0x00000088 fsub. f0, f0, f1 ; f0 = -1.0, f1 = 2.0, cr = 0x00000088 (<- should be 0x08000088) RE: [Question] floating point operations - One More Try - 10-17-2018 I never use this, but wouldn't it be FPSCR that gets changed? RE: [Question] floating point operations - Jack Frost - 10-17-2018 Do you have a homebrew that hits this? Or even better, could you provide us with a hwtest to demonstrate this behaviour on both a real Wii and Dolphin? This should also end up as issue report on our tracker, or if you feel confident enough as pull request on GitHub. Also: Moved to Development Discussions since this isn't really Cheat/Code related. RE: [Question] floating point operations - nk18 - 10-17-2018 (10-17-2018, 01:53 AM)One More Try Wrote: I never use this, but wouldn't it be FPSCR that gets changed? I think FPSCR should always updated when floating point instructions performed. In fact, ; f0 = 1.0, f1 = 2.0, cr = 0x00000088, fpscr = 0x00000088 fsub f0, f0, f1 ; f0 = -1.0, f1 = 2.0, cr = 0x00000088, fpscr = 0x00008088 mcrfs 0x0, 0x4 ; f0 = -1.0, f1 = 2.0, cr = 0x80000088, fpscr = 0x00008088 ble cr0, somewhere ; (Branch taken) works with Dolphin. Just wondering why instructions like fsub. wont work as excepted. (10-17-2018, 02:23 AM)Jack Frost Wrote: Do you have a homebrew that hits this? Or even better, could you provide us with a hwtest to demonstrate this behaviour on both a real Wii and Dolphin? I hit this when I was trying to mod a gamecube game called "Capcom vs SNK 2 EO", therefore I posted it on "Cheats, Hacks, & Game Patches" originally. And, sorry, I have no access to a real gc/wii currently. I could provide assembly code I used if that helps. RE: [Question] floating point operations - One More Try - 10-17-2018 I looked it up and it says cr1 is derived from bits 0-3 (exceptions) of FPSCR and not the FPRF bits you were expecting. RE: [Question] floating point operations - nk18 - 10-17-2018 (10-17-2018, 10:40 AM)One More Try Wrote: I looked it up and it says cr1 is derived from bits 0-3 (exceptions) of FPSCR and not the FPRF bits you were expecting. But thiss article (on page 5) suggests that cr1 refers to the bit 4-7 of CR, or I misunderstood something? By mentioning code example, I mean that FPRF field of FPSCR is updated correctly on Dolphin after floating point operations. RE: [Question] floating point operations - One More Try - 10-17-2018 No, that's correct. With fsub. : FPSCR bits 0-3 -> cr1, which are cr bits 4-7. I don't know how to properly create exceptions, but if you can make a floating point overflow exception or invalid operation happen, then FPSCR bits 0-3 should change and then cr1 should change with it. It looks like cr1 is being used to record exceptions that occur and not result flags. Exceptions are FX, FEX, VX, OX (bits 0-3) and listed in reference to the cr1 field for "fsub.", but FPRF is not listed there. I have never tested this though. https://www.cebix.net/downloads/bebox/PRG.pdf RE: [Question] floating point operations - nk18 - 10-17-2018 (10-17-2018, 12:34 PM)One More Try Wrote: No, that's correct. With fsub. : FPSCR bits 0-3 -> cr1, which are cr bits 4-7. I don't know how to properly create exceptions, but if you can make a floating point overflow exception or invalid operation happen, then FPSCR bits 0-3 should change and then cr1 should change with it. It appears that I missed table 9 in the article. Thank you very much, I got it. By the way, I tested with Dolphin's debugger and it works: ; f5 = +inf(0x7FF0000000000000), f6 = 0.0 (0x0000000000000000), f7 = 1.0, cr = 0x20000088, fpscr = 0x00000000 fmsub. f6, f7, f5, f5 ; f5 = +inf(0x7FF0000000000000), f6 = Nan(0x7FF8000000000000), f7 = 1.0, cr = 0x2A000088, fpscr = 0xA0811000 |