• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 15 16 17 18 19 ... 116 Next »

[Question] floating point operations
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
[Question] floating point operations
10-16-2018, 10:33 PM
#1
nk18
Unregistered
 
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)
Reply
10-17-2018, 01:53 AM
#2
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
I never use this, but wouldn't it be FPSCR that gets changed?
Find
Reply
10-17-2018, 02:23 AM (This post was last modified: 10-17-2018, 02:24 AM by Jack Frost.)
#3
Jack Frost Offline
aka. BhaaL
**********
Developers (Some Administrators and Super Moderators)
Posts: 509
Threads: 3
Joined: Oct 2009
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.
Find
Reply
10-17-2018, 10:13 AM
#4
nk18
Unregistered
 
(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?
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.

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.
Reply
10-17-2018, 10:40 AM (This post was last modified: 10-17-2018, 10:42 AM by One More Try.)
#5
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
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.
Find
Reply
10-17-2018, 10:59 AM
#6
nk18
Unregistered
 
(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.
Reply
10-17-2018, 12:34 PM (This post was last modified: 10-17-2018, 12:42 PM by One More Try.)
#7
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
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
Find
Reply
10-17-2018, 01:14 PM
#8
nk18
Unregistered
 
(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 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

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
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode