Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229024/?format=api
{ "id": 2229024, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229024/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/13f4cca8-c5bd-4179-b2f0-6f3d8a0640c5@oss.qualcomm.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<13f4cca8-c5bd-4179-b2f0-6f3d8a0640c5@oss.qualcomm.com>", "date": "2026-04-27T17:11:05", "name": "[to-be-committed,RISC-V,PR,target/124760] Promote SI to DI in some cases to encourage shNadd insns", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "84eb788e9bbac0099fd3dcc2d9f5c9564eebe8cd", "submitter": { "id": 92310, "url": "http://patchwork.ozlabs.org/api/1.1/people/92310/?format=api", "name": "Jeffrey Law", "email": "jeffrey.law@oss.qualcomm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/13f4cca8-c5bd-4179-b2f0-6f3d8a0640c5@oss.qualcomm.com/mbox/", "series": [ { "id": 501689, "url": "http://patchwork.ozlabs.org/api/1.1/series/501689/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501689", "date": "2026-04-27T17:11:05", "name": "[to-be-committed,RISC-V,PR,target/124760] Promote SI to DI in some cases to encourage shNadd insns", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501689/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229024/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229024/checks/", "tags": {}, "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=gqMju7t1;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=AK9Gojt8;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key,\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=gqMju7t1;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key,\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=AK9Gojt8", "sourceware.org; dmarc=none (p=none dis=none)\n header.from=oss.qualcomm.com", "sourceware.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=205.220.180.131" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g498Z5x9Sz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 03:11:41 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id A07CA4BB1C3E\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 17:11:39 +0000 (GMT)", "from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n by sourceware.org (Postfix) with ESMTPS id 00F824BA901E\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 17:11:09 +0000 (GMT)", "from pps.filterd (m0279873.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63RE0WTA2913809\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 17:11:09 GMT", "from mail-dy1-f199.google.com (mail-dy1-f199.google.com\n [74.125.82.199])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dt26xjgv5-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 17:11:09 +0000 (GMT)", "by mail-dy1-f199.google.com with SMTP id\n 5a478bee46e88-2eaed3d96d7so2435856eec.0\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 10:11:09 -0700 (PDT)", "from [172.31.0.17] ([136.38.201.137])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2e53d8b944bsm43884015eec.28.2026.04.27.10.11.06\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Mon, 27 Apr 2026 10:11:06 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org A07CA4BB1C3E", "OpenDKIM Filter v2.11.0 sourceware.org 00F824BA901E" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 00F824BA901E", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 00F824BA901E", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777309870; cv=none;\n b=pV+fPEw78ojvMwwbgmDeyUqduFGfM1WdSnguqS444Kk38p8zuBBl0Kcfe1aFmcX3TRvwu2K7hA9MwHw+Xna/x/99qhH+0BwZxtd404QLtIvi4FOU+1jb8TFiH5UngjBjTXTs7MceC8R9arGgVEBbAYOmGtIH5+WuI0r8FEN/HWY=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777309870; c=relaxed/simple;\n bh=Zg0u1FM1oMpWldJ4hAZUhHeYs0o3UIAoOqzTrdSb5c4=;\n h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From:\n To:Subject;\n b=M6IFFjmY3ZnxTx3KKaFzRi+1YDMu8vaT+p8Pe8ov5R7mPAB+4w/+s7rG5TUw3doTlI9NYBb0W+uiesVxGVEov4/UkDrqc7/8B5H0uL1rl8By+7AHdDIWMkLkdJPuF3VNYhYpb+KnUd4tVdCO5fSQx1gamp7gRAGubcU1ED289Xw=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n content-type:date:from:message-id:mime-version:subject:to; s=\n qcppdkim1; bh=XTCBxFFg9mOhCYiXzjkwmlLsaStJqxhER1cXzo81t1Y=; b=gq\n Mju7t1T36wdHN9BinKkuSlYGDqe4llwCOSwf/B13o1tb3s8h3Wuybq70qYJseHap\n kYRpduM86MbVc8wAtSq8HHJ2cNf0PzWNikwHAxD/QH7rHV9Dmkj6wcs3eKVQoMwM\n hsY8CQ2rH2DdEbyH/yqhW/ZcavxsiHz2s06KuYMjXq3mCtPe8vUcVV1fZ+hV+87o\n qAJUsMCv+Qw8rFxRm7IrMmT0nAJ2kZMX4wWL+jUEm7ZIRNWS+yY7Ycy4tbRLFXnV\n gjGVfksi66qLmOLqZ0nGwi3Q1pFXAOHTaJHTagN+eJqtMIEeWm4SdY68FRmI0v3/\n g9/CZXwP2NzddYZDDqxA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1777309868; x=1777914668; darn=gcc.gnu.org;\n h=subject:to:from:content-language:user-agent:mime-version:date\n :message-id:from:to:cc:subject:date:message-id:reply-to;\n bh=XTCBxFFg9mOhCYiXzjkwmlLsaStJqxhER1cXzo81t1Y=;\n b=AK9Gojt85I78XwV1r074JNl30Aa5/EKSzUnzdTWVxD8cF2hV44kJP8h3Ai3PbPEVge\n pQTYmieCaGuwiO3e/uR7AVxr/69DGS6zIS29wIHyY49cTBUPHGVgk+Z9GiD3D842yDjj\n SyypiJQtZUdAfP8Sp0RSrkVrJ4/vj0oN/9FP2H2OE6qjbNM6O2YMmoH7JsEcK7QjutBG\n 7ObVAsn1N1fM0qEwGRMGZyy2lcjEqM372TGSJXhx8wRPe4/tAd8TT5p0XGO7ArKTjzu7\n hCigUXIXSeaJs1t5+D76Wr3Goa+U3NnA+Zc0+8r63uPwFy/g2DCnUPv/b+1R7bIUNPaD\n ippw==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777309868; x=1777914668;\n h=subject:to:from:content-language:user-agent:mime-version:date\n :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=XTCBxFFg9mOhCYiXzjkwmlLsaStJqxhER1cXzo81t1Y=;\n b=lDxbOHlQcTO3dm+jIyCgr24LE/7tKsTXGLIEp5bgtq2QIKXDFUiUYiWTtAg0SQIb0J\n OWRius+N6P1ljxMOs1QlHk7/0FnWQtH4SSyWL83mXNJL3l1zQgPaE6vzjivwj3UI6q7m\n zlAIOkMyE6N3bPZviryXK/WAZtKUd5r/My6QrQ0yWShMkVLouTc3108MJ5FVFvMRvE39\n lG137d/K9/zUrtTILKoccGVRNg0JbWBmky3oOlNvAhWsalTP9A6X6bGALT8J4auCi07V\n T83pHae4tRXIkofLZ0jbevP+w84134E3NpdXxCrYObXti63yx2CqzkhjGNf6GyVGiEcb\n IEyA==", "X-Gm-Message-State": "AOJu0Yxd9dpS3QtfvuowX7QAsjUS35Yu/K74GF8+Z9hcW55fjgYPswFS\n zNRyTfS3h43ugriUbpx9tGka8yOIS1GCMLC5jIeMSQVTSU0J09Y1oVf9xvHfUW6mr3gXFxK93Ge\n CJm0ky5nuTJbgty+NLcg2E8kTTd7Sz3bCd/t+k/PP5v2uFoP5Z2IVoMgcE6aedHA4FbJQ", "X-Gm-Gg": "AeBDievXdo8FGWc30oHk8yGZewcH6n2i+KhWSpxw7p0lHXCBzrtgaKSZiZJ9jO28dwD\n P0w9IP+8iunle91Qq4tc0GhSyx1X3wYmbX3VeMUQXBxvEa402b1kNdOWqOdj0+Rx1q4+eeyimIE\n GoE4OmKpSISj5GEpigckf/OiTqbAuYDMS6//g0hgYLfgEi1ghFinVIGCrGXQdY0ZI+O4lr950wk\n V5Xamm3oDXP5grc71FxILtOqmLOaktW+rGl18L/B60MVhToz8Adzo4xbca6Ns17oY/CHpgm+diN\n lJigvgKF0q75AFy5uw7YqrFb4CIiRkIm3x6SaRtzAlerOBFKV7ouOaq7oKpxlCzy0Yr81mqqaoC\n TDL0QIWvrb4i/xf51zjS2P7OUN0GheGGFne7/4Hw9XFqQ3LxVOZ9y9oTZkK9E", "X-Received": [ "by 2002:a05:7300:e78d:b0:2de:3022:a459 with SMTP id\n 5a478bee46e88-2e478935dd3mr24353635eec.21.1777309867781;\n Mon, 27 Apr 2026 10:11:07 -0700 (PDT)", "by 2002:a05:7300:e78d:b0:2de:3022:a459 with SMTP id\n 5a478bee46e88-2e478935dd3mr24353572eec.21.1777309866807;\n Mon, 27 Apr 2026 10:11:06 -0700 (PDT)" ], "Content-Type": "multipart/mixed; boundary=\"------------FN00KLPcWQZAnHNNDXHwRWpc\"", "Message-ID": "<13f4cca8-c5bd-4179-b2f0-6f3d8a0640c5@oss.qualcomm.com>", "Date": "Mon, 27 Apr 2026 11:11:05 -0600", "MIME-Version": "1.0", "User-Agent": "Mozilla Thunderbird", "Content-Language": "en-US", "From": "Jeffrey Law <jeffrey.law@oss.qualcomm.com>", "To": "'GCC Patches' <gcc-patches@gcc.gnu.org>", "Subject": "[to-be-committed][RISC-V][PR target/124760] Promote SI to DI in some\n cases to encourage shNadd insns", "X-Proofpoint-GUID": "B77jte_XUlis1kO-LDW6nEGb47c8FuEe", "X-Proofpoint-ORIG-GUID": "B77jte_XUlis1kO-LDW6nEGb47c8FuEe", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI3MDE4MyBTYWx0ZWRfX6GQFQkXHM+rM\n 8KODjGAzMdCurBJd/jUddBM2zl1ppQKFweFGnIScR69PmGYjT+ESaCQcUOmVfl7WSU47fevWrJt\n LMaWrnULLJojXiUnbTGhL4oWxZdtIQlPzF+iotzDO/qcVIWeNJo1YwMrAXrgBps5NWF3T+b9/YS\n cUYku87fglpDF+sZfbxvDoSmkBg0xpkjlFFoVuAhYNY8DaE2Vhr/TrOKQumBVoqLU/NacgzEZWG\n nMoRsFuvHakgtHWXlVsPhsG1dy0afigsjWCGlcHvjhJBbRxuKS4VmEdMoacydebggE8FwUkyknD\n MTbZTak+k9lwpLSQw8CuME4K5RY2wqCXIc0Kq2xs7i+kj4Hg7UV4Bc+LsS/weHG6SzJTEszjDXW\n Woosv1X5vfyIAg0GFqSJ0QCEMA37s35uYrADUibJTUmRloXpZqgU5TquLK1fJcrkajVjeHIoQjW\n 0Q2Wu66zlhD9fgU0ZXA==", "X-Authority-Analysis": "v=2.4 cv=FM8rAeos c=1 sm=1 tr=0 ts=69ef98ad cx=c_pps\n a=cFYjgdjTJScbgFmBucgdfQ==:117 a=asGLMfRmzhnGNxaIYohjRg==:17\n a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=r77TgQKjGQsHNAKrUKIA:9\n a=q-ELt1TEW44-EIk9tfIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10\n a=SR9wpakuIC-9jfC-KR4A:9 a=I5Y12xcQSGeLBXdR:21 a=_W_S_7VecoQA:10\n a=-d7-HylfX6lhVPyK7WUA:9 a=B2y7HmGcmWMA:10 a=scEy_gLbYbu1JhEsrz4S:22", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-27_04,2026-04-21_02,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n lowpriorityscore=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0\n spamscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 clxscore=1015\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604270183", "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>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "So for this testcase:\n\n\nint foo (int t)\n {\n return 3 * t - 1;\n }\n\nWe currently generate:\n\n\n slliw a5,a0,1\n addw a0,a5,a0\n addiw a0,a0,-1\n ret\n\n\nIntuitively we can see we're doing a 32->64 sign extension at each step \nand we could drop the intermediate sign extensions. In fact, not only \ncan we drop the intermediate sign extensions, we can safely \"promote\" \nthe intermediate operations from SI to DI with a final sign extending \nadd. Conceptually that unlocks combining the first shift+add into a \nshNadd insn resulting in this code:\n\n sh1add a0, a0, a0\n addiw a0, a0, -1\n ret\n\nThe patch, but not the testcase, has been in my tree for a while, so \nit's been through bootstrap & regression testing on the BPI and Pioneer \nas well as testing on riscv32-elf and riscv64-elf. Obviously I'll wait \nfor pre-commit CI to do its thing before pushing.\n\nJeff\nPR target/124760\ngcc/\n\t* config/riscv/bitmanip.md (SI->DI promoting shadd pattern): Promote\n\tintermediate SI ops to DI ops when there's a final extending op.\n\ngcc/testsuite\n\n\t* gcc.target/riscv/pr124760.c: New test.", "diff": "diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md\nindex 45881994f3ad..4b896b792678 100644\n--- a/gcc/config/riscv/bitmanip.md\n+++ b/gcc/config/riscv/bitmanip.md\n@@ -1368,3 +1368,19 @@ (define_split\n (set (match_dup 0) (zero_extract:X (match_dup 3)\n \t\t\t\t (const_int 1)\n \t\t\t\t (zero_extend:X (match_dup 2))))])\n+\n+(define_split\n+ [(set (match_operand:DI 0 \"register_operand\")\n+\t(sign_extend:DI (plus:SI (plus:SI (ashift:SI (match_operand:SI 1 \"register_operand\")\n+\t\t\t\t\t\t (match_operand 2 \"imm123_operand\"))\n+\t\t\t\t\t (match_operand:SI 3 \"register_operand\"))\n+\t\t\t\t (match_operand:SI 4 \"arith_operand\"))))\n+ (clobber (match_operand:DI 5 \"register_operand\"))]\n+ \"TARGET_64BIT && TARGET_ZBA\"\n+ [(set (match_dup 5) (plus:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))\n+ (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 6) (match_dup 4))))]\n+ {\n+ operands[1] = gen_lowpart (DImode, operands[1]);\n+ operands[3] = gen_lowpart (DImode, operands[3]);\n+ operands[6] = gen_lowpart (SImode, operands[5]);\n+ })\ndiff --git a/gcc/testsuite/gcc.target/riscv/pr124760.c b/gcc/testsuite/gcc.target/riscv/pr124760.c\nnew file mode 100644\nindex 000000000000..0c4768ff0474\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/riscv/pr124760.c\n@@ -0,0 +1,14 @@\n+/* { dg-do compile { target rv64 } } */\n+/* { dg-additional-options \"-march=rv64gcb_zicond -mabi=lp64d\" } */\n+/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" \"-Os\" \"-Oz\" } } */\n+\n+\n+int foo (int t)\n+{\n+ return 3 * t - 1;\n+}\n+\n+/* { dg-final { scan-assembler-not \"slliw\\t\" } } */\n+/* { dg-final { scan-assembler-not \"addw\\t\" } } */\n+/* { dg-final { scan-assembler-times \"sh1add\\t\" 1 } } */\n+/* { dg-final { scan-assembler-times \"addiw\\t\" 1 } } */\n", "prefixes": [ "to-be-committed", "RISC-V", "PR", "target/124760" ] }