From patchwork Thu Jul 11 05:45:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xu X-Patchwork-Id: 1959097 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=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WKNy41dKCz1xqj for ; Thu, 11 Jul 2024 15:46:18 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0343E385840A for ; Thu, 11 Jul 2024 05:46:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmja2lje4os43os4xodqa.icoremail.net (zg8tmja2lje4os43os4xodqa.icoremail.net [206.189.79.184]) by sourceware.org (Postfix) with ESMTP id 49C16385C6C8 for ; Thu, 11 Jul 2024 05:45:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49C16385C6C8 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49C16385C6C8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=206.189.79.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720676744; cv=none; b=wnDPewx/MHLmGILYaK07hhxnkRBuVqD4bjeN33RLpGd2sogJibwa8uKG4uXN/1lOF9b+1epbta7qwia0mEoszFA6UPRImp7dVZd7woAEtNvLTTMFiqEXpZjQUnr1qvfx0FoGJK3jPSYjKE/3iD6F5LIBuFmihKT2mOvtbMThIJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720676744; c=relaxed/simple; bh=gK/VTNMK7xMuRUV8hi+jqaa/oTroU0x8A2XqBbsFH0Q=; h=From:To:Subject:Date:Message-Id; b=D2c21cHCFAJPBwZMITAcztvg9iYQsahnMP1AaJB5rZMnLfjbNxAt/lpwOPyeeNH00ieVJ6TQ2TesCkWVNUOM81dZlxHmfopnVw/xQDsD8Pv8CNXjlgFMjZP+t70jY251xopTkrXTm/qOCfAqhL62ycz/BchW1vkqEaaflWO00rg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from host014-ubuntu-1804.lxd (unknown [10.12.130.31]) by app2 (Coremail) with SMTP id TQJkCgBHWryBcY9mvxoVAA--.17389S4; Thu, 11 Jul 2024 13:45:38 +0800 (CST) From: Li Xu To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, juzhe.zhong@rivai.ai, rdapp.gcc@gmail.com, xuli Subject: [PATCH] RISC-V: Disable misaligned vector access in hook riscv_slow_unaligned_access Date: Thu, 11 Jul 2024 05:45:35 +0000 Message-Id: <20240711054535.17904-1-xuli1@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: TQJkCgBHWryBcY9mvxoVAA--.17389S4 X-Coremail-Antispam: 1UD129KBjvJXoWrZry5Kw48CrykJrW5Zw48Xrb_yoW8Jr15pF yUGr4jv345ZFnxu3W7tayxKF45X3yrWr13tws3Zr1UZa1kAFZxJFZIqw1rZr9FgFWku347 uFySkF1avw45K37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk214x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: 50xoxi46hv4xpqfrz1xxwl0woofrz/ X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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~incoming=patchwork.ozlabs.org@gcc.gnu.org From: xuli The reason is that in the following code, icode = movmisalignv8si has already been rejected by TARGET_VECTOR_MISALIGN_SUPPORTED, but it is allowed by targetm.slow_unaligned_access,which is contradictory. (((icode = optab_handler (movmisalign_optab, mode)) != CODE_FOR_nothing) || targetm.slow_unaligned_access (mode, align)) misaligned vector access should be enabled by -mno-vector-strict-align option. PR Target/115862 gcc/ChangeLog: * config/riscv/riscv.cc (riscv_slow_unaligned_access): Disable vector misalign. Signed-off-by: Li Xu --- gcc/config/riscv/riscv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 61fa74e9322..87270fd7af4 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -10271,7 +10271,7 @@ riscv_cannot_copy_insn_p (rtx_insn *insn) static bool riscv_slow_unaligned_access (machine_mode, unsigned int) { - return riscv_slow_unaligned_access_p; + return !TARGET_VECTOR && riscv_slow_unaligned_access_p; } static bool