From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 292543858409 for ; Tue, 14 Feb 2023 08:57:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 292543858409 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1676365053; bh=ohVQCnaI549z8u/M/EgPLBGxG4XECX5gJD6oQmFynLk=; h=From:To:Cc:Subject:Date:From; b=lzaCG9faURhv3EkzVBAIVOtn/r9KJpQT8N8zlGyn4kbEp5aLBlAWvVUgQCpGop6A8 XPdwMvLJxhFWfM3GKaAloH8ROHMwsECS2tnI4NWtRnIhHhwtiQ7YRBhUcMP4EYgiOY HUDE4BxQxbLlBspp4de9DReWyfiercpOk+jyNvIw= Received: from stargazer.. (unknown [IPv6:240e:456:1030:5cf6:bedf:6bc:7e29:f3e5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 0C2856612C; Tue, 14 Feb 2023 03:57:29 -0500 (EST) From: Xi Ruoyao To: libc-alpha@sourceware.org Cc: caiyinyu , Wang Xuerui , Xi Ruoyao Subject: [PATCH] LoongArch: Add math-barriers.h Date: Tue, 14 Feb 2023 16:57:13 +0800 Message-Id: <20230214085713.44338-1-xry111@xry111.site> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- sysdeps/loongarch/fpu/math-barriers.h | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sysdeps/loongarch/fpu/math-barriers.h 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 */ -- 2.37.0