Cover Letter Detail
Show a cover letter.
GET /api/covers/2216374/?format=api
{ "id": 2216374, "url": "http://patchwork.ozlabs.org/api/covers/2216374/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/cover/20260326105908.3389883-1-konstantinos.eleftheriou@vrull.eu/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260326105908.3389883-1-konstantinos.eleftheriou@vrull.eu>", "list_archive_url": null, "date": "2026-03-26T10:58:55", "name": "[v3,0/2] Recognize and fold longhand wide-multiplication idioms [PR107090]", "submitter": { "id": 89121, "url": "http://patchwork.ozlabs.org/api/people/89121/?format=api", "name": "Konstantinos Eleftheriou", "email": "konstantinos.eleftheriou@vrull.eu" }, "mbox": "http://patchwork.ozlabs.org/project/gcc/cover/20260326105908.3389883-1-konstantinos.eleftheriou@vrull.eu/mbox/", "series": [ { "id": 497569, "url": "http://patchwork.ozlabs.org/api/series/497569/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497569", "date": "2026-03-26T10:58:55", "name": "Recognize and fold longhand wide-multiplication idioms [PR107090]", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/497569/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/covers/2216374/comments/", "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=pass (2048-bit key;\n unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256\n header.s=google header.b=hZ0aOXKV;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::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=pass (2048-bit key,\n unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256\n header.s=google header.b=hZ0aOXKV", "sourceware.org;\n dmarc=none (p=none dis=none) header.from=vrull.eu", "sourceware.org; spf=pass smtp.mailfrom=vrull.eu", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.50" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fhLhx68pzz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 22:12:12 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 8A7414BA2E2C\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 11:12:09 +0000 (GMT)", "from mail-wm1-f50.google.com (mail-wm1-f50.google.com\n [209.85.128.50])\n by sourceware.org (Postfix) with ESMTPS id CC2AC4BA2E11\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 11:11:40 +0000 (GMT)", "by mail-wm1-f50.google.com with SMTP id\n 5b1f17b1804b1-4838c15e3cbso6457085e9.3\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 04:11:40 -0700 (PDT)", "from altra1.sec.univie.ac.at (altra1.sec.univie.ac.at.\n [131.130.126.103]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-487209204d5sm19623915e9.5.2026.03.26.04.11.38\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 04:11:38 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 8A7414BA2E2C", "OpenDKIM Filter v2.11.0 sourceware.org CC2AC4BA2E11" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org CC2AC4BA2E11", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org CC2AC4BA2E11", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774523501; cv=none;\n b=pxE0bvTgwjy0YH7LdL8pRTv29hpY/rmCmCw5tC37gMzy+DeIQCXpVHIfn9cVUekV/yxoHY4sWtcc86lI2CDdMK/21jToYZY8eDVdE0dZjNxinqb0B6xXN6FBrUq05a67+7P5GaQ5F3wsJ+ByMozAVm/vUFJCubh6dbdl9Miw1rk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774523501; c=relaxed/simple;\n bh=gPqjoDz3mdicglGqr+BiATm052fLKWAJ3x82rTG0jsU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ikInqOkQZMaAqxDSW9/CkfJlv9lTc31KwxZwzhAV/IwD4PqPxIdQ/fipFAGusJXAQvQSEV2Dpkr76FlYGFXkNWhUHOmfh3gZWdyR4zBumx7/L8o3T0ByAmkQ3bVNfH7rtuDydzH6Yg/wEE5T54mKeYOWVazySLM2IKJlCbN9WZs=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=vrull.eu; s=google; t=1774523499; x=1775128299; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=WZ/e/09ngJXCC1zpiZJVBHRIzgl2lc/nVfk7NK8s6/o=;\n b=hZ0aOXKVQBbT74IWryN1bL0HdnPcX1f0ouDMWozcc+dlByV3dfIcECw+kbgCV46LSo\n lKAmNg1AcmzrRTF+PWJjiu7GfTNvKiGMXCz6yTJJoJp17MtYjJvj54xf3cA0TAtXIFul\n aTR31QB62Fid7Gfu63Tc7oDi14dH40uC1ECqL2F5r5KFfgcV0Ze9rR1HEucuI9xk+hr8\n D6XcXHOsyFbziKoSgmxkFMj2Pzl+MFZXxXJ7+cJTWYDo/X+d2ZinU9IN8qxHLVVTZ+Qh\n pyTQkpRe4Z23WZb7xBaAti7t4wefPeMaxiYpIT08mo25NepabEzujjZj4/GCfHm80802\n 6jPQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774523499; x=1775128299;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=WZ/e/09ngJXCC1zpiZJVBHRIzgl2lc/nVfk7NK8s6/o=;\n b=WYTebPcaZDhbBwiFlru86Wzf494RD/FTYjlkVK+lCENuxj+Kig+RkDDeWoKSzMo+fO\n xuSoGv/awwilNkadwKzmwa0GdWADjklxUjj0meFzyP0+bY7amfjb0KzTtO9IPu5Po9q+\n /IgW5ifvNnD5DyMfH1dxDa3wVY2ULkXWpADep1zKoPFkxKZGsWWvvDlVcYyJnnJyyysk\n xAvSUDqFADantDh3/21LBDaufnBE2jKpVFVkkwI/P73mCBKQEi6/snhtK+HGKvhS1Wpt\n kuNxCnH8QHKzzoAyaVh3kgSgFSuKofsA2Ni4jVsQXL8EGqRSSmFCCOX+fzUin3OrZ3eb\n 5htg==", "X-Gm-Message-State": "AOJu0YwxejrGy8qruA0SXt8bvVJIAMJJJhHRgQLtZiJhtWbwVgZVzrV2\n eTN8kyTjLujqpDft52W0tpahPhzufxWzaozNCYsDf6cnh5ECAXAESIh/fqB0rm5ceDKkiXbhNZ2\n qmiVVXXs=", "X-Gm-Gg": "ATEYQzyUOSUzGHvy+YDcAoeG/bihPuRarJwVqOSdj23SffNpqZ5Ew7aIjPUSSnl0FQL\n oY2dyJxD7yIW2TeJ8gq+AtBGF1ccx685uU0oa2Q7PDZ21weuh5kL3mLCAePWgVkCqxjSgoKVSJm\n iurBu+mxXU5n8PL3olZmpXetxES88hLeqHKSU68CE/uZx5kxfvUlNdBEa2FfbjI4ZKVYUJmE++9\n XJSoryfKunXC+vK4N+ZLUHJbSU3AL6Fmu1lcwyIl8JZhbPoc9dTG9fh+6CihmepBQCEFttGXpFG\n GNchsLR7kQLrpp2pE+24pfxKUyMoepwfWfNK0L5966p0RPSKA0qFEHkz5NdtZDPmoiyxiF+Gxat\n RKVyOqmJp7nynz+lfjSDhk32TaHDWRu9egq0wk1dT1MYf0lxIXCYwyGJxduSCdsYMi0Q9vxbWJZ\n OHHtLNFLF/CohUy0aDidFWGiHMKZeNgrfdrdHjj/qO4CidMwXq1HQTXcS1eihkbXj4cJUBB8NkG\n Bb9rfqknog3wBPEfHPF", "X-Received": "by 2002:a05:600d:16:b0:485:4135:5c92 with SMTP id\n 5b1f17b1804b1-48715f035c4mr77645495e9.0.1774523499222;\n Thu, 26 Mar 2026 04:11:39 -0700 (PDT)", "From": "Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Andrew Pinski <andrew.pinski@oss.qualcomm.com>,\n Philipp Tomsich <philipp.tomsich@vrull.eu>,\n Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>", "Subject": "[PATCH v3 0/2] Recognize and fold longhand wide-multiplication idioms\n [PR107090]", "Date": "Thu, 26 Mar 2026 03:58:55 -0700", "Message-ID": "<20260326105908.3389883-1-konstantinos.eleftheriou@vrull.eu>", "X-Mailer": "git-send-email 2.52.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "This patch series teaches GCC to recognize longhand 64x64->128\nwide-multiplication idioms and replace them with native multiply\ninstructions (MULT_HIGHPART_EXPR / widening multiply for the high part,\nplain MULT_EXPR for the low part).\n\nPortable C/C++ code that needs a 128-bit product on a 64-bit target\noften resorts to a longhand decomposition: split operands into 32-bit\nhalves, compute four partial products, and propagate carries manually.\nThis pattern appears in a number of real-world codebases, including\nSPEC2026's 750.sealcrypto_r (seal/util/uintarith.h) and several\nexamples from Hacker's Delight. Targets like AArch64 (mul/umulh) and\nx86-64 can compute the full 128-bit product in one or two instructions,\nbut GCC does not currently fold the longhand sequence back to these.\n\nThe series is split into two patches:\n\n 1/2 match.pd: Flatten carry-diamond patterns to straight-line code\n\n A carry diamond implements unsigned overflow detection with\n conditional carry propagation:\n\n sum = a + b;\n if (addend > sum) result = base + C;\n\n This is implemented as a match.pd simplification applied during\n phiopt, which converts such conditional branches into branchless\n straight-line code:\n\n result = base + ((type)(addend > sum) << log2(C));\n\n (PHI<pow2, 0>) is already handled by the existing match.pd pattern\n for conditional power-of-two.\n\n This is a prerequisite for the long-multiply pattern matching,\n which expects carries in the form\n (lshift (convert? (gt ...)) INTEGER_CST).\n\n 2/2 forwprop: Match and fold long-multiply patterns [PR107090]\n\n Adds match.pd patterns that recognize six decomposed variants\n of the longhand multiplication:\n\n - carry: single overflow comparison on the cross-sum\n - carry-long: cross-carry with separate high/low accumulation\n - two-carry: both cross-carry and low-carry as separate\n comparisons\n - ladder: sequential accumulation without explicit carry\n comparison\n - ladder-long: ladder with separate high/low accumulation\n - low-plus: low part as a direct sum of partial products\n\n The actual folding is performed in forwprop after verifying\n target support for umul_highpart or widening multiply.\n\nOn SPEC2026's 750.sealcrypto_r:\n\n - AArch64 Neoverse-N1: 25% improvement\n - x86-64 Zen4: 59% improvement\n\nBootstrapped/regtested on AArch64 and x86-64.\n\nChanges in v3:\n- Moved carry-diamond flattening from forwprop to match.pd,\nreplacing ~460 lines of C++ with a 17-line match.pd pattern.\n- Two-carry test scans forwprop3 (the first forwprop after phiopt2,\nsince early phiopt restricts which tree codes are allowed).\n- Set location for new sequences.\n- Updated mul_carry_low pattern.\n- Added the `mul_low_plus` pattern.\n- Fixed formatting issues.\n\nChanges in v2:\n- Fixed the testcases by separating the high part's fold count for\n32-bit and 64-bit targets.\n\nKonstantinos Eleftheriou (2):\n match.pd: Flatten carry-diamond patterns to straight-line code\n forwprop: Match and fold long-multiply patterns [PR107090]\n\n gcc/match.pd | 250 +++++\n gcc/testsuite/gcc.dg/tree-ssa/forwprop-44.c | 21 +\n gcc/testsuite/gcc.dg/tree-ssa/forwprop-45.c | 44 +\n .../gcc.dg/tree-ssa/long-mul-boundary-64.c | 274 ++++++\n .../gcc.dg/tree-ssa/long-mul-boundary.c | 270 ++++++\n .../gcc.dg/tree-ssa/long-mul-carry.c | 311 +++++++\n .../gcc.dg/tree-ssa/long-mul-ladder.c | 329 +++++++\n .../gcc.dg/tree-ssa/long-mul-low-plus.c | 54 ++\n .../gcc.dg/tree-ssa/long-mul-partial.c | 119 +++\n .../gcc.dg/tree-ssa/long-mul-two-carry.c | 111 +++\n gcc/testsuite/gcc.target/aarch64/long_mul.c | 100 ++\n gcc/testsuite/gcc.target/i386/long_mul.c | 100 ++\n gcc/tree-ssa-forwprop.cc | 871 +++++++++++++++++-\n 13 files changed, 2849 insertions(+), 5 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/forwprop-44.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/forwprop-45.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-boundary-64.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-boundary.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-carry.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-ladder.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-low-plus.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-partial.c\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/long-mul-two-carry.c\n create mode 100644 gcc/testsuite/gcc.target/aarch64/long_mul.c\n create mode 100644 gcc/testsuite/gcc.target/i386/long_mul.c" }