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: 13715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp858543vqm; Wed, 23 Aug 2023 20:15:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFh33sCI75R+LK4kqs+/Mpd96r55bBKzGlpNIeR117IbMHYBFcS5l+8BAdhH3eqaaqJW8I7 X-Received: by 2002:a17:906:53d1:b0:9a2:120a:5782 with SMTP id p17-20020a17090653d100b009a2120a5782mr336256ejo.17.1692846914134; Wed, 23 Aug 2023 20:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692846914; cv=none; d=google.com; s=arc-20160816; b=n8p65w77yo3asWlT5FXhoxrdu4U9Zb0+qzphCX7MGnLhfqzzcZsIaMfpGoOcVgvzWx Pv49wRQ5uWI/1Xpz82yX/KAtkjxO/6kTvERJp0HnCMzr0ZMJdhKa0QEXP+h5E5mIumWZ gMBBAwkWaC+sjTcd1cHnKKhaXSQOp6hXb9JtU1+PUMaphv5oFtjeExr/27eI05kjv6+4 xSX0F+mp1SvRpl4NXScRyUzCWQ1uDJOwEdP2UVTk5/pWSbRFrKeKgUE1DMSCpW0DC4hr UL8lrqc9ZHHWGzYO+9ppuHUiYZl6wyxYV2pR7WJ79vvtWtUfBLiOBVK40WGgnvVCHHR6 R49w== 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=by1UPSOMKCr1MEDmb510uaxtWXQ2/cO4i/MMvjZ+FYk=; fh=1s9dWpGrN6w/C+gFTt26gmXiHDCD0RpwovFQvR8y/fI=; b=j2iKTJbahrD6CH00HPNvlCvUCcRuOMbjO0F1dmb80M9BS1+hi25UdOiD3y8Js3AlgF K+kYQqPp9M1NlkZ1Lq4vO/4pa/ruCfuc1kZxlm+cKD7S24ES9NnkS+oXgAVmRTp4gjJ3 slWhwOyAiBo23mIbo+yBMbMMniNX5fOftk2m2uyo2pfFohCo9v5bBaoNwtRNf4R0DYis FIxZ0UH4j4N5twJcBkOEhZus20ABdZXJwngP1/Yua7tGjgxhYqomb80PeqxbsfPKa8+H ETp7ET/D/yOOQ56xMTXSIBfdcGtmzlrklYTZpATlWTDoEz7ZUSIZf47AA2uwgluBt/P0 LMjw== 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 us11-20020a170906bfcb00b009a0d5192b08si8357541ejb.725.2023.08.23.20.15.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 20:15:14 -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 A117F387689A for ; Thu, 24 Aug 2023 03:14:28 +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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775078645802920205 X-GMAIL-MSGID: 1775078645802920205 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