195967Speter/*- 2238405Sjkim * Copyright (c) 2013 The NetBSD Foundation, Inc. 395967Speter * All rights reserved. 4238405Sjkim * 5238405Sjkim * This code is derived from software contributed to The NetBSD Foundation 6238405Sjkim * by Matt Thomas of 3am Software Foundry. 795967Speter * 8238405Sjkim * Redistribution and use in source and binary forms, with or without 995967Speter * modification, are permitted provided that the following conditions 1095967Speter * are met: 1195967Speter * 1. Redistributions of source code must retain the above copyright 1295967Speter * notice, this list of conditions and the following disclaimer. 13238405Sjkim * 2. Redistributions in binary form must reproduce the above copyright 14238405Sjkim * notice, this list of conditions and the following disclaimer in the 15127326Smarkm * documentation and/or other materials provided with the distribution. 16238405Sjkim * 17238405Sjkim * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1895967Speter * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19238405Sjkim * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20238405Sjkim * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21238405Sjkim * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22238405Sjkim * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23238405Sjkim * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24238405Sjkim * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25238405Sjkim * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26238405Sjkim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27238405Sjkim * POSSIBILITY OF SUCH DAMAGE. 28238405Sjkim */ 29238405Sjkim 30238405Sjkim#include "namespace.h" 31238405Sjkim 32238405Sjkim#include <ieeefp.h> 33238405Sjkim#include <m68k/fpreg.h> 34238405Sjkim 35238405Sjkim#ifdef __weak_alias 36238405Sjkim__weak_alias(fpgetround,_fpgetround) 37238405Sjkim#endif 38238405Sjkim 39238405Sjkimfp_rnd 40238405Sjkim_fpgetround(void) 41238405Sjkim{ 42238405Sjkim int fpcr; 43238405Sjkim 44238405Sjkim __asm("fmovel %%fpcr,%0" : "=d"(fpcr)); 45238405Sjkim 46238405Sjkim return __SHIFTOUT(fpcr, FPCR_ROUND); 47238405Sjkim} 48238405Sjkim