From patchwork Wed Jun 12 03:06:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1946623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256 header.s=default header.b=gFH2FAEe; dkim-atps=neutral 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 4VzVpR08Dqz1ydW for ; Wed, 12 Jun 2024 13:07:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B39BC3858401 for ; Wed, 12 Jun 2024 03:07:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 45D9B3858408 for ; Wed, 12 Jun 2024 03:07:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45D9B3858408 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 45D9B3858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718161644; cv=none; b=Vs+jgeTOfNjBjmY9yWszIYD5Dpejc9y64vf3BzTwIKflyVHl4PDjOKet0+twAL4+2tLzpZ+hWkKgICXUDsweIyIuINMoiXpPmJbfq5O+sGv7nPo1Wh+AG9rRKZhaml8elouVwybsBmd0JbAx7Hk7ySaeVYi9LsdqP/gpMTPaGQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718161644; c=relaxed/simple; bh=zMHyhbMa4qfAyYeIHiXn7zJVCBWnOWsNW8qdO3esFvo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=p4eMT6vr3Le76iJoCem3b1jCFux/Vjxj3xgo6wrWk4SoZ9H17QmPE8NykWmbvVQZMMm+gwTuGEPcb1Gb6xB8DgHf2u6IVAyUlFPBAdmcfCyQPK3rvxgnBa6UvTBeSdDClm/a9vqyFpz/OrTvsloRAAVyxRXJZv+4Nc3neUb0eA8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1718161641; bh=zMHyhbMa4qfAyYeIHiXn7zJVCBWnOWsNW8qdO3esFvo=; h=From:To:Cc:Subject:Date:From; b=gFH2FAEe8NhpPb95JMZ7L4Cv5Let7zyH1VKXWGdcM/ZrWcwB/6t11B10qNT2f3DoK zBpbm1tu7EMjzhNo9SVwdX2LYtEgH/CXghtCFIqmJi7K5MKnACDo8fpeW4MtEr57wm hJNG1RliHM7fVUqgtz6FEDWs1KC/G6a0Tou+wgoM= Received: from stargazer.. (unknown [IPv6:240e:457:1000:50fa:93a1:b89e:3883:dfaf]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 1789B66EA2; Tue, 11 Jun 2024 23:07:16 -0400 (EDT) From: Xi Ruoyao To: gcc-patches@gcc.gnu.org Cc: chenglulu , i@xen0n.name, xuchenghua@loongson.cn, Xi Ruoyao Subject: [PATCH] LoongArch: Fix mode size comparision in loongarch_expand_conditional_move Date: Wed, 12 Jun 2024 11:06:43 +0800 Message-ID: <20240612030705.20797-1-xry111@xry111.site> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org We were comparing a mode size with word_mode, but word_mode is an enum value thus this does not really make any sense. (Un)luckily E_DImode happens to be 8 so this seemed to work, but let's make it correct so it won't blow up when we add LA32 support or add another machine mode... gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_expand_conditional_move): Compare mode size with UNITS_PER_WORD instead of word_mode. --- I've not fully tested this but it should be obvious. Ok for trunk? gcc/config/loongarch/loongarch.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index eb132f06c2e..bc3dd2b713e 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -5371,7 +5371,7 @@ loongarch_expand_conditional_move (rtx *operands) loongarch_emit_float_compare (&code, &op0, &op1); else { - if (GET_MODE_SIZE (GET_MODE (op0)) < word_mode) + if (GET_MODE_SIZE (GET_MODE (op0)) < UNITS_PER_WORD) { promote_op[0] = (REG_P (op0) && REG_P (operands[2]) && REGNO (op0) == REGNO (operands[2]));