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

Packit Service c82647
/* ceil function.  PowerPC64 version.
Packit Service c82647
   Copyright (C) 2004-2018 Free Software Foundation, Inc.
Packit Service c82647
   This file is part of the GNU C Library.
Packit Service c82647
Packit Service c82647
   The GNU C Library is free software; you can redistribute it and/or
Packit Service c82647
   modify it under the terms of the GNU Lesser General Public
Packit Service c82647
   License as published by the Free Software Foundation; either
Packit Service c82647
   version 2.1 of the License, or (at your option) any later version.
Packit Service c82647
Packit Service c82647
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service c82647
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service c82647
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service c82647
   Lesser General Public License for more details.
Packit Service c82647
Packit Service c82647
   You should have received a copy of the GNU Lesser General Public
Packit Service c82647
   License along with the GNU C Library; if not, see
Packit Service c82647
   <http://www.gnu.org/licenses/>.  */
Packit Service c82647
Packit Service c82647
#include <sysdep.h>
Packit Service c82647
#include <math_ldbl_opt.h>
Packit Service c82647
#include <libm-alias-double.h>
Packit Service c82647
Packit Service c82647
	.section	".toc","aw"
Packit Service c82647
.LC0:	/* 2**52 */
Packit Service c82647
	.tc FD_43300000_0[TC],0x4330000000000000
Packit Service c82647
	.section	".text"
Packit Service c82647
Packit Service c82647
ENTRY (__ceil, 4)
Packit Service c82647
	CALL_MCOUNT 0
Packit Service c82647
	lfd	fp13,.LC0@toc(2)
Packit Service c82647
	fabs	fp0,fp1
Packit Service c82647
	fsub	fp12,fp13,fp13	/* generate 0.0  */
Packit Service c82647
	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
Packit Service c82647
	mffs	fp11		/* Save current FPU rounding mode and
Packit Service c82647
				   "inexact" state.  */
Packit Service c82647
	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
Packit Service c82647
	bnl-	cr7,.L10
Packit Service c82647
	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
Packit Service c82647
	ble-	cr6,.L4
Packit Service c82647
	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
Packit Service c82647
	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
Packit Service c82647
	fabs	fp1,fp1		/* if (x == 0.0)  */
Packit Service c82647
				/* x = 0.0; */
Packit Service c82647
	mtfsf	0xff,fp11	/* Restore previous rounding mode and
Packit Service c82647
				   "inexact" state.  */
Packit Service c82647
	blr
Packit Service c82647
.L4:
Packit Service c82647
	bge-	cr6,.L9		/* if (x < 0.0)  */
Packit Service c82647
	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
Packit Service c82647
	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
Packit Service c82647
	fnabs	fp1,fp1		/* if (x == 0.0)  */
Packit Service c82647
				/* x = -0.0; */
Packit Service c82647
.L9:
Packit Service c82647
	mtfsf	0xff,fp11	/* Restore previous rounding mode and
Packit Service c82647
				   "inexact" state.  */
Packit Service c82647
	blr
Packit Service c82647
.L10:
Packit Service c82647
	/* Ensure sNaN input is converted to qNaN.  */
Packit Service c82647
	fcmpu	cr7,fp1,fp1
Packit Service c82647
	beqlr	cr7
Packit Service c82647
	fadd	fp1,fp1,fp1
Packit Service c82647
	blr
Packit Service c82647
	END (__ceil)
Packit Service c82647
Packit Service c82647
libm_alias_double (__ceil, ceil)