From patchwork Fri Nov 17 13:48:00 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: 166180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp538338vqn; Fri, 17 Nov 2023 05:48:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFH47eQjLQAEgbZ6CpMngiRJtw5UI+yURBkMNdv8kT8Acas7tXgJd+wP9/o9HKRdWSPvNea X-Received: by 2002:a05:6358:6f90:b0:16b:c414:ae2 with SMTP id s16-20020a0563586f9000b0016bc4140ae2mr17194652rwn.8.1700228912698; Fri, 17 Nov 2023 05:48:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700228912; cv=pass; d=google.com; s=arc-20160816; b=OyMtpptn+qpLSHGyF0z0qwuDnihkYlKAhGtUQ6P1ATs2VzO/rNFXO7XYdBI7xIgB3w UyVAITBjYQ7DBR+vfHHjbX5K39RcYEaChUw9DC5yJdOqNDvQVXykazKgteJHudwrsoZZ NxychbgvqbKsxm3upAkkYe0XukGIhBJ7uWy0jbmRbmJGd40evzUdshCSMQmPbUMNcbkt Sm6HpzUifdqEYBykve9GsA2dwOj9aj+3VqB4hGkSGvibA3DmxUAfmYxgkRJl9Gw+ipyT XrO4Q9HtuXkdHOCTjujvMYF75tnufTay+iXl03s14Zjti0V6SDntRzwpFxGtOf6zMffA Oymg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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:arc-filter:dmarc-filter:delivered-to; bh=cGbZqEUJvOStGc/39PtObHKKr+KEFOSjHP45FlaFD4Q=; fh=12MRPJmZ1mgDpHqWoogMKqnaGRGM2b7lcuJroqfjJiw=; b=iMMm0DZM1qx256dBX3EnXd9RXfZDCcCCa+eU3P1iz6YYGZjylFg5AcaHk3UdhHo1gp q6XP3K73vkmjC9M1la9Diqm8s15aF5JHMdzxjFgSaw9/IIXcF5sFEDO+U9MsopgiKyPb YVzcadYZxL+YfUvxoVzUTiIGGT9GNTHeH1tGCcfMkAiFpqmybZUq6blJIa+yvcm6+rJk 7qJjb+RW5nZCepp6W4vQ6FVR+qPd8Hh9ERR7rfx3wpSzwnW8Mk+Yf4nM3f5ctxGBXSNf rdafDCNanUu9vXUAm++7PiyvSt74qW8oRcNAqxZaCSIJESyy8sZbWNue7V4M/0XvtgmQ qLVA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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 v14-20020a05622a130e00b004195f6ad06dsi1693197qtk.56.2023.11.17.05.48.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:48:32 -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; arc=pass (i=1); 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 38ABD3858C66 for ; Fri, 17 Nov 2023 13:48:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) by sourceware.org (Postfix) with ESMTPS id DF3873858D35 for ; Fri, 17 Nov 2023 13:48:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF3873858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DF3873858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=18.169.211.239 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700228890; cv=none; b=P9ngz/IH+wy1Zvv5KShy9uixnztbfdPA0Vm842AhA2ef8ew3ZCbifp8PjhWytkCpOJ7xOa3xQj2qaIuM4igXC04QLDdRTD3Ll3Dd8KgilAMLaQx/ncV9w0p2bGOFH9o9wHk6nbSxw7GyOi9YcK2xuCnWpMeg3VBDxd5zw1UliTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700228890; c=relaxed/simple; bh=vK8DBaS63zWpZSqho6UGl05acOAY/Twgrf8t2B5ApOQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=f9+unhA9/rKy5hRq5RqxF3kbZkNieXZX7gBLDR5Ps8i0/ZbYr63PWJrqL8d80KlFSwiFimLybhC2uwz8LlBBZ4DakLnCV1QlsIpFaDPKKoMWH/IPZSKWTlm2CQAjU4dVJ0UBhlogyclMEAyUsH2TtUvmZJwu1iLQOuFmN1zu5wA= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp66t1700228882tvyq24c7 Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 17 Nov 2023 21:48:01 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: kUim6XnhvqWQ+s9YmZctwTwmO9EB3vz1faefBQOUeR7K1tv9gRXP3lUUM8Q8m OGs+aaokU1XowHJFbWaDmsR6h1wTOvvQz55EuKa2SGMWMZKwOBXdcTQR9Q5BCu6u2ft5jOS 6IFGRFCASovZCekeINE6MNeaLxuVEcdA6SksPdcGgsu6oDDUA6koo1wwlEQHYcw64j2k3AH SxCoxURXAYH47EY22gEGl+21F9HYEAOJAg8tsJKxVjt7fygUdy5/WgpDaY6wQQkncKW6lt/ PpZvVzvbav92DnxZnVFsxc+Y9MhpxqY9VnCVgoqYZ9XufpKscAgKtKsKdIVk2dLUZ5/IURO +Lm1CJw78nM6rbwGu+2JQnrhnl38ga/fRYmWH1GoPH4QS/7imeEfKseDhY1D1z2NvfsgiyZ rpFPqNNBdEM= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 1186209888444501446 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Juzhe-Zhong Subject: [PATCH V2] RISC-V: Fix bug of tuple move splitter Date: Fri, 17 Nov 2023 21:48:00 +0800 Message-Id: <20231117134800.1004906-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=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEXHASH_WORD, KAM_DMARC_STATUS, KAM_SHORT, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782819232338399506 X-GMAIL-MSGID: 1782819232338399506 Fix segment fault on tuple move: bbl loader z 0000000000000000 ra 00000000000102ac sp 0000003ffffffaf0 gp 000000000001c0b8 tp 0000000000000000 t0 00000000000104a0 t1 000000000000000f t2 0000000000000000 s0 0000000000000000 s1 0000000000000000 a0 0000003ffffffb30 a1 0000003ffffffb58 a2 0000000000000000 a3 0000000000000000 a4 0000000000000000 a5 000000000001c340 a6 0000000000000004 a7 0000000000000004 s2 0000000000000000 s3 0000000000000000 s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000 s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000 t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000 pc 00000000000101aa va/inst 0000000000000004 sr 8000000200006620 User store segfault @ 0x0000000000000004 PR target/112561 gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_tuple_move): Fix bug. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr112561.c: New test. --- gcc/config/riscv/riscv-v.cc | 2 ++ .../gcc.target/riscv/rvv/autovec/pr112561.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 6a2009ffb05..91bb6ea520d 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -2148,6 +2148,8 @@ expand_tuple_move (rtx *ops) offset = ops[2]; } + if (fractional_p) + emit_vlmax_vsetvl (subpart_mode, ops[4]); if (MEM_P (ops[1])) { /* Load operations. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c new file mode 100644 index 00000000000..25e61fa12c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-options "-O3 -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -mcmodel=medlow" } */ + +int printf(char *, ...); +int a, b, c, e; +short d[7][7] = {}; +int main() { + short f; + c = 0; + for (; c <= 6; c++) { + e |= d[c][c] & 1; + b &= f & 3; + } + printf("%d\n", a); + return 0; +}