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: 1783735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Es2LDgyH; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QN3w22WTpz20dn for ; Fri, 19 May 2023 21:07:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4EFE4385841C for ; Fri, 19 May 2023 11:07:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4EFE4385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684494448; 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=Es2LDgyHdk7ON1UDzy+Dx5UigdchkGOsxry3e541JD/uuA2ElpF4cQ4DCFuyugibg AwF0niJBjFvbWSwm57Z6fWp7Qtbr/L+nBsVDPPf6673dih0VxEDpTZH2bw9SMQLXFh 8WuJFOMQnYIixF2g2ZmTRFNw/Af/L/qQshgBCXwk= 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-Google-Smtp-Source: ACHHUZ7wHBiRFNIyTjjrTvsAa4ae00ekgEiGIW27PfTfA3qLHzTzZLfmH2Oh3BcB2YepGzuJo3gnXQ== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 } } */