Blame sysdeps/sparc/sparc64/fpu/multiarch/s_rint-vis3.S

Packit Service 82fcde
/* Round float to int floating-point values, sparc64 vis3 version.
Packit Service 82fcde
   Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
   Contributed by David S. Miller <davem@davemloft.net>, 2012.
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
#include <sysdep.h>
Packit Service 82fcde
Packit Service 82fcde
	/* VIS instructions are used to facilitate the formation of
Packit Service 82fcde
	   easier constants, and the propagation of the sign bit.  */
Packit Service 82fcde
Packit Service 82fcde
#define TWO_FIFTYTWO	0x43300000		/* 2**52 */
Packit Service 82fcde
Packit Service 82fcde
#define ZERO		%f10			/* 0.0 */
Packit Service 82fcde
#define SIGN_BIT	%f12			/* -0.0 */
Packit Service 82fcde
Packit Service 82fcde
ENTRY (__rint_vis3)
Packit Service 82fcde
	sethi	%hi(TWO_FIFTYTWO), %o2
Packit Service 82fcde
	sllx	%o2, 32, %o2
Packit Service 82fcde
	fzero	ZERO
Packit Service 82fcde
Packit Service 82fcde
	fnegd	ZERO, SIGN_BIT
Packit Service 82fcde
	movxtod	%o2, %f16
Packit Service 82fcde
	fabsd	%f0, %f14
Packit Service 82fcde
Packit Service 82fcde
	fcmpd	%fcc3, %f14, %f16
Packit Service 82fcde
Packit Service 82fcde
	fmovduge %fcc3, ZERO, %f16
Packit Service 82fcde
	fand	%f0, SIGN_BIT, SIGN_BIT
Packit Service 82fcde
Packit Service 82fcde
	for	%f16, SIGN_BIT, %f16
Packit Service 82fcde
	faddd	%f0, %f16, %f6
Packit Service 82fcde
	fsubd	%f6, %f16, %f0
Packit Service 82fcde
	fabsd	%f0, %f0
Packit Service 82fcde
	retl
Packit Service 82fcde
	 for	%f0, SIGN_BIT, %f0
Packit Service 82fcde
END (__rint_vis3)