From patchwork Tue Jul 18 11:06:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenghui Pan X-Patchwork-Id: 12202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1661571vqt; Tue, 18 Jul 2023 04:10:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6dosZwDx7Sb6nki/h11dvXmRR4wSaYh5UDL8xIMfElFBbaXmwrDofL5JsvBEjZcRfmwee X-Received: by 2002:aa7:dac6:0:b0:514:a4cd:85d7 with SMTP id x6-20020aa7dac6000000b00514a4cd85d7mr1876921eds.26.1689678615641; Tue, 18 Jul 2023 04:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689678615; cv=none; d=google.com; s=arc-20160816; b=PL8AmnSBVr2IO1xpG1Qhs8F4Jb5sf0kJxKIX8HE5qgMPL/26Xjnfof6d8Anaxniniy FWARRdlqmrcJu64tUWAUnf0Th8cMkDQ7FboE6IzqoPNynVfi59W8oq0IIbm2mTK+MH+m a0r55ooUYtL0apENlv80Dav35N8R94v6tPhlaAxY4mavezZmE5I3+4XV6PWkjg13aeux uv3GJxTO6vVw9dgYbCao3XO2icly/EZ5qjRUJadzAzoTudVDDZYC/4mr4HPGHtnl8SJZ BhSZVQGwx1Ka0D6yh6TCF3QJ2DXZA7rTWvNV1Tkr7PoMcHnEDOsYO+6B1l74x1gumZNg BDqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dmarc-filter :delivered-to; bh=Us5X8Be32Z8Q6BQwp7hLUucXYPSN6IuyTXb6ORr+PSo=; fh=1s9dWpGrN6w/C+gFTt26gmXiHDCD0RpwovFQvR8y/fI=; b=S7cDPmm0cTCUvuGlwYXSqciu8nl0zaC4NMtoenhzR9RdO3Ads4SqR6DMViI6CkSzIk gVFdCLQf+PJiWjuRgvZ8KnzFLq42/YoVpzBESGaaNi3tjMGQwgnrM0zrKrztoZGrab/0 EjzNkHwig/Qq0Uce2Fb2se104lqr9JFeWPxmNzI+CAQm1fumeky1C7HxlIQABOFW2vt1 cCfrdhF3yOlYBX+gGBboxO4Fg5YIiRuUBOHYMVET/i8hKB2AbC3MnDw77NXnoSqmPYUT MlfhQxF1OSMkC13kQt9cpM3fOEFwVRO/fjdfcZ9ZLPfFTV7EPyiiWZDxxgIzO2FRW/tk iaLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n13-20020aa7db4d000000b0051e3d143815si1006726edt.560.2023.07.18.04.10.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 04:10:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B7E153881D23 for ; Tue, 18 Jul 2023 11:08:30 +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 9FBF438555AB for ; Tue, 18 Jul 2023 11:07:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FBF438555AB 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 1qLiY1-0000VU-2F for gcc-patches@gcc.gnu.org; Tue, 18 Jul 2023 07:07:38 -0400 Received: from loongson.cn (unknown [10.20.4.45]) by gateway (Coremail) with SMTP id _____8CxtPBScrZkHLUGAA--.17745S3; Tue, 18 Jul 2023 19:06:59 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.45]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxriNFcrZkjiwzAA--.35305S4; Tue, 18 Jul 2023 19:06:50 +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 v2 0/8] Add Loongson SX/ASX instruction support to LoongArch target. Date: Tue, 18 Jul 2023 19:06:17 +0800 Message-Id: <20230718110625.88834-1-panchenghui@loongson.cn> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxriNFcrZkjiwzAA--.35305S4 X-CM-SenderInfo: psdquxxhqjx33l6o00pqjv00gofq/1tbiAQAQBGS0v64GogABsx X-Coremail-Antispam: 1Uk129KBj93XoWxtr4kKF1fGr15Zr48ZFy3KFX_yoWxWF4kp3 9rurnxtF48JFZ3Gr1DJa43Xr4DJFyxK3ya93Way348CrWIgr9Fv3W8Jr9rXFy3Jay5tryx XrnY9w1UW3WYvacCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UMpBfUUUUU= 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-8.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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771756444314326924 X-GMAIL-MSGID: 1771756444314326924 This is an update of https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623262.html In addition, LSX/LASX instructions support is added in the master branch of binutils-gdb, and these GCC patches can be used with future releases of binutils-gdb. Changes since v1: - Some usages of "unspec" in lsx.md and lasx.md are replaced with arithmetic RTL expressions. - Support ADDR_REG_REG in LSX and LASX. - Constraint docs are appended in gcc/doc/md.texi and head comment block of gcc/config/loongarch/constraints.md. - Codes related to vecarg in loongarch.cc and loongarch.opt.in are removed in v2. - Testsuite of LSX and LASX is added in v2, and can be called by using loongarch-vector.exp independently. - Adjust the loongarch_expand_vector_init() function to reduce instruction amount when initializing the vector with element-by-element style. - Some minor implementation changes of RTL templates in lsx.md and lasx.md. Lulu Cheng (8): LoongArch: Added Loongson SX vector directive compilation framework. LoongArch: Added Loongson SX base instruction support. LoongArch: Added Loongson SX directive builtin function support. LoongArch: Added Loongson ASX vector directive compilation framework. LoongArch: Added Loongson ASX base instruction support. LoongArch: Added Loongson ASX directive builtin function support. LoongArch: Add Loongson SX directive test cases. LoongArch: Add Loongson ASX directive test cases. 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 | 5120 +++ gcc/config/loongarch/lasxintrin.h | 5342 +++ 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 | 4669 +- gcc/config/loongarch/loongarch.h | 117 +- gcc/config/loongarch/loongarch.md | 56 +- gcc/config/loongarch/loongarch.opt | 12 +- gcc/config/loongarch/lsx.md | 4479 ++ gcc/config/loongarch/lsxintrin.h | 5181 +++ gcc/config/loongarch/predicates.md | 333 +- gcc/doc/md.texi | 11 + .../gcc.target/loongarch/strict-align.c | 13 + .../vector/lasx/lasx-bit-manipulate.c | 27813 +++++++++++ .../loongarch/vector/lasx/lasx-builtin.c | 1509 + .../loongarch/vector/lasx/lasx-cmp.c | 5361 +++ .../loongarch/vector/lasx/lasx-fp-arith.c | 6259 +++ .../loongarch/vector/lasx/lasx-fp-cvt.c | 7315 +++ .../loongarch/vector/lasx/lasx-int-arith.c | 38361 ++++++++++++++++ .../loongarch/vector/lasx/lasx-mem.c | 147 + .../loongarch/vector/lasx/lasx-perm.c | 7730 ++++ .../vector/lasx/lasx-str-manipulate.c | 712 + .../loongarch/vector/lasx/lasx-xvldrepl.c | 13 + .../loongarch/vector/lasx/lasx-xvstelm.c | 12 + .../loongarch/vector/loongarch-vector.exp | 42 + .../loongarch/vector/lsx/lsx-bit-manipulate.c | 15586 +++++++ .../loongarch/vector/lsx/lsx-builtin.c | 1461 + .../gcc.target/loongarch/vector/lsx/lsx-cmp.c | 3354 ++ .../loongarch/vector/lsx/lsx-fp-arith.c | 3713 ++ .../loongarch/vector/lsx/lsx-fp-cvt.c | 4114 ++ .../loongarch/vector/lsx/lsx-int-arith.c | 22424 +++++++++ .../gcc.target/loongarch/vector/lsx/lsx-mem.c | 537 + .../loongarch/vector/lsx/lsx-perm.c | 5555 +++ .../loongarch/vector/lsx/lsx-str-manipulate.c | 408 + .../loongarch/vector/simd_correctness_check.h | 39 + 49 files changed, 181229 insertions(+), 284 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 create mode 100644 gcc/testsuite/gcc.target/loongarch/strict-align.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-bit-manipulate.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-builtin.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-cmp.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-fp-arith.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-fp-cvt.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-int-arith.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-mem.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-perm.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-str-manipulate.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvstelm.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-bit-manipulate.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-builtin.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-cmp.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-fp-arith.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-fp-cvt.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-int-arith.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-mem.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-perm.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-str-manipulate.c create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h