From patchwork Fri May 5 14:06:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 90453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp432120vqo; Fri, 5 May 2023 07:07:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LgZjigIIP6E5wH5cI9PjegqFvURS+x0GW6XHHxY3/oMnmkpljPAKPduIXN+YRzvjcdXcF X-Received: by 2002:a17:907:6d01:b0:957:29e5:1695 with SMTP id sa1-20020a1709076d0100b0095729e51695mr1307776ejc.65.1683295643422; Fri, 05 May 2023 07:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683295643; cv=none; d=google.com; s=arc-20160816; b=oIyxZDeNeh6NO633E/qBNI+GqSV2RdMueKoqAtZCBJxrqtChrebCIViZ0xkkzyzHoo 9oDIiTK3P0Z2zH7bBwXMS9w85JW/zJ2Afdqd3pLpRlVaalrZmw9aLkz3kNmSIvwrZ3O5 ieFQbkdkqBYNEJnXJt/Ea4LHb2JX/0Uu+YykH3pVMq+WgZKRYEZeDtkbmbYg8YLLob68 hScw/N5SeMcrH7wwtvsCQUmD6fTIJjlfPVIWTqJg5+BqNG3sqdeAIr/zaZGBpM1fUm4s F23yBh3K1zOcyAZNVnOkifv9/Oiz3rU+xiqVX0v0NDILG+TMKc5Zi/vaW7go0n9WpwKZ Ab+g== 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:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=eUnusv1EP4Q9RiLKRYRvXuIZzJxlFowJKkHM4Bq7Bgk=; b=rMYWLRIrzM6Zxh/igUY43aYzyGyq+T7b07rrPPAktoml0icaeHvQ7nyBTgZkabfA9m WmxHvU1ajmMpl7fM2mB2am3GhSjP0ZsVsafWl5K4UFo9Cz3IXhG0G90cJrEHDdkfJxA1 YYKRmDtNHJUq0GHoC4deKSMa1kqUwhF1XTDG6S2EE+UAufozVyMl+1ttgiGDZ7pbWjbB SqpNFvsqua2wIbrfrkTIDLyNborG6ZiVfTJSpcJicqBC4USh6zp/Yf0Z5JJ1TSBrFWKT zOshmxliup2tGEkGRDsXn79THWfa1qcVRy+XqHHLvIC9XWikdry1B++j4rqBqNsyKWXJ KA0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gv33-20020a1709072be100b0095f90da23b6si1333789ejc.506.2023.05.05.07.07.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 07:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 8F20638555BE for ; Fri, 5 May 2023 14:07:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) by sourceware.org (Postfix) with ESMTPS id 1B5A13858D35 for ; Fri, 5 May 2023 14:06:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B5A13858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp65t1683295607tqoa52m8 Received: from rios-cad5.localdomain ( [58.60.1.11]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 05 May 2023 22:06:46 +0800 (CST) X-QQ-SSF: 01400000000000F0Q000000A0000000 X-QQ-FEAT: 3M0okmaRx3gZA0I2OLcVgOqalFrHvScgYxgfcu1kb2JYR/a6HNXWshE3mSFPZ fd7hJd6O1SbByknE9omlsqbbXcgdBKfTilUwLn4TG5aI4Lkw7neVi/m6bbhzGUxsRmBgb9M 6zPHXZhFyuvXU/qSzIpwIt0SbqLTMU287zOab4bWHAy71NcPR+Wm568HSHFVTzeTv4bYyJw 00CYj4rDmlkwEjVfvD05an0q4Dn3qaa7bFKwsmKQ93GUjA0Pt9j4Mzioj/gFVaKUW+q1OZA 8mA1ZiOn1Uw/BBOEMhRs8dXh4at/z/DWw6gVcj4gZ6T4Xf5OKEiuCfxMU8TOp9w78jSrgKn XL9PxKie0Wdvrwn/9CdSFz8VUPC94Uk0qZBgr2X+MxUZ1/8qrtNjdZya6p0Z4tdmemBFTho X-QQ-GoodBg: 2 X-BIZMAIL-ID: 2160947104536246359 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, Juzhe-Zhong Subject: [PATCH V4] RISC-V: Enable basic RVV auto-vectorization support. Date: Fri, 5 May 2023 22:06:43 +0800 Message-Id: <20230505140643.1322399-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765063412442385908?= X-GMAIL-MSGID: =?utf-8?q?1765063412442385908?= From: Juzhe-Zhong This patch is depending on https://patchwork.sourceware.org/project/gcc/patch/20230504054544.203366-1-juzhe.zhong@rivai.ai/ Fix codes according to comments of Kito. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_get_arg_info): Move RVV type argument handling outside. --- gcc/config/riscv/riscv.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 1a35e02796d..8d3cd4261d2 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -3791,16 +3791,16 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum, info->gpr_offset = cum->num_gprs; info->fpr_offset = cum->num_fprs; + /* TODO: Currently, it will produce ICE for --param + riscv-autovec-preference=fixed-vlmax. So, we just return NULL_RTX here + let GCC genearte loads/stores. Ideally, GCC should either report + Warning message to tell user do not use RVV vector type in function + arg, or GCC just support function arg calling convention for RVV + directly. */ + if (riscv_v_ext_mode_p (mode)) + return NULL_RTX; if (named) { - /* TODO: Currently, it will produce ICE for --param - riscv-autovec-preference=fixed-vlmax. So, we just return NULL_RTX here - let GCC genearte loads/stores. Ideally, GCC should either report - Warning message to tell user do not use RVV vector type in function - arg, or GCC just support function arg calling convention for RVV - directly. */ - if (riscv_v_ext_mode_p (mode)) - return NULL_RTX; riscv_aggregate_field fields[2]; unsigned fregno = fpr_base + info->fpr_offset; unsigned gregno = gpr_base + info->gpr_offset;