Blame sysdeps/alpha/fpu/fpu_control.h

Packit 6c4009
/* FPU control word bits.  Alpha-mapped-to-Intel version.
Packit 6c4009
   Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Olaf Flebbe.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library.  If not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _ALPHA_FPU_CONTROL_H
Packit 6c4009
#define _ALPHA_FPU_CONTROL_H
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Since many programs seem to hardcode the values passed to __setfpucw()
Packit 6c4009
 * (rather than using the manifest constants) we emulate the x87 interface
Packit 6c4009
 * here (at least where this makes sense).
Packit 6c4009
 *
Packit 6c4009
 *     15-13    12  11-10  9-8     7-6     5    4    3    2    1    0
Packit 6c4009
 * | reserved | IC | RC  | PC | reserved | PM | UM | OM | ZM | DM | IM
Packit 6c4009
 *
Packit 6c4009
 * IM: Invalid operation mask
Packit 6c4009
 * DM: Denormalized operand mask
Packit 6c4009
 * ZM: Zero-divide mask
Packit 6c4009
 * OM: Overflow mask
Packit 6c4009
 * UM: Underflow mask
Packit 6c4009
 * PM: Precision (inexact result) mask
Packit 6c4009
 *
Packit 6c4009
 * Mask bit is 1 means no interrupt.
Packit 6c4009
 *
Packit 6c4009
 * PC: Precision control
Packit 6c4009
 * 11 - round to extended precision
Packit 6c4009
 * 10 - round to double precision
Packit 6c4009
 * 00 - round to single precision
Packit 6c4009
 *
Packit 6c4009
 * RC: Rounding control
Packit 6c4009
 * 00 - rounding to nearest
Packit 6c4009
 * 01 - rounding down (toward - infinity)
Packit 6c4009
 * 10 - rounding up (toward + infinity)
Packit 6c4009
 * 11 - rounding toward zero
Packit 6c4009
 *
Packit 6c4009
 * IC: Infinity control
Packit 6c4009
 * That is for 8087 and 80287 only.
Packit 6c4009
 *
Packit 6c4009
 * The hardware default is 0x037f. I choose 0x1372.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
/* masking of interrupts */
Packit 6c4009
#define _FPU_MASK_IM  0x01
Packit 6c4009
#define _FPU_MASK_DM  0x02
Packit 6c4009
#define _FPU_MASK_ZM  0x04
Packit 6c4009
#define _FPU_MASK_OM  0x08
Packit 6c4009
#define _FPU_MASK_UM  0x10
Packit 6c4009
#define _FPU_MASK_PM  0x20
Packit 6c4009
Packit 6c4009
/* precision control -- without effect on Alpha */
Packit 6c4009
#define _FPU_EXTENDED 0x300   /* RECOMMENDED */
Packit 6c4009
#define _FPU_DOUBLE   0x200
Packit 6c4009
#define _FPU_SINGLE   0x0     /* DO NOT USE */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rounding control---notice that on the Alpha this affects only
Packit 6c4009
 * instructions with the dynamic rounding mode qualifier (/d).
Packit 6c4009
 */
Packit 6c4009
#define _FPU_RC_NEAREST 0x000 /* RECOMMENDED */
Packit 6c4009
#define _FPU_RC_DOWN    0x400
Packit 6c4009
#define _FPU_RC_UP      0x800
Packit 6c4009
#define _FPU_RC_ZERO    0xC00
Packit 6c4009
Packit 6c4009
#define _FPU_RESERVED 0xF0C0  /* Reserved bits in cw */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Now two recommended cw */
Packit 6c4009
Packit 6c4009
/* Linux default:
Packit 6c4009
     - extended precision
Packit 6c4009
     - rounding to positive infinity.  There is no /p instruction
Packit 6c4009
       qualifier.  By setting the dynamic rounding mode to +infinity,
Packit 6c4009
       one can use /d to get round to +infinity with no extra overhead
Packit 6c4009
       (so long as the default isn't changed, of course...)
Packit 6c4009
     - no exceptions enabled.  */
Packit 6c4009
Packit 6c4009
#define _FPU_DEFAULT  0x137f
Packit 6c4009
Packit 6c4009
/* IEEE:  same as above. */
Packit 6c4009
#define _FPU_IEEE     0x137f
Packit 6c4009
Packit 6c4009
/* Type of the control word.  */
Packit 6c4009
typedef unsigned int fpu_control_t;
Packit 6c4009
Packit 6c4009
/* Default control word set at startup.  */
Packit 6c4009
extern fpu_control_t __fpu_control;
Packit 6c4009
Packit 6c4009
#endif	/* _ALPHA_FPU_CONTROL */