Fix floating point exception definitions for powerpcspe
These were incorrectly implemented in the original port.
This commit is contained in:
parent
6ae00e306f
commit
adc9dcf3e3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336688
@ -44,6 +44,6 @@ fpgetmask()
|
||||
uint32_t fpscr;
|
||||
|
||||
__asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR));
|
||||
return ((fp_except_t)((fpscr >> 3) & 0x1f));
|
||||
return ((fp_except_t)((fpscr >> 2) & 0x1f));
|
||||
}
|
||||
#endif
|
||||
|
@ -45,8 +45,8 @@ fpsetmask(fp_except_t mask)
|
||||
fp_rnd_t old;
|
||||
|
||||
__asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR));
|
||||
old = (fp_rnd_t)((fpscr >> 3) & 0x1f);
|
||||
fpscr = (fpscr & 0xffffff07) | (mask << 3);
|
||||
old = (fp_rnd_t)((fpscr >> 2) & 0x1f);
|
||||
fpscr = (fpscr & 0xffffff83) | (mask << 2);
|
||||
__asm__ __volatile("mtspr %1,%0" :: "r"(fpscr), "K"(SPR_SPEFSCR));
|
||||
return (old);
|
||||
}
|
||||
|
@ -11,11 +11,19 @@
|
||||
/* Deprecated historical FPU control interface */
|
||||
|
||||
typedef int fp_except_t;
|
||||
#ifdef __SPE__
|
||||
#define FP_X_OFL 0x01 /* overflow exception */
|
||||
#define FP_X_UFL 0x02 /* underflow exception */
|
||||
#define FP_X_DZ 0x04 /* divide-by-zero exception */
|
||||
#define FP_X_INV 0x08 /* invalid operation exception */
|
||||
#define FP_X_IMP 0x10 /* imprecise (loss of precision) */
|
||||
#else
|
||||
#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
|
||||
#define FP_X_DZ 0x02 /* divide-by-zero exception */
|
||||
#define FP_X_UFL 0x04 /* underflow exception */
|
||||
#define FP_X_OFL 0x08 /* overflow exception */
|
||||
#define FP_X_INV 0x10 /* invalid operation exception */
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
FP_RN=0, /* round to nearest representable number */
|
||||
|
Loading…
Reference in New Issue
Block a user