-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
__fixtfsi: Set the "Invalid operation" exception for infinities, NaNs…
… and values outside of the valid range
- Loading branch information
1 parent
d518ba4
commit 7ea3cf2
Showing
2 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef GCC_VR4300_SOFT_FLOAT_H | ||
#define GCC_VR4300_SOFT_FLOAT_H | ||
|
||
#include "types.h" | ||
|
||
static inline bool Fpcsr_IsEnabled_InvalidOperation(void) { | ||
uint32_t fpcsr; | ||
|
||
__asm__("cfc1 %0, $31" : "=r"(fpcsr)); | ||
|
||
return (fpcsr & (1 << 11)) ? 1 : 0; | ||
} | ||
|
||
/** | ||
* Set the "Invalid operation" exception. | ||
* | ||
* If the "Enable bit" for this exception is turned on then the hardware will | ||
* trigger the exception by itself. | ||
*/ | ||
static inline void Fpcsr_SetCause_InvalidOperation(void) { | ||
uint32_t fpcsr; | ||
|
||
__asm__("cfc1 %0, $31" : "=r"(fpcsr)); | ||
|
||
fpcsr |= (1 << 11); | ||
|
||
__asm__("ctc1 %0, $31" : : "r"(fpcsr)); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters