Blame sysdeps/x86_64/fpu/x86_64-math-asm.h

Packit 6c4009
/* Helper macros for x86_64 libm functions.
Packit 6c4009
   Copyright (C) 2015-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
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 _X86_64_MATH_ASM_H
Packit 6c4009
#define _X86_64_MATH_ASM_H 1
Packit 6c4009
Packit 6c4009
/* Define constants for the minimum value of a floating-point
Packit 6c4009
   type.  */
Packit 6c4009
#define DEFINE_LDBL_MIN					\
Packit 6c4009
	.section .rodata.cst16,"aM",@progbits,16;	\
Packit 6c4009
	.p2align 4;					\
Packit 6c4009
	.type ldbl_min,@object;				\
Packit 6c4009
ldbl_min:						\
Packit 6c4009
	.byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x1, 0;	\
Packit 6c4009
	.byte 0, 0, 0, 0, 0, 0;				\
Packit 6c4009
	.size ldbl_min, .-ldbl_min;
Packit 6c4009
Packit 6c4009
/* Force an underflow exception if the given value (nonnegative or
Packit 6c4009
   NaN) is subnormal.  The relevant constant for the minimum of the
Packit 6c4009
   type must have been defined, the MO macro must have been defined
Packit 6c4009
   for access to memory operands, and, if PIC, the PIC register must
Packit 6c4009
   have been loaded.  */
Packit 6c4009
#define LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN	\
Packit 6c4009
	fldt	MO(ldbl_min);			\
Packit 6c4009
	fld	%st(1);				\
Packit 6c4009
	fucomip	%st(1), %st(0);			\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
	jnc 6464f;				\
Packit 6c4009
	fld	%st(0);				\
Packit 6c4009
	fmul	%st(0);				\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
6464:
Packit 6c4009
Packit 6c4009
/* Likewise, but the argument is not a NaN.  */
Packit 6c4009
#define LDBL_CHECK_FORCE_UFLOW_NONNAN		\
Packit 6c4009
	fldt	MO(ldbl_min);			\
Packit 6c4009
	fld	%st(1);				\
Packit 6c4009
	fabs;					\
Packit 6c4009
	fcomip	%st(1), %st(0);			\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
	jnc 6464f;				\
Packit 6c4009
	fld	%st(0);				\
Packit 6c4009
	fmul	%st(0);				\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
6464:
Packit 6c4009
Packit 6c4009
/* Likewise, but the argument is nonnegative and not a NaN.  */
Packit 6c4009
#define LDBL_CHECK_FORCE_UFLOW_NONNEG		\
Packit 6c4009
	fldt	MO(ldbl_min);			\
Packit 6c4009
	fld	%st(1);				\
Packit 6c4009
	fcomip	%st(1), %st(0);			\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
	jnc 6464f;				\
Packit 6c4009
	fld	%st(0);				\
Packit 6c4009
	fmul	%st(0);				\
Packit 6c4009
	fstp	%st(0);				\
Packit 6c4009
6464:
Packit 6c4009
Packit 6c4009
#endif /* x86_64-math-asm.h.  */