| Message ID | 315d8694-d234-4c20-aead-10a732c0db0f@oss.qualcomm.com |
|---|---|
| State | Committed |
| Commit | 654fb68cb70ca96d27792cc7e039e2eb6a3fa9d5 |
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6767A4BA2E0F for <patchwork@sourceware.org>; Fri, 9 Oct 2026 12:45:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6767A4BA2E0F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=DOOiMtFv; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=H7FW7k2a X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 14EC04BA5435 for <gcc-patches@gcc.gnu.org>; Fri, 9 Oct 2026 12:44:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 14EC04BA5435 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oss.qualcomm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 14EC04BA5435 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791549891; cv=none; b=nrFBALqf9JV/S9oyUZOLkKoF//rVo4q05IpCGmF8aa4TsBYlNbQVNOciLgr5suH3znQYbYN8dg45iz2B21PskHQdnRA0/w5sqc92kd5Y2pk2HwN+1Af61Lnr2QeTlL/Yvc6qeOwFqH+VyNMHR8dA5dQqlidn+AKtwxJRVhrlVnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791549891; c=relaxed/simple; bh=nHOx10eR2RatYinM8nBHAxcAIA8BuF5l4H94QVWNd94=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: Subject:To; b=xqJw8TMMeyYt1a/oc+89enNQDGbxKqDuAqXvu0o2MTH019wuhCx223BaYegWDf+q/OCr3zwDWctuS8YrTJk/McpCJwyPQ8Od7r25l2/KHMX/vFKd/rxllgUqtdbj8yosZkt8WWzfOdJ/O2sQ6hYN+LaK7vgDHCTzoWihD0vDRdI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=DOOiMtFv; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=H7FW7k2a DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14EC04BA5435 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6998KLAC404755 for <gcc-patches@gcc.gnu.org>; Fri, 9 Oct 2026 12:44:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-type:date:from:message-id:mime-version:subject:to; s= qcppdkim1; bh=Rc6BAnOLHmgqVUouhyvoqerJb9zhSFi76vYaQUsiJ28=; b=DO OiMtFvBhyJ8zuZhxrY2n1qj5wqhSYKU3Mc4crijGzKdcmLPbvUQ17PORrRjy9He6 nqXn8v5io3bqW4c7uYJ7DKbhWPp4QYi3jvvwgAO3USZE5J0eQP1z8+4QBIrMtlZL ZA93xe8jXgOZjjxfHLvzI3eK5bbObXGR27LpiB4TsYg0k6YlrrC3VZqp7XqXFbfh /GnytgZESdzb0vkCr6buq5aPRFuGibx890mmJbMKMBf8HThdZv1eaTC4ESYmU+bm /tvOpZqDUUpC9+Cu1ugpKPIHkfEr/tVop+Px6Ux4TzjbuBgO/dba6k5LCE//EkWD ALmQ0McStLdSvrjTmA3g== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h6fxk3jyx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for <gcc-patches@gcc.gnu.org>; Fri, 09 Oct 2026 12:44:49 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-88679c4f94cso4864772b3a.0 for <gcc-patches@gcc.gnu.org>; Fri, 09 Oct 2026 05:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791549889; x=1792154689; darn=gcc.gnu.org; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:content-type:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Rc6BAnOLHmgqVUouhyvoqerJb9zhSFi76vYaQUsiJ28=; b=H7FW7k2aO/T+Koad+Xh9YZzvAnKzjVS8GsJm1czChUM7Haa9YqwUxadSyzaiviWIww S3M3fbzEJd1esi6JkEvrvMTYESiZzxIsP5rAB+F9U9KgONwJXRXGa6HsNEZeqTDsXhCh oKyKWOdUopLGrvxm6q3kOtuDYhIe70Ck2zeeI2JkZ8MAzi2HZapXbsdTuHkhF+or2qr8 dj5LrIl0BJ3gAUb9bMpaEeIgqtuLfcdN87TTAYSOUiGPoXDH8c3Rp43XUiBDI+zPzGs8 4lZnO3ZpYjuRY6mBfnGL1/JtxzN+g7Oe8IOfuY0Sy19cYMmvxxcdrbVuAusl6DvytHB/ /cLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791549889; x=1792154689; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:content-type:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Rc6BAnOLHmgqVUouhyvoqerJb9zhSFi76vYaQUsiJ28=; b=iOPgU/dIKkuZCdn/vIaYqDbi+AGpjvWMTT36OuPdBd3X5rx6GbX5nnK3/LgDpWilua En3khco1F/CHqG0aMgt6oeSvwXXj92tkq8QNil2ONHZEaAVG1qAMbhrTH3h4buXAjbWw sf2Tl1g++FsOaGy4tuAB5BUjPMNkttEoG/QyVIphXe31ld3jW9Zf+PupBIkxZg7k4Djc ABMC9ZlA+hD9YiZj9gLXilw/CW6xi2J4iq0IadA6I5GFsZTPhZWvJcpKKJiDAmVNCvJo uvVd8+cRr3qXPgt1/Js3keyDKVCd95kN3RwhUxE876dvoez+7UxU2bO0Lp3oO21CyxTs y6iw== X-Gm-Message-State: AFuF++mVdwXPIRx74ey8WKds/LBCDECi0ogwceeY4ON62Tsk3+Tg7TKU mj+eYJbkHYa1oEgNXD4PpwuJdvGqgG8430RZUQOz58t3BXB4EgJaCNoXFZE7fU+ULUpsbIXFCR8 cgR4IOBcX2/23ohgR0EVY4y8hBdtShoUOe3swQkQ43IUCnpkRELMST/uCObmnlWIopXzP X-Gm-Gg: AYBFou30PRV5RYfrsVOnlnYns66VKrIyYWaF5N8q9nojL3zOmAgHrmlIsmDuF/k1/no W2DtEszk8itAt8+ktFbotYRwjEY/ad+ZLSTnU6O/xYTKrUK+GkopWaC/POroLbcptO5O20asnXn S0/802JEWWyTlVEB1HEN5QIcUiXsDJgNDmbGwBO1t1gq6K7UXBbGQyBM4kOnwGkiVz7jgYD6fSn +wAfikpBTEyoub6egwUyJBDMhmiWtXhJYvZQT9wtAf0oHm4Q/EckJuF8+0cO7jmkxZK9Wdm9xHu 8+huZxskVQOuAfFNZwb73D9q5WDWyBdP6skwzHsEjl8+92KUTrLKcncuMGrpNFDWI184VRbhteO arHepfiF8D8kfkg== X-Received: by 2002:a05:6a00:4519:b0:883:71f6:609 with SMTP id d2e1a72fcca58-897c76e160emr1314090b3a.40.1791549888583; Fri, 09 Oct 2026 05:44:48 -0700 (PDT) X-Received: by 2002:a05:6a00:4519:b0:883:71f6:609 with SMTP id d2e1a72fcca58-897c76e160emr1314064b3a.40.1791549887671; Fri, 09 Oct 2026 05:44:47 -0700 (PDT) Received: from [172.31.0.30] ([136.38.201.137]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-896c41bb223sm903446b3a.41.2026.10.09.05.44.45 for <gcc-patches@gcc.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Oct 2026 05:44:46 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------d2R0I9ea6sYQ20Gu273KSyXl" Message-ID: <315d8694-d234-4c20-aead-10a732c0db0f@oss.qualcomm.com> Date: Fri, 9 Oct 2026 06:43:23 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Jeff Law <jeffrey.law@oss.qualcomm.com> Subject: [committed][H8] Fix length computation for HImode shift left by 2^n for H8/SX To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org> X-Authority-Analysis: v=2.4 cv=fKesTpae c=1 sm=1 tr=0 ts=6ac8e1c1 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=asGLMfRmzhnGNxaIYohjRg==:17 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=r77TgQKjGQsHNAKrUKIA:9 a=pe3te7S2TkYHRpMg5d8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=hkmKMxuO7PbvHoCZw5wA:9 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-GUID: VIBiPkvqMqu03Qr-Na_B2qxUBTIGBtwV X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA5MDA1MCBTYWx0ZWRfX0QqzAgCUMapT SzUOsUQNF24Y8b+YlCI3H8umnHGSeNWSpWyQZcEM1/BmLdGXX8QVLH9GdhyTH5mmWteqREnmyaH Vq0vWGzGfOOM0GsV0/gQGrpLFfhzXOM= X-Proofpoint-ORIG-GUID: VIBiPkvqMqu03Qr-Na_B2qxUBTIGBtwV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA5MDA1MCBTYWx0ZWRfX2cr/VOXeinRV zQixnr6oJcpmvTabz39WtPYBOQfSj9QiTmBa16keH2bOdzx+fN3n5iJ/YHTgPDsVxwzkyggNymW LF5L3BouCNMXFDYRvdCaveTSOIeiAl2ZcHkWMcDC51Yp18ihpMBGKHEk7QpoKCq+PVyYank5NKo gvZOpv6xBALGWr4mWbyep8y7ae91UgZj02L1RkOUwSRTSwUTSfoC0kLdGhn1kA6PgZlWn5nS+XS U2QKNKHijK2NCOl1RPXL3jyDCUiU44jE/X7T4iyElFo6jBTDQegQkUkpLfBjYu2DMtkKvPtPa72 Cql+7D53a17IlMBpJ7PdRTnNvd0YIPLTqOhf8DBQt/dpIXxBTzafWQ1tXTeA68h0t5xhhk/IPNR oRNatvHul1GNqnVGwF6skmLmv9DO3bv0yv2kDNR1WcqYJ/PZ+EnuHZqf56WjJYpYu+a9RVXY9Nq MasbMcvLcp/fZLmEnMA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-09_03,2026-10-08_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610020000 definitions=main-2610090050 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
[committed,H8] Fix length computation for HImode shift left by 2^n for H8/SX
|
|
Commit Message
Jeff Law
Oct. 9, 2026, 12:43 p.m. UTC
One or more changes in the last week or so twiddled code generation in
ways that triggered this failure:
h8300-sim/-msx/-mint32: gcc: gcc.dg/torture/pr69714.c -O1 execution test
This was ultimately tracked down to a conditional branch which the
compiler thought could reach its target, but in fact the target was a
couple bytes too far away. Naturally this was a mis-computation of the
length HImode ashift by 8 positions, but only for the H8/SX variant.
Given this was clearly a bug in the H8 target, I didn't bother to chase
down the offending commit.
The H8/SX variant has more compact & efficient ways to express a shift
by a power of 2 and the length computations know about those compact
forms. But when we have a "shift special" we're not using those more
compact and efficient forms as we emit an assembly string directly. So
that special length computation adjustment for H8/SX is simply wrong.
Avoiding it for the "shift special" case fixes things just fine and the
correctness regression goes away. It does not fix any other failures on
the H8/SX port.
Pushing to the trunk.
jeff
commit 654fb68cb70ca96d27792cc7e039e2eb6a3fa9d5
Author: Jeff Law <jeffrey.law@oss.qualcomm.com>
Date: Fri Oct 9 06:40:43 2026 -0600
[H8] Fix length computation for HImode shift left by 2^n for H8/SX
One or more changes in the last week or so twiddled code generation in ways
that triggered this failure:
h8300-sim/-msx/-mint32: gcc: gcc.dg/torture/pr69714.c -O1 execution test
This was ultimately tracked down to a conditional branch which the compiler
thought could reach its target, but in fact the target was a couple bytes too
far away. Naturally this was a mis-computation of the length HImode ashift by
8 positions, but only for the H8/SX variant. Given this was clearly a bug in
the H8 target, I didn't bother to chase down the offending commit.
The H8/SX variant has more compact & efficient ways to express a shift by a
power of 2 and the length computations know about those compact forms. But
when we have a "shift special" we're not using those more compact and efficient
forms as we emit an assembly string directly. So that special length
computation adjustment for H8/SX is simply wrong. Avoiding it for the "shift
special" case fixes things just fine and the correctness regression goes away.
It does not fix any other failures on the H8/SX port.
gcc/
* config/h8300/h8300.cc (compute_a_shift_length): Do not do any special
length adjustment for H8/SX for SHIFT_SPECIAL.
diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc index ad714f57d66..1598a86996e 100644 --- a/gcc/config/h8300/h8300.cc +++ b/gcc/config/h8300/h8300.cc @@ -4340,8 +4340,11 @@ compute_a_shift_length (rtx operands[3], rtx_code code) /* Fall through. */ case SHIFT_INLINE: - /* H8/SX has a richer set of logical shifts. */ + /* H8/SX has a richer set of logical shifts, but do not + override the length computation if we're using a SHIFT_SPECIAL + sequence as those may not exploit the H8/SX special shifts. */ if (TARGET_H8300SX + && info.alg == SHIFT_SPECIAL && (code == ASHIFT || code == LSHIFTRT)) return (exact_log2 (n) >= 0) ? 2 : 4;