From patchwork Thu Aug 24 03:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenghui Pan X-Patchwork-Id: 1825106 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=2620:52:3:1:0:246e:9693:128c; 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 (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4RWSqL70cMz1ygJ for ; Thu, 24 Aug 2023 13:14:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE0413853D29 for ; Thu, 24 Aug 2023 03:14:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id C231A3858C2C for ; Thu, 24 Aug 2023 03:14:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C231A3858C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.4.45]) by gateway (Coremail) with SMTP id _____8Dx_+vyyuZk62EbAA--.54910S3; Thu, 24 Aug 2023 11:13:54 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.45]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxviPdyuZkzvJhAA--.583S4; Thu, 24 Aug 2023 11:13:46 +0800 (CST) From: Chenghui Pan To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, chenglulu@loongson.cn, xuchenghua@loongson.cn, Chenghui Pan Subject: [PATCH v5 0/6] Add Loongson SX/ASX instruction support to LoongArch target. Date: Thu, 24 Aug 2023 11:13:10 +0800 Message-Id: <20230824031316.16599-1-panchenghui@loongson.cn> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxviPdyuZkzvJhAA--.583S4 X-CM-SenderInfo: psdquxxhqjx33l6o00pqjv00gofq/1tbiAQANBGTlhzMJHgAGss X-Coremail-Antispam: 1Uk129KBj93XoWxCrWkKFW5ur18tF4fJFyrAFc_yoWrXF1Dpr 9xuw13AF48JFsxtrnxJ34fWws8Ja4xKw17Zay3tr18CrW7CryUZF18Gr9xZF1UWw45JryI qw4rKw4j9a1Yy3cCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UE-erUUUUU= X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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/627413.html Changes since last version of patch set: - Fix regression test fail of pr54346.c with RUNTESTFLAGS="--target_board=unix/-mlsx". This is caused by the code simplification of loongarch_expand_vec_perm_const_2 () in last version. - Combine vilvh/xvilvh insn's RTL template impl. - Add dg-skip-if for loongarch*-*-* in vshuf test in g++.dg/torture, because vshuf/xvshuf insn's result is undefined when 6 or 7 bit of vector's element is set, and insns with this condition are generated in these testcases. Brief version 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. Lulu Cheng (6): LoongArch: Add Loongson SX vector directive compilation framework. LoongArch: Add Loongson SX base instruction support. LoongArch: Add Loongson SX directive builtin function support. LoongArch: Add Loongson ASX vector directive compilation framework. 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 +- .../loongarch/genopts/loongarch-strings | 4 + gcc/config/loongarch/genopts/loongarch.opt.in | 12 +- gcc/config/loongarch/lasx.md | 5104 ++++++++++++++++ gcc/config/loongarch/lasxintrin.h | 5338 +++++++++++++++++ gcc/config/loongarch/loongarch-builtins.cc | 2686 ++++++++- gcc/config/loongarch/loongarch-c.cc | 18 + gcc/config/loongarch/loongarch-def.c | 6 + gcc/config/loongarch/loongarch-def.h | 9 +- gcc/config/loongarch/loongarch-driver.cc | 10 + gcc/config/loongarch/loongarch-driver.h | 2 + gcc/config/loongarch/loongarch-ftypes.def | 666 +- gcc/config/loongarch/loongarch-modes.def | 39 + gcc/config/loongarch/loongarch-opts.cc | 89 +- gcc/config/loongarch/loongarch-opts.h | 3 + gcc/config/loongarch/loongarch-protos.h | 35 + gcc/config/loongarch/loongarch-str.h | 3 + gcc/config/loongarch/loongarch.cc | 4660 +++++++++++++- gcc/config/loongarch/loongarch.h | 117 +- gcc/config/loongarch/loongarch.md | 56 +- gcc/config/loongarch/loongarch.opt | 12 +- gcc/config/loongarch/lsx.md | 4467 ++++++++++++++ gcc/config/loongarch/lsxintrin.h | 5181 ++++++++++++++++ gcc/config/loongarch/predicates.md | 333 +- gcc/doc/md.texi | 11 + gcc/testsuite/g++.dg/torture/vshuf-v16hi.C | 1 + gcc/testsuite/g++.dg/torture/vshuf-v16qi.C | 1 + gcc/testsuite/g++.dg/torture/vshuf-v2df.C | 2 + gcc/testsuite/g++.dg/torture/vshuf-v2di.C | 1 + gcc/testsuite/g++.dg/torture/vshuf-v4sf.C | 2 +- gcc/testsuite/g++.dg/torture/vshuf-v8hi.C | 1 + 32 files changed, 28717 insertions(+), 285 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