From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7891) id A7B1E3858C31; Mon, 13 Mar 2023 01:21:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7B1E3858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678670511; bh=OXykN125Y43Vf6tqqkVN99kPBicMUiA2f//K42Is3JE=; h=From:To:Subject:Date:From; b=Ji8Z0GqOQFlUdISx5BIan2uEfhW9108L3rxmHf3OpEDjtoFU+L4nZbcYE2KkCX8xf SIs4VE9VY2Er3/rNPiAIwHe7rNDMoiTZlP364MH0KmHUMZMB1+d07pZmSVcVbXGtdd iothsuAp2myEryhpKq4wCDCDUwOmKbdLCnkDwjQI= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Yinyu Cai To: glibc-cvs@sourceware.org Subject: [glibc] LoongArch: Add get_rounding_mode. X-Act-Checkin: glibc X-Git-Author: caiyinyu X-Git-Refname: refs/heads/master X-Git-Oldrev: f0d33cbdce27f153e69c6527716ef906cce11841 X-Git-Newrev: 90233f113cc941ef88ce03b7f73221a964dcaca8 Message-Id: <20230313012151.A7B1E3858C31@sourceware.org> Date: Mon, 13 Mar 2023 01:21:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=90233f113cc941ef88ce03b7f73221a964dcaca8 commit 90233f113cc941ef88ce03b7f73221a964dcaca8 Author: caiyinyu Date: Wed Mar 8 15:55:15 2023 +0800 LoongArch: Add get_rounding_mode. Diff: --- sysdeps/loongarch/fpu/get-rounding-mode.h | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sysdeps/loongarch/fpu/get-rounding-mode.h b/sysdeps/loongarch/fpu/get-rounding-mode.h new file mode 100644 index 0000000000..b60733e298 --- /dev/null +++ b/sysdeps/loongarch/fpu/get-rounding-mode.h @@ -0,0 +1,38 @@ +/* Determine floating-point rounding mode within libc. LoongArch version. + + Copyright (C) 2022-2023 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _LARCH_GET_ROUNDING_MODE_H +#define _LARCH_GET_ROUNDING_MODE_H 1 + +#include +#include + +/* Return the floating-point rounding mode. */ + +static inline int +get_rounding_mode (void) +{ + fpu_control_t fpcr; + + _FPU_GETCW (fpcr); + return fpcr & _FPU_RC_MASK; +} + +#endif /* get-rounding-mode.h */