Message ID | 20231128032938.17202-1-xujiahao@loongson.cn |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B80B73857349 for <patchwork@sourceware.org>; Tue, 28 Nov 2023 03:31:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 8AB69385B516 for <gcc-patches@gcc.gnu.org>; Tue, 28 Nov 2023 03:30:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AB69385B516 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8AB69385B516 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701142202; cv=none; b=aDfnT9PY20XCrOTXTMo2Km4A4glEFpZxCmm/7NU2GSB82YLjCyoibUhhVmKSu3JcNlOgK5vAhG5aL9r+ZCsvzxsXUfNiwadZk+ViVsBnEnIxP/NMIbgHv1/5RU4YzcDKB0pX/yTPki4ZWQxWGDugziL4NJ4+eXLIKy03IBpjUt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701142202; c=relaxed/simple; bh=nuVNmA3r/kgO5q3inqyLJhqdGm98UhSck34Vw5+bdZI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=SpcilmrQ/TCYPGDqj/aVkW7t5kpnDJ6OYjtJggduWlh9CARO+Vq80Aw+iRMuc7ckLKhEhaKdXEentAnbwFQ0P2DSmZ7Si2bLONplJmLmwH74k8gLXurgbG+hRuM0yPQ652dI3H7QR0vEM26lE/9SyZnpMCSfzQpJAokCMnQMA0E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <xujiahao@loongson.cn>) id 1r7onP-00014i-9b for gcc-patches@gcc.gnu.org; Mon, 27 Nov 2023 22:30:01 -0500 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8Cx7+uoXmVlAU49AA--.55319S3; Tue, 28 Nov 2023 11:29:45 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dxnd6lXmVlM2ZOAA--.43637S4; Tue, 28 Nov 2023 11:29:41 +0800 (CST) From: Jiahao Xu <xujiahao@loongson.cn> To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, chenglulu@loongson.cn, xuchenghua@loongson.cn, Jiahao Xu <xujiahao@loongson.cn> Subject: [PATCH 0/5] LoongArch: Add -mrecip option support Date: Tue, 28 Nov 2023 11:29:33 +0800 Message-Id: <20231128032938.17202-1-xujiahao@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Dxnd6lXmVlM2ZOAA--.43637S4 X-CM-SenderInfo: 50xmxthkdrqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxJry3Cw48Zw4xKF48urWfWFX_yoW8KrWxpF ZrCrnxtF48JrZ3WrnxJa43XFs8XF97K3y293W3A340k3yIqr9FvF1kt3sIqF17Xa45JryI qrn5uw15u3WYv3cCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07URa0PUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=xujiahao@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_FAIL, SPF_HELO_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org |
Series |
LoongArch: Add -mrecip option support
|
|
Message
Jiahao Xu
Nov. 28, 2023, 3:29 a.m. UTC
LoongArch V1.1 instructions adds support for approximate instructions, which are utilized along with additional Newton-Raphson steps implement single precision floating-point division, square root and reciprocal square root operations for better throughput. Control the generation of approximate instructions by implementing '-mrecip' and '-mrecip='. Jiahao Xu (5): LoongArch: Add support for approximate instructions. LoongArch: Use standard pattern name for xvfrsqrt/vfrsqrt instructions. LoongArch: Redefine pattern for xvfrecip/vfrecip instructions. LoongArch: New options -mrecip and -mrecip= with ffast-math. LoongArch: Vectorized loop unrolling is not performed on divf/sqrtf/rsqrtf with turns on -mrecip. gcc/config/loongarch/genopts/loongarch.opt.in | 11 + gcc/config/loongarch/lasx.md | 89 ++++++- gcc/config/loongarch/lasxintrin.h | 32 +++ gcc/config/loongarch/loongarch-builtins.cc | 32 +++ gcc/config/loongarch/loongarch-protos.h | 2 + gcc/config/loongarch/loongarch.cc | 252 +++++++++++++++++- gcc/config/loongarch/loongarch.h | 18 ++ gcc/config/loongarch/loongarch.md | 104 ++++++-- gcc/config/loongarch/loongarch.opt | 11 + gcc/config/loongarch/lsx.md | 89 ++++++- gcc/config/loongarch/lsxintrin.h | 32 +++ gcc/config/loongarch/predicates.md | 8 + gcc/doc/invoke.texi | 52 ++++ .../gcc.target/loongarch/recip-divf.c | 9 + .../gcc.target/loongarch/recip-sqrtf.c | 23 ++ .../loongarch/vector/lasx/lasx-recip-divf.c | 12 + .../loongarch/vector/lasx/lasx-recip-sqrtf.c | 28 ++ .../loongarch/vector/lsx/lsx-recip-divf.c | 12 + .../loongarch/vector/lsx/lsx-recip-sqrtf.c | 28 ++ 19 files changed, 803 insertions(+), 41 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/recip-divf.c create mode 100644 gcc/testsuite/gcc.target/loongarch/recip-sqrtf.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-recip-divf.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-recip-sqrtf.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-recip-divf.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-recip-sqrtf.c