From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id B3F243858434; Mon, 27 Feb 2023 11:22:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3F243858434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677496934; bh=yUtYJPHHVP3+452Tu2aNeF7F8h73dqZtQvyav/L29GE=; h=From:To:Subject:Date:From; b=eAW+zh8h83KLO8RmK4LzBTC2LYH9gfd0uuW+cq8xGrUJ20/gVnS8k/y5Po7tl3+WD QnnEeYiZBYXxf7ZoG7SegkELLFUIFBGctepKRLdl7PoOT2lbQM/P7pbZmj8dcMYHFL mX09H/POEhxy0DX8sUg0OyWa0yAW2Z4+SkbbJuFM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] LoongArch: Add math-barriers.h X-Act-Checkin: glibc X-Git-Author: Xi Ruoyao X-Git-Refname: refs/heads/master X-Git-Oldrev: 7999b8a3aa76eae4f75b76fd6797e832274b8114 X-Git-Newrev: aa4b45a34687595d37539feb367b0c691e41362b Message-Id: <20230227112214.B3F243858434@sourceware.org> Date: Mon, 27 Feb 2023 11:22:14 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aa4b45a34687595d37539feb367b0c691e41362b commit aa4b45a34687595d37539feb367b0c691e41362b Author: Xi Ruoyao Date: Tue Feb 14 16:57:13 2023 +0800 LoongArch: Add math-barriers.h This patch implements the LoongArch specific math barriers in order to omit the store and load from stack if possible. Signed-off-by: Xi Ruoyao Reviewed-by: Adhemerval Zanella Diff: --- sysdeps/loongarch/fpu/math-barriers.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sysdeps/loongarch/fpu/math-barriers.h b/sysdeps/loongarch/fpu/math-barriers.h new file mode 100644 index 0000000000..3e977e43a6 --- /dev/null +++ b/sysdeps/loongarch/fpu/math-barriers.h @@ -0,0 +1,28 @@ +/* Control when floating-point expressions are evaluated. LoongArch version. + Copyright (C) 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 _LOONGARCH_MATH_BARRIERS_H +#define _LOONGARCH_MATH_BARRIERS_H 1 + +/* Generic code forces values to memory; we don't need to do that. */ +#define math_opt_barrier(x) \ + ({ __typeof (x) __x = (x); __asm ("" : "+frm" (__x)); __x; }) +#define math_force_eval(x) \ + ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "frm" (__x)); }) + +#endif /* math-barriers.h */