From patchwork Fri Feb 24 05:51:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 5811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp723714wrd; Thu, 23 Feb 2023 21:53:15 -0800 (PST) X-Google-Smtp-Source: AK7set/7SF5jTyfnDYZkseH1cip0/RlequyqiaqvBin6PpvR1AUyUNIU4HcfMS9pWV3R/tiu2yVs X-Received: by 2002:a17:906:7c55:b0:88e:d435:3fd6 with SMTP id g21-20020a1709067c5500b0088ed4353fd6mr23803062ejp.63.1677217995645; Thu, 23 Feb 2023 21:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677217995; cv=none; d=google.com; s=arc-20160816; b=ZPOZvqOyZK/me2qmzpzJXprcM9o2X7iBvz+yx5OonyNfAd8+Xqi4OcG+16DR6SfWKG FzzkPfFPEU9FyQEm0QL3UEWvDS2p4VldaUX4b5DqTMmrxQzMvMnz1vmLtxbcrf2kjEl+ 7hlAnym2KT5HoI+Mc9f+kOaRivGoXxdMN/voSWNjgWGFe4tvD7N/MBek3JWur2iGsK0A Tuq4Kn348rv3akXzvMeuieczHgS2rDMMjoxB+wj9r5Nq6lpHaloj6sbcTdT7aTjblPC4 F0czh1RmZ4dzM9iPAeaiwr3vTZoALQXYGZ0u1pyuAcHZo9BHkgezP4jHbDm8Pt3/pSSo mrZQ== 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:dkim-signature :dmarc-filter:delivered-to; bh=E7OpSmk1rqFn8wCTbWSK19sn0rQbfAm3XV8AFsTPr10=; b=gTo5FgF7vtc2cP01CTwG4oTvAdZr1sVAywanBAlLurNSrR4OLHczExtPPtBHECmt9Z FFaPtW9G5ilMIAfWuiK6nnfxHPnPYmJ1wR4kg8TevSGgrzogDdZq0/dG2yx48aCjui/O 6hNMNtCAi0SGLzEmaUaKm4Cio4tOTS4wcj3LJZrlkwcgkzUrCYNVVlosz9QX0LaCTF7z KlNiTrTnVY9AaXXFPcbo9d02e2SoyzhVCd7bq83L7bM7KABGqZhawGJlQU5zKP2tsrNF xt87OKSBvkVyRPW6MlrJDap0LzVuaHrt6BX5Prt8RGLtWztzY2JGRLbLTFZQI7tRITQq JHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=kGDGdDod; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v22-20020aa7d9d6000000b004ad7a9f851csi5610086eds.390.2023.02.23.21.53.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 21:53:15 -0800 (PST) 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; dkim=pass header.i=@vrull.eu header.s=google header.b=kGDGdDod; 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 E0F9B3850862 for ; Fri, 24 Feb 2023 05:52:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 75C77385840F for ; Fri, 24 Feb 2023 05:51:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 75C77385840F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-wr1-x435.google.com with SMTP id j2so12598788wrh.9 for ; Thu, 23 Feb 2023 21:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=E7OpSmk1rqFn8wCTbWSK19sn0rQbfAm3XV8AFsTPr10=; b=kGDGdDode/bHGnyqWajUQ2dRi5AfQMmpMHO/bZQGs+QZB3Pey5XP8Q3k6gCe+c2PUL uY/CJ6U9f45zmgCciKb+GeTUWuwdt7DswfLX9qYWopGaIq5yB1Bcxq5u8TWhjSoecHSy Dd993pwfDcwK5eQIMHXvUmlXDjAYbDVokjtLdPhSVLO29OnWPQsjFP57q2dHTATgxAHR oM2xguqynsQHD/NYwq7VhAhRW13eSiUtYjrmwv/48IGAYdnmcSJJDuRjaGSF6yXrAD/7 A1oFQbWIJnReL+WMgUAZBEZeLpJsmbuzKM6bmytpOXbMoqNgbog86oTXoVduCC73FSDW VxwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E7OpSmk1rqFn8wCTbWSK19sn0rQbfAm3XV8AFsTPr10=; b=u/H9f4bQpCe//swJ+jD04A7vW9sOJwuynP0l8Q/TFwXOOA4dUiNA0S04wVpJjT1++G 0duON+ArW7JAMuv+tysOJNPPmJblnarRqdYLq5Ldxark4TpaxN9G6dUIt4poVqn1pelD 4fyQJyvr5NsPKws50OWJQvHjtaxwpaBRD7foiB418LqgnXWtWbDdrhc4Lj+O/+wjxyoF xYfrs/tXK0m3OtvTSki5IPPMkPYMWM9bGGlfvSImK8qLfG5FvpUaPOSoxSOXfPlhyiYY zt/IyiMzLux07S+ig9nzOSfDR9c4LcNHSfsgTdcPBHvyytGtBixK6YxQOcOIv0l8xfWm FnFQ== X-Gm-Message-State: AO0yUKVGFJ1Z5rj9eC/L/v7+Bby3bBPtNwxkZ0nfsBn2zLUJP/eOTPCU 9vKPlg4axNx3z9U90LN4qXNTTeaVhNKNjdV/ X-Received: by 2002:adf:dd4a:0:b0:2c5:5315:a7a7 with SMTP id u10-20020adfdd4a000000b002c55315a7a7mr12459287wrm.32.1677217891562; Thu, 23 Feb 2023 21:51:31 -0800 (PST) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id f18-20020adffcd2000000b002c59e001631sm11704055wrs.77.2023.02.23.21.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 21:51:30 -0800 (PST) From: Christoph Muellner To: gcc-patches@gcc.gnu.org, Kito Cheng , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Philipp Tomsich , Jeff Law , Cooper Qu , Lifang Xia , Yunhai Shang , Zhiwei Liu Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH v3 00/11] RISC-V: Add XThead* extension support Date: Fri, 24 Feb 2023 06:51:16 +0100 Message-Id: <20230224055127.2500953-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, KAM_MANYTO, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_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.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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758690536880617435?= X-GMAIL-MSGID: =?utf-8?q?1758690536880617435?= From: Christoph Müllner This series introduces support for the T-Head specific RISC-V ISA extensions which are available e.g. on the T-Head XuanTie C906. The ISA spec can be found here: https://github.com/T-head-Semi/thead-extension-spec This series adds support for the following XThead* extensions: * XTheadBa * XTheadBb * XTheadBs * XTheadCmo * XTheadCondMov * XTheadFMemIdx * XTheadFmv * XTheadInt * XTheadMac * XTheadMemIdx * XTheadMemPair * XTheadSync All extensions are properly integrated and the included tests demonstrate the improvements of the generated code. The series also introduces support for "-mcpu=thead-c906", which also enables all available XThead* ISA extensions of the T-Head C906. All patches have been tested and don't introduce regressions for RV32 or RV64. The patches have also been tested with SPEC CPU2017 on QEMU and real HW (D1 board). Support patches for these extensions for Binutils, QEMU, and LLVM have already been merged in the corresponding upstream projects. Changes in v3: - Bugfix in XTheadBa - Rewrite of XTheadMemPair - Inclusion of XTheadMemIdx and XTheadFMemIdx Christoph Müllner (9): riscv: Add basic XThead* vendor extension support riscv: riscv-cores.def: Add T-Head XuanTie C906 riscv: thead: Add support for the XTheadBa ISA extension riscv: thead: Add support for the XTheadBs ISA extension riscv: thead: Add support for the XTheadBb ISA extension riscv: thead: Add support for the XTheadCondMov ISA extensions riscv: thead: Add support for the XTheadMac ISA extension riscv: thead: Add support for the XTheadFmv ISA extension riscv: thead: Add support for the XTheadMemPair ISA extension moiz.hussain (2): riscv: thead: Add support for the XTheadMemIdx ISA extension riscv: thead: Add support for the XTheadFMemIdx ISA extension gcc/common/config/riscv/riscv-common.cc | 26 + gcc/config/riscv/bitmanip.md | 52 +- gcc/config/riscv/constraints.md | 43 + gcc/config/riscv/iterators.md | 4 + gcc/config/riscv/peephole.md | 56 + gcc/config/riscv/riscv-cores.def | 4 + gcc/config/riscv/riscv-opts.h | 29 + gcc/config/riscv/riscv-protos.h | 28 +- gcc/config/riscv/riscv.cc | 1090 +++++++++++++++-- gcc/config/riscv/riscv.h | 8 +- gcc/config/riscv/riscv.md | 169 ++- gcc/config/riscv/riscv.opt | 3 + gcc/config/riscv/thead.md | 351 ++++++ .../gcc.target/riscv/mcpu-thead-c906.c | 28 + .../gcc.target/riscv/xtheadba-addsl.c | 55 + gcc/testsuite/gcc.target/riscv/xtheadba.c | 14 + gcc/testsuite/gcc.target/riscv/xtheadbb-ext.c | 20 + .../gcc.target/riscv/xtheadbb-extu-2.c | 22 + .../gcc.target/riscv/xtheadbb-extu.c | 22 + gcc/testsuite/gcc.target/riscv/xtheadbb-ff1.c | 18 + gcc/testsuite/gcc.target/riscv/xtheadbb-rev.c | 45 + .../gcc.target/riscv/xtheadbb-srri.c | 21 + gcc/testsuite/gcc.target/riscv/xtheadbb.c | 14 + gcc/testsuite/gcc.target/riscv/xtheadbs-tst.c | 13 + gcc/testsuite/gcc.target/riscv/xtheadbs.c | 14 + gcc/testsuite/gcc.target/riscv/xtheadcmo.c | 14 + .../riscv/xtheadcondmov-mveqz-imm-eqz.c | 38 + .../riscv/xtheadcondmov-mveqz-imm-not.c | 38 + .../riscv/xtheadcondmov-mveqz-reg-eqz.c | 38 + .../riscv/xtheadcondmov-mveqz-reg-not.c | 38 + .../riscv/xtheadcondmov-mvnez-imm-cond.c | 38 + .../riscv/xtheadcondmov-mvnez-imm-nez.c | 38 + .../riscv/xtheadcondmov-mvnez-reg-cond.c | 38 + .../riscv/xtheadcondmov-mvnez-reg-nez.c | 38 + .../gcc.target/riscv/xtheadcondmov.c | 14 + .../riscv/xtheadfmemidx-fldr-fstr.c | 58 + .../gcc.target/riscv/xtheadfmemidx.c | 14 + .../gcc.target/riscv/xtheadfmv-fmv.c | 24 + gcc/testsuite/gcc.target/riscv/xtheadfmv.c | 14 + gcc/testsuite/gcc.target/riscv/xtheadint.c | 14 + .../gcc.target/riscv/xtheadmac-mula-muls.c | 43 + gcc/testsuite/gcc.target/riscv/xtheadmac.c | 14 + .../gcc.target/riscv/xtheadmemidx-ldi-sdi.c | 72 ++ .../riscv/xtheadmemidx-ldr-str-32.c | 23 + .../riscv/xtheadmemidx-ldr-str-64.c | 53 + .../gcc.target/riscv/xtheadmemidx-macros.h | 110 ++ gcc/testsuite/gcc.target/riscv/xtheadmemidx.c | 14 + .../gcc.target/riscv/xtheadmempair-1.c | 98 ++ .../gcc.target/riscv/xtheadmempair-2.c | 84 ++ .../gcc.target/riscv/xtheadmempair-3.c | 29 + .../gcc.target/riscv/xtheadmempair.c | 13 + gcc/testsuite/gcc.target/riscv/xtheadsync.c | 14 + 52 files changed, 3048 insertions(+), 124 deletions(-) create mode 100644 gcc/config/riscv/thead.md create mode 100644 gcc/testsuite/gcc.target/riscv/mcpu-thead-c906.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadba-addsl.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadba.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-ext.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-extu-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-extu.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-ff1.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-rev.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb-srri.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbb.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbs-tst.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadbs.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcmo.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mveqz-imm-eqz.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mveqz-imm-not.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mveqz-reg-eqz.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mveqz-reg-not.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mvnez-imm-cond.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mvnez-imm-nez.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mvnez-reg-cond.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov-mvnez-reg-nez.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadcondmov.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadfmemidx-fldr-fstr.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadfmemidx.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadfmv-fmv.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadfmv.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadint.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmac-mula-muls.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmac.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmemidx-ldi-sdi.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmemidx-ldr-str-32.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmemidx-ldr-str-64.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmemidx-macros.h create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmemidx.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmempair-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmempair-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmempair-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadmempair.c create mode 100644 gcc/testsuite/gcc.target/riscv/xtheadsync.c