From patchwork Fri May 19 11:07:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 96377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1147737vqo; Fri, 19 May 2023 04:07:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4KiiXqcAQDfK0DzsMxFSrpDKWLg7cSzpUmjv3d6hP7zS6H3XnB/Wab0eajnDl3bZLwc6sD X-Received: by 2002:a17:906:9b84:b0:965:ae3a:52c8 with SMTP id dd4-20020a1709069b8400b00965ae3a52c8mr1223820ejc.32.1684494478046; Fri, 19 May 2023 04:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684494478; cv=none; d=google.com; s=arc-20160816; b=0GL6zJGecwinMep3I+CC970Vawq7NuiC4AB8sU64skrKvE8WRRUsXrwrAX+jf3WLhU h/6AfVnuIb/dAkiLcBv7zQwZQ7Id4LXNw4trwi5PBsYJCMZd668q92hLXL7UqgXTXYYw mlXDUc9PN3IlyVA8w2av2wpxscNqk0sTXbVcVvYBIUuFPVnY5sE3fxIX2ahJ12o0etIF up5vhQFrXBXkcWsuLrFrTtPz5Gmd9toofltEhpGA46eA9MI1rIIN/17oEqfQ+Tx8Yhml 0BGYOt12JIy3ERd9ezt0ou6msmkgKdc+Etb5aVULYbeyJbMTuGzK6uVgfsForvz6Noic mIJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:to:subject:content-language:cc:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=gW4ea8BcCbl4G0I9J4k3Dcqzl/K88wk5YGhzkMmU2v0=; b=0kP8gT4a0ne3PTvtnJ7/zqnMchYzThoWDcN7scdw6SShwac31Jje+S3t0o91QOxM8Q tQZRGcKa+0ST12KAEd3XJZJK44+/5aubcNfVUqJQFz/EIyQRpI+taOK5FcYAzOMgRUxN BjB89n++iZiOG9a71vEI7D1CypI6i4J0CPzUzjgVL6a0webphyXSknntEP0oLjvQAoua B0Bje5mCHrKHSkAtc/1FTjtCgzR4S9SNgLMy1p6NyFdlpKvAR+bjYToqMs/atrCjmfql yP4zH0zBktawM+09/oaC9GzjNBjKebrxumWxgHBsFjqw2/W1wItqAvbE0AWNSP9qXMQ6 ofdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qspbZdHE; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 30-20020a170906009e00b00965c32cb77asi3063087ejc.229.2023.05.19.04.07.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 04:07:58 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qspbZdHE; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AC1538555A4 for ; Fri, 19 May 2023 11:07:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AC1538555A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684494472; bh=gW4ea8BcCbl4G0I9J4k3Dcqzl/K88wk5YGhzkMmU2v0=; h=Date:Cc:Subject:To:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=qspbZdHEVKlgMackZbNqS55j84j7BKP/448QkP+zlUZZp/BD8/B+OBh1r3BBc5EWy 5UcXidIawadPCOKSr41/iyTW/TUzffDEkitzw1lJuPorVNN4SE6UQxDb1358xw+tCJ 3owH0+hQTMmDyqEzdAhBKNlHY9qz+G6oiSPSATPA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 6ADA03858D38 for ; Fri, 19 May 2023 11:07:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ADA03858D38 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-510c734fa2dso1451143a12.0 for ; Fri, 19 May 2023 04:07:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684494425; x=1687086425; h=content-transfer-encoding:to:subject:from:content-language:cc :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gW4ea8BcCbl4G0I9J4k3Dcqzl/K88wk5YGhzkMmU2v0=; b=a4BjJxDamrvq28HFdns0e3dTkI8Zi9h+XW2zOovAk+BHCOOZ04dbbyXFyCb8sQHUs2 V8SmkwVIfqL6fXVqjBHBC3Olo+8iVaeH39YuRUkgQyQE8f3hFM2235EDNN8CUXix0s12 acAL1peq1DZ0QCFMtpMA63itHOnv7FuaeRagITHD/I4Pbx8ECpA8zWp55JrB3Vt8VDFr lnarhnW4U9fn6ELE7AmKgnPDaXibM4LD3fODzZZd9G+B0pKvocehvrf2twgegMPTpmtI ah2BtccVlIP9X8QTFKnZoJa9uJUZICWb8ws1zDtdvBvmDlF6OtRBnRigxmkNls6dGcY+ SHvw== X-Gm-Message-State: AC+VfDzi5SmAhfNupvQq+uJ3ecB2YJjA9VbSpwerZ8aSyQfvQZhw3KQq bdvnq7zGHrc2Go7XsFLIvkJtm2LfEM4= X-Received: by 2002:a05:6402:1603:b0:4ad:738b:6706 with SMTP id f3-20020a056402160300b004ad738b6706mr2164162edv.2.1684494424594; Fri, 19 May 2023 04:07:04 -0700 (PDT) Received: from [192.168.1.23] (ip-046-005-130-086.um12.pools.vodafone-ip.de. [46.5.130.86]) by smtp.gmail.com with ESMTPSA id c17-20020aa7d611000000b004fbdfbb5acesm1565632edr.89.2023.05.19.04.07.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 May 2023 04:07:04 -0700 (PDT) Message-ID: <77a010cf-b9c3-7f7f-06cc-393fbe8aff53@gmail.com> Date: Fri, 19 May 2023 13:07:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: rdapp.gcc@gmail.com Content-Language: en-US Subject: [PATCH] RISC-V: Allow more loading of const vectors. To: gcc-patches , Kito Cheng , "juzhe.zhong@rivai.ai" , palmer X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: , X-Patchwork-Original-From: Robin Dapp via Gcc-patches From: Robin Dapp Reply-To: Robin Dapp 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?1766320481733302899?= X-GMAIL-MSGID: =?utf-8?q?1766320481733302899?= Hi, this fixes a rebase oversight regarding the loading of vector constants. Added another test to properly catch that in the future. Regards Robin gcc/ChangeLog: * config/riscv/riscv.cc (riscv_const_insns): Remove else. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c: New test. * gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c: New test. --- gcc/config/riscv/riscv.cc | 2 +- .../gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c | 6 ++++++ .../gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 0d1b83f4315..0e874f0604d 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -1295,7 +1295,7 @@ riscv_const_insns (rtx x) The Wc0, Wc1 constraints are already covered by the vi constraint so we do not need to check them here separately. */ - else if (TARGET_VECTOR && satisfies_constraint_vi (x)) + if (TARGET_VECTOR && satisfies_constraint_vi (x)) return 1; /* TODO: We may support more const vector in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c new file mode 100644 index 00000000000..631ea3bf268 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c99 -march=rv32gcv -mabi=ilp32d -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -fno-builtin" } */ + +#include "vmv-imm-template.h" + +/* { dg-final { scan-assembler-times "vmv.v.i" 32 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c new file mode 100644 index 00000000000..7ded6cc18d2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c99 -march=rv64gcv -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -fno-builtin" } */ + +#include "vmv-imm-template.h" + +/* { dg-final { scan-assembler-times "vmv.v.i" 32 } } */