Blame sysdeps/powerpc/powerpc64/fpu/s_rint.S

Packit Service 82fcde
/* Round to int floating-point values.  PowerPC64 version.
Packit Service 82fcde
   Copyright (C) 2004-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
/* This has been coded in assembler because GCC makes such a mess of it
Packit Service 82fcde
   when it's coded in C.  */
Packit Service 82fcde
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
#include <math_ldbl_opt.h>
Packit Service 82fcde
#include <libm-alias-double.h>
Packit Service 82fcde
Packit Service 82fcde
	.section	".toc","aw"
Packit Service 82fcde
.LC0:	/* 2**52 */
Packit Service 82fcde
	.tc FD_43300000_0[TC],0x4330000000000000
Packit Service 82fcde
	.section	".text"
Packit Service 82fcde
Packit Service 82fcde
ENTRY (__rint, 4)
Packit Service 82fcde
	CALL_MCOUNT 0
Packit Service 82fcde
	lfd	fp13,.LC0@toc(2)
Packit Service 82fcde
	fabs	fp0,fp1
Packit Service 82fcde
	fsub	fp12,fp13,fp13	/* generate 0.0  */
Packit Service 82fcde
	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
Packit Service 82fcde
	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
Packit Service 82fcde
	bnl	cr7,.L10
Packit Service 82fcde
	bng	cr6,.L4
Packit Service 82fcde
	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
Packit Service 82fcde
	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
Packit Service 82fcde
	fabs	fp1,fp1		/* if (x == 0.0)  */
Packit Service 82fcde
	blr			/* x = 0.0; */
Packit Service 82fcde
.L4:
Packit Service 82fcde
	bnllr	cr6		/* if (x < 0.0)  */
Packit Service 82fcde
	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
Packit Service 82fcde
	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
Packit Service 82fcde
	fnabs	fp1,fp1		/* if (x == 0.0)  */
Packit Service 82fcde
	blr			/* x = -0.0; */
Packit Service 82fcde
.L10:
Packit Service 82fcde
	/* Ensure sNaN input is converted to qNaN.  */
Packit Service 82fcde
	fcmpu	cr7,fp1,fp1
Packit Service 82fcde
	beqlr	cr7
Packit Service 82fcde
	fadd	fp1,fp1,fp1
Packit Service 82fcde
	blr
Packit Service 82fcde
	END (__rint)
Packit Service 82fcde
Packit Service 82fcde
libm_alias_double (__rint, rint)