From patchwork Fri Nov 10 03:33:16 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: 163763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864580vqs; Thu, 9 Nov 2023 19:33:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIDorxinzaEO/TNjckEH8aBuMpsL/KFz18VzcRBFCxhErApRmiCSFSJbwgCCr0EdITWlwg X-Received: by 2002:a05:6214:5191:b0:66d:1eae:4849 with SMTP id kl17-20020a056214519100b0066d1eae4849mr8881897qvb.8.1699587231207; Thu, 09 Nov 2023 19:33:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699587231; cv=pass; d=google.com; s=arc-20160816; b=Okr3g0f9k6+VoYpezT6bMuGnMY95xA7QBW17s8u7Mb2TfjkiNgw3YDz/i+K7xI3Mru ekXw9elRD1f1SNqhymJNngorZ+rAYGpB81l6lwh4xIIIP5CH0E5SycFeGukSEKYIgPTq 0HCUXqjta//jAkxZ/gQdLEZaNcTgREn/ifrkBig1CBLWjDL3kKzUPwCvpANk94awz9kr aXKffTozHN+3H93ShrksHABA98nRzYpJN2nrHaAXxnJqEHSzJfUXPEUIF4vJfTBGcv6p MjqnZBOVvRj4dHzKz8NtSJv0paE2meeqJENq+4E/4PTSJWXg0uLuRKpJZqhbHtW0iwx0 jI4g== 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=M18ieW0j3yJQOBIvgyFiJV0zfEYNNJrTqtTmM0+tb5M=; fh=12MRPJmZ1mgDpHqWoogMKqnaGRGM2b7lcuJroqfjJiw=; b=LRTry+oxSP2D65AhrNDx/ghnHT7IG9vWrfep2DqFGBUgYFhOLNgvJLznrTYzTnXn0w dN5gYMV3k8HxHnH79QnffpwSd6tFZ3fbblN55t7yEBzEqqJu9jblGv7oxshpMVaS+AUA giThzD0QxfUtjOwaE9NYk/puIQIgIOcYpOvOPZTdtU0gcODJlf6lgDYcQfu4Zv9TWTDo KiQ5YWpmErXOkf7wUaE55JvuzXZpvGhhiS9IONhGi3UKY+dKHmmu9lybK/bdaxlpXhy3 D9khaYH/mcxbt/dEmpQNZyV/GtXwYPr7zq4BobREBxIP1fruhyCSQ666NHAmWLsPeBhY MCZg== 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 n8-20020a0cfbc8000000b0065b1c33dfcfsi3994975qvp.352.2023.11.09.19.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:33:51 -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 F211D385781F for ; Fri, 10 Nov 2023 03:33:50 +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 641703858D1E for ; Fri, 10 Nov 2023 03:33:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 641703858D1E 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 641703858D1E 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=1699587207; cv=none; b=W8O5xpeTocLtPWhEO/fK/aq8LsGoK3augHzawzS+8hI5PPeK6aCS1hLUXcX/tlPhi97IJaHGy0Z/801wK2Q4wBcIGdDzLZd7RvmqM6xkYgK7mcuLwaxZgnAETasDMI6Geip7xx5omgP+Ovgq6Ohi76W9ZudIJpa9hQbzUYxZvLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699587207; c=relaxed/simple; bh=GxcZqOSUMJbqFvv0eaSv5JurrNoHpTaI/2XPaiEp8nc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=W+CA3z0ZH5csnkJP9PXbZ0R5Tcxj3ObCdzsNBrmTBMJcVw+e9hjO6MHinHngHWenb4vrmlgRKG+myr+dJ4pjS1GHSeolNug1HJrFWrA9/vTkwLAGn8WxfKU3q3T7uyJskWkswS2IW79kzp5JgDd66yfLzh6GxowENdlhxdw3jtk= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp91t1699587198t2scvpix Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 10 Nov 2023 11:33:17 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: kwdSLf7XDNIDMLNheVlESR2KobX1xg9HU/e/H31D2OOnhqvr7FfI4TC3ZedPv tOby+Ee6AgVb3ohc2G10eyg9lPEoMynGypT6aqynG50QvkHiNrJgNCGlYTRNWqVHm5NkvaF /UF81ryt1s95uCM6V+FstzzdYr7oZZNpQE3GuTON9BdGkKGTPdtDSiPsr75kJVBz9yVv9tH MwNdqOAghWHSn4niEV6cbeaKngyMqbSklJsc+lBOkWOuAjrYFxnxgaA5rQotjlFbipi9gtA 5KWBi/6kGlns3Ezc/6syI5kzXjA67FlekOlTec6FxnsXRXEg7ec4N9SwTrnGRswTLuYD9Pu VbVXdjZfLNmtY1AymLwDNwHD8PaORRylAmJc1XXs+3P0q1mQ1mmwUD8xZGN2xir3cdspkjF lYhapC8KlL8= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 17009949622200362041 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] RISC-V: Robustify vec_init pattern[NFC] Date: Fri, 10 Nov 2023 11:33:16 +0800 Message-Id: <20231110033316.1126689-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.2 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.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: 1782146380335638972 X-GMAIL-MSGID: 1782146380335638972 Although current GCC didn't cause ICE when I create FP16 vec_init case with -march=rv64gcv (no ZVFH), current vec_init pattern looks wrong. Since V_VLS FP16 predicate is TARGET_VECTOR_ELEN_FP_16, wheras vec_init needs vfslide1down/vfslide1up. It makes more sense to robustify the vec_init patterns which split them into 2 patterns (one is integer, the other is float) like other autovectorization patterns. gcc/ChangeLog: * config/riscv/autovec.md (vec_init): Split patterns. --- gcc/config/riscv/autovec.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 33722ea1139..868b47c8af7 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -373,7 +373,19 @@ ;; ------------------------------------------------------------------------- (define_expand "vec_init" - [(match_operand:V_VLS 0 "register_operand") + [(match_operand:V_VLSI 0 "register_operand") + (match_operand 1 "")] + "TARGET_VECTOR" + { + riscv_vector::expand_vec_init (operands[0], operands[1]); + DONE; + } +) + +;; We split RVV floating-point because we are going to +;; use vfslide1down/vfslide1up for FP16 which need TARGET_ZVFH. +(define_expand "vec_init" + [(match_operand:V_VLSF 0 "register_operand") (match_operand 1 "")] "TARGET_VECTOR" {