xref: /netbsd-src/lib/libc/arch/arm/hardfloat/fpsetsticky.S (revision 60e851836f800c27172ddd158f61000ca8d17d34)
1*60e85183Smatt/*	$NetBSD: fpsetsticky.S,v 1.6 2013/01/11 13:55:26 matt Exp $	*/
25aefcfdcSbjh21
3*60e85183Smatt/*-
4*60e85183Smatt * Copyright (c) 2013 The NetBSD Foundation, Inc.
55aefcfdcSbjh21 * All rights reserved.
65aefcfdcSbjh21 *
7*60e85183Smatt * This code is derived from software contributed to The NetBSD Foundation
8*60e85183Smatt * by Matt Thomas of 3am Software Foundry.
9*60e85183Smatt *
105aefcfdcSbjh21 * Redistribution and use in source and binary forms, with or without
115aefcfdcSbjh21 * modification, are permitted provided that the following conditions
125aefcfdcSbjh21 * are met:
135aefcfdcSbjh21 * 1. Redistributions of source code must retain the above copyright
145aefcfdcSbjh21 *    notice, this list of conditions and the following disclaimer.
155aefcfdcSbjh21 * 2. Redistributions in binary form must reproduce the above copyright
165aefcfdcSbjh21 *    notice, this list of conditions and the following disclaimer in the
175aefcfdcSbjh21 *    documentation and/or other materials provided with the distribution.
185aefcfdcSbjh21 *
19*60e85183Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*60e85183Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*60e85183Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*60e85183Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*60e85183Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*60e85183Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*60e85183Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*60e85183Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*60e85183Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*60e85183Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*60e85183Smatt * POSSIBILITY OF SUCH DAMAGE.
305aefcfdcSbjh21 */
315aefcfdcSbjh21
32*60e85183Smatt#ifndef __VFP_FP__
33*60e85183Smatt#error FPA is not supported anymore
34*60e85183Smatt#endif
35*60e85183Smatt
36*60e85183Smatt#include <arm/asm.h>
37*60e85183Smatt#include <arm/vfpreg.h>
385aefcfdcSbjh21
395aefcfdcSbjh21/*
405aefcfdcSbjh21 * Set the current FP cumulative flags
415aefcfdcSbjh21 */
425aefcfdcSbjh21
435d3e8294Sthorpej#ifdef WEAK_ALIAS
445d3e8294SthorpejWEAK_ALIAS(fpsetsticky, _fpsetsticky)
45*60e85183Smatt#define	fpsetsticky	_fpsetsticky
46*60e85183Smatt#endif
47*60e85183Smatt
485aefcfdcSbjh21ENTRY(fpsetsticky)
49*60e85183Smatt	and	r1, r0, #VFP_FPSCR_CSUM
50*60e85183Smatt	vmrs	r0, fpscr
51*60e85183Smatt	bic	r2, r0, #VFP_FPSCR_CSUM
52*60e85183Smatt	orr	r1, r1, r2
53*60e85183Smatt	vmsr	fpscr, r1
54*60e85183Smatt	and	r0, r0, #VFP_FPSCR_CSUM
55d6621260Srearnsha	RET
56*60e85183SmattEND(fpsetsticky)
57