From patchwork Thu Aug 31 09:08:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenghui Pan X-Patchwork-Id: 1828174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RbwMQ4nGrz1ygF for ; Thu, 31 Aug 2023 19:09:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E9C83857341 for ; Thu, 31 Aug 2023 09:09:03 +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 791DE3858C2B for ; Thu, 31 Aug 2023 09:08:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 791DE3858C2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbdfR-0008UW-Mf for gcc-patches@gcc.gnu.org; Thu, 31 Aug 2023 05:08:49 -0400 Received: from loongson.cn (unknown [10.20.4.45]) by gateway (Coremail) with SMTP id _____8Dx_+uPWPBk6mIdAA--.59029S3; Thu, 31 Aug 2023 17:08:32 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.45]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxDc+DWPBkK_5nAA--.55112S4; Thu, 31 Aug 2023 17:08:24 +0800 (CST) From: Chenghui Pan To: gcc-patches@gcc.gnu.org Subject: [PATCH v6 0/4] Add Loongson SX/ASX instruction support to LoongArch target. Date: Thu, 31 Aug 2023 17:08:13 +0800 Message-Id: <20230831090817.30636-1-panchenghui@loongson.cn> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxDc+DWPBkK_5nAA--.55112S4 X-CM-SenderInfo: psdquxxhqjx33l6o00pqjv00gofq/1tbiAQAABGTwEzQETwAAs9 X-Coremail-Antispam: 1Uk129KBj93XoWxCw45Ww4rtr1DWFyDCFW8KrX_yoW5ZF4xpr ZxCwnIyFW8JFsFqrsxJ34fWwn8Jr97K3y7ua13tr18CrWUuryjvFy8KrZrZF1DWw45XryI qr1rKw4Uua1Yy3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UWHqcUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=panchenghui@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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_FAIL, SPF_HELO_PASS, TXREP 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xuchenghua@loongson.cn, Chenghui Pan , chenglulu@loongson.cn, i@xen0n.name Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This is an update of: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628303.html Changes since last version of patch set: - "dg-skip-if"-related Changes of the g++.dg/torture/vshuf* testcases are reverted. (Replaced by __builtin_shuffle fix) - Add fix of __builtin_shuffle() for Loongson SX/ASX (Implemeted by adding vand/xvand insn in front of shuffle operation). There's no significant performance impact in current state. - Rebased on the top of Yang Yujie's latest target configuration interface patch set (https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628772.html). Brief history of patch set: v1 -> v2: - Reduce usage of "unspec" in RTL template. - Append Support of ADDR_REG_REG in LSX and LASX. - Constraint docs are appended in gcc/doc/md.texi and ccomment block. - Codes related to vecarg are removed. - Testsuite of LSX and LASX is added in v2. (Because of the size limitation of mail list, these patches are not shown) - Adjust the loongarch_expand_vector_init() function to reduce instruction output amount. - Some minor implementation changes of RTL templates. v2 -> v3: - Revert vabsd/xvabsd RTL templates to unspec impl. - Resolve warning in gcc/config/loongarch/loongarch.cc when bootstrapping with BOOT_CFLAGS="-O2 -ftree-vectorize -fno-vect-cost-model -mlasx". - Remove redundant definitions in lasxintrin.h. - Refine commit info. v3 -> v4: - Code simplification. - Testsuite patches are splited from this patch set again and will be submitted independently in the future. v4 -> v5: - Regression test fix (pr54346.c) - Combine vilvh/xvilvh insn's RTL template impl. - Add dg-skip-if for loongarch*-*-* in vshuf test inside g++.dg/torture (reverted in this version) Lulu Cheng (4): LoongArch: Add Loongson SX base instruction support. LoongArch: Add Loongson SX directive builtin function support. LoongArch: Add Loongson ASX base instruction support. LoongArch: Add Loongson ASX directive builtin function support. gcc/config.gcc | 2 +- gcc/config/loongarch/constraints.md | 131 +- gcc/config/loongarch/genopts/loongarch.opt.in | 4 + gcc/config/loongarch/lasx.md | 5104 ++++++++++++++++ gcc/config/loongarch/lasxintrin.h | 5338 +++++++++++++++++ gcc/config/loongarch/loongarch-builtins.cc | 2686 ++++++++- gcc/config/loongarch/loongarch-ftypes.def | 666 +- gcc/config/loongarch/loongarch-modes.def | 39 + gcc/config/loongarch/loongarch-protos.h | 35 + gcc/config/loongarch/loongarch.cc | 4751 ++++++++++++++- gcc/config/loongarch/loongarch.h | 117 +- gcc/config/loongarch/loongarch.md | 56 +- gcc/config/loongarch/loongarch.opt | 4 + gcc/config/loongarch/lsx.md | 4467 ++++++++++++++ gcc/config/loongarch/lsxintrin.h | 5181 ++++++++++++++++ gcc/config/loongarch/predicates.md | 333 +- gcc/doc/md.texi | 11 + 17 files changed, 28645 insertions(+), 280 deletions(-) create mode 100644 gcc/config/loongarch/lasx.md create mode 100644 gcc/config/loongarch/lasxintrin.h create mode 100644 gcc/config/loongarch/lsx.md create mode 100644 gcc/config/loongarch/lsxintrin.h