aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/fpu/round_to_integer.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/fpu/round_to_integer.h')
-rw-r--r--sysdeps/powerpc/fpu/round_to_integer.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index b29d030e2d..4bbd885f18 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -26,22 +26,30 @@ enum round_mode
CEIL,
FLOOR,
ROUND,
- TRUNC
+ TRUNC,
+ NEARBYINT
};
static inline void
set_fenv_mode (enum round_mode mode)
{
- int rmode;
switch (mode)
{
- case CEIL: rmode = FE_UPWARD; break;
- case FLOOR: rmode = FE_DOWNWARD; break;
+ case CEIL:
+ __fesetround_inline_nocheck (FE_UPWARD);
+ break;
+ case FLOOR:
+ __fesetround_inline_nocheck (FE_DOWNWARD);
+ break;
case TRUNC:
- case ROUND: rmode = FE_TOWARDZERO; break;
- default: rmode = FE_TONEAREST; break;
+ case ROUND:
+ __fesetround_inline_nocheck (FE_TOWARDZERO);
+ break;
+ case NEARBYINT:
+ /* Disable FE_INEXACT exception */
+ reset_fpscr_bit (FPSCR_XE);
+ break;
}
- __fesetround_inline_nocheck (rmode);
}
static inline float