get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2224781/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2224781,
    "url": "http://patchwork.ozlabs.org/api/patches/2224781/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/aeOhiL7QLr9IqD4c@tucnak/",
    "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": "<aeOhiL7QLr9IqD4c@tucnak>",
    "list_archive_url": null,
    "date": "2026-04-18T15:21:45",
    "name": "bitintlower: Padding bit fixes, part 3 [PR123635]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4d48a6114940f2637a100e5483b3852ab43f72df",
    "submitter": {
        "id": 671,
        "url": "http://patchwork.ozlabs.org/api/people/671/?format=api",
        "name": "Jakub Jelinek",
        "email": "jakub@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/aeOhiL7QLr9IqD4c@tucnak/mbox/",
    "series": [
        {
            "id": 500448,
            "url": "http://patchwork.ozlabs.org/api/series/500448/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500448",
            "date": "2026-04-18T15:21:45",
            "name": "bitintlower: Padding bit fixes, part 3 [PR123635]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500448/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224781/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224781/checks/",
    "tags": {},
    "related": [],
    "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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=SSI58u8s;\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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=SSI58u8s",
            "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "sourceware.org; spf=pass smtp.mailfrom=redhat.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"
        ],
        "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 4fybFv06BMz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 01:26:59 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 2DFA84D108D0\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 15:26:57 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id AA8CB4AA51F6\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 15:26:27 +0000 (GMT)",
            "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-xM81mnDzMz6c1YQrMrJr2w-1; Sat,\n 18 Apr 2026 11:26:24 -0400",
            "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id BF1D01800451; Sat, 18 Apr 2026 15:26:22 +0000 (UTC)",
            "from tucnak.zalov.cz (unknown [10.44.48.12])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 1E56530001A1; Sat, 18 Apr 2026 15:26:21 +0000 (UTC)",
            "from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 63IFQJ3S3129585\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Sat, 18 Apr 2026 17:26:19 +0200",
            "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63IFQItw3129584;\n Sat, 18 Apr 2026 17:26:18 +0200"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 2DFA84D108D0",
            "OpenDKIM Filter v2.11.0 sourceware.org AA8CB4AA51F6"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org AA8CB4AA51F6",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org AA8CB4AA51F6",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776525987; cv=none;\n b=n6MFkvaBMBiKnNMh1O4uksq5e5jgTsCSw6hbQrKr6wjr3jJuc1w5Pp9Hy2pduOPoJfzpudhUR96qGUkwtkzKKTX89i4zX8nwpAhkrfVpeENK7pF2xHHw7w/ibm7ICXsBan5uh6/p1cyejtfS/DB2GfRTZM5g3fNICfw4bgJNkP0=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776525987; c=relaxed/simple;\n bh=YX149BSroM8zQYKR6huHAubjEtuEwl3E+GZQkBWpD2o=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=GIDkkRjhbI+NhWRct6XX2lm+lT71NCx3jxsZzvQwmA/5lFZuhj2g7yOTIcShA431//v7zOzgTBxeMxscMJF493sb8t52vJfzn3zbHsjqI7MiuRtt5AeJ1jaoU766jbjY6dX/QyfT/Y3P6NCgPWkI6U6GGucH5LmaqJqZFmbOzvo=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776525987;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type:resent-to:resent-from:resent-message-id;\n bh=8wF/9+UXv4koxVD32EL9AZmX0mMtXXYFnkuHeUNem9s=;\n b=SSI58u8s4JRyG4ljosLD/AnPjx4uX745shhyI4E8FkzmZ7fxEyWfmwDqUOZuQcBhbyPUhb\n xyqcKltAjT40buF0MaYriuKxTKmwM/WyiKWzA933f9skowk6vcr6fNIKta/ygLRd0cOe+f\n h6ks5eLBB9+zmeESaz5DrHwmNqCXA5k=",
        "X-MC-Unique": "xM81mnDzMz6c1YQrMrJr2w-1",
        "X-Mimecast-MFC-AGG-ID": "xM81mnDzMz6c1YQrMrJr2w_1776525983",
        "Resent-From": "Jakub Jelinek <jakub@redhat.com>",
        "Resent-Date": "Sat, 18 Apr 2026 17:26:18 +0200",
        "Resent-Message-ID": "<aeOimnTZJdO7YrMJ@tucnak>",
        "Resent-To": "gcc-patches@gcc.gnu.org,\n Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>,\n Palmer Dabbelt <palmer@dabbelt.com>, Robin Dapp <rdapp.gcc@gmail.com>",
        "Date": "Sat, 18 Apr 2026 17:21:45 +0200",
        "From": "Jakub Jelinek <jakub@redhat.com>",
        "To": "Richard Biener <rguenther@suse.de>,\n Andrew Pinski <andrew.pinski@oss.qualcomm.com>,\n Jeff Law <jeffreyalaw@gmail.com>",
        "Cc": "gcc-patches@gcc.gnu.org,\n Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>,\n Palmer Dabbelt <palmer@dabbelt.com>, Robin Dapp <rdapp.gcc@gmail.com>",
        "Subject": "[PATCH] bitintlower: Padding bit fixes, part 3 [PR123635]",
        "Message-ID": "<aeOhiL7QLr9IqD4c@tucnak>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "3tDyejUjBXFU_TUuMYmxtyJR2I3_A1s_sDQPz_CP_W8_1776525983",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "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>",
        "Reply-To": "Jakub Jelinek <jakub@redhat.com>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Hi!\n\nI've debugged the rest of the failures on riscv64-linux (in particular\ntorture/bitint-{87,89}.c FAILs at -O2).\nThis is on top of https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713242.html\npatch.\nOne problem was that the lower_shift_stmt RSHIFT_EXPR change to iterate\nuntil p2 rather than p (where p2 is p + 1 if bitint_ext_full and there is\nfull limb of padding bits), the loop is emitted with a condition before the\nheader and another condition before the latch edge and I've mistakenly fixed\njust the latter and not the former.\nANother problem was that in all the 3 RSHIFT_EXPRs added meant to set\na full limb to 0 or all ones based on most significant bit I've mistakenly used\nunsigned type rather than signed, so it was set to 0 or 1 instead (this\nwas twice in lower_shift_stmt, for the LSHIFT_EXPR case in both cases and\nonce in lower_float_conv_stmt).\nAnd finally, because unsigned MULT_EXPR doesn't have overflow undefined, we\nactually don't need to just clear the full padding bit limb (if any) but\neven the padding bits in the partial limb (if any; and this actually doesn't\naffect just arm and riscv, but also affects s390x and loongarch).\n\nTested with\nmake -j8 -k check-gcc GCC_TEST_RUN_EXPENSIVE=1 RUNTESTFLAGS=\"GCC_TEST_RUN_EXPENSIVE=1 dg.exp='*bitint* pr112673.c builtin-stdc-bit-*.c pr112566-2.c pr112511.c pr116588.c pr116003.c pr113693.c pr113602.c flex-array-counted-by-7.c' dg-torture.exp='*bitint* pr116480-2.c pr114312.c pr114121.c' dfp.exp=*bitint* vect.exp='vect-early-break_99-pr113287.c' tree-ssa.exp=pr113735.c\"\non riscv64-linux, ok for trunk if it passes full bootstrap/regtest on\nx86_64-linux, i686-linux, aarch64-linux and s390x-linux too?\n\n2026-04-18  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR middle-end/123635\n\t* gimple-lower-bitint.cc (bitint_large_huge::lower_shift_stmt): In the\n\tRSHIFT_EXPR case, use p2 in two LE_EXPR conditions rather than just\n\tone.  In LSHIFT_EXPR case, use signed RSHIFT_EXPR instead of unsigned.\n\t(bitint_large_huge::lower_muldiv_stmt): For unsigned MULT_EXPR with\n\tbitint_extended if prec is not multiple of limb_prec, clear padding\n\tbits after libgcc call.\n\t(bitint_large_huge::lower_float_conv_stmt): Use signed RSHIFT_EXPR\n\tinstead of unsigned.\n\n\n\tJakub",
    "diff": "--- gcc/gimple-lower-bitint.cc.jj\t2026-04-18 11:18:51.764826014 +0200\n+++ gcc/gimple-lower-bitint.cc\t2026-04-18 14:14:18.244936407 +0200\n@@ -3798,6 +3798,7 @@ bitint_large_huge::lower_shift_stmt (tre\n \t\t\t       bitint_big_endian\n \t\t\t       ? size_int (-1) : size_one_node);\n       insert_before (g);\n+      tree p2 = p;\n       if (bitint_big_endian)\n \t{\n \t  tree new_idx = gimple_assign_lhs (g);\n@@ -3807,8 +3808,13 @@ bitint_large_huge::lower_shift_stmt (tre\n \t}\n       else\n \t{\n+\t  if (bitint_extended == bitint_ext_full\n+\t      && abi_limb_prec > limb_prec)\n+\t    p2 = build_int_cst (sizetype,\n+\t\t\t\tCEIL (prec, abi_limb_prec)\n+\t\t\t\t* abi_limb_prec / limb_prec - 1);\n \t  idx = gimple_assign_lhs (g);\n-\t  g = gimple_build_cond (LE_EXPR, idx, p, NULL_TREE, NULL_TREE);\n+\t  g = gimple_build_cond (LE_EXPR, idx, p2, NULL_TREE, NULL_TREE);\n \t}\n       if_then (g, profile_probability::likely (), edge_true, edge_false);\n       idx = create_loop (idx, &idx_next);\n@@ -3822,16 +3828,8 @@ bitint_large_huge::lower_shift_stmt (tre\n       if (bitint_big_endian)\n \tg = gimple_build_cond (NE_EXPR, idx, size_zero_node,\n \t\t\t       NULL_TREE, NULL_TREE);\n-      else if (bitint_extended == bitint_ext_full\n-\t       && abi_limb_prec > limb_prec)\n-\t{\n-\t  tree p2 = build_int_cst (sizetype,\n-\t\t\t\t   CEIL (prec, abi_limb_prec)\n-\t\t\t\t   * abi_limb_prec / limb_prec - 1);\n-\t  g = gimple_build_cond (LE_EXPR, idx_next, p2, NULL_TREE, NULL_TREE);\n-\t}\n       else\n-\tg = gimple_build_cond (LE_EXPR, idx_next, p, NULL_TREE, NULL_TREE);\n+\tg = gimple_build_cond (LE_EXPR, idx_next, p2, NULL_TREE, NULL_TREE);\n       insert_before (g);\n     }\n   else\n@@ -4028,12 +4026,13 @@ bitint_large_huge::lower_shift_stmt (tre\n \t\tv = build_zero_cst (m_limb_type);\n \t      else\n \t\t{\n-\t\t  g = gimple_build_assign (make_ssa_name (m_limb_type),\n+\t\t  v = add_cast (signed_type_for (m_limb_type), v);\n+\t\t  g = gimple_build_assign (make_ssa_name (TREE_TYPE (v)),\n \t\t\t\t\t   RSHIFT_EXPR, v,\n \t\t\t\t\t   build_int_cst (unsigned_type_node,\n \t\t\t\t\t\t\t  limb_prec - 1));\n-\t\t  v = gimple_assign_lhs (g);\n \t\t  insert_before (g);\n+\t\t  v = add_cast (m_limb_type, gimple_assign_lhs (g));\n \t\t}\n \t      l = limb_access (TREE_TYPE (lhs), obj, p2, true);\n \t      g = gimple_build_assign (l, v);\n@@ -4058,12 +4057,13 @@ bitint_large_huge::lower_shift_stmt (tre\n \t      v = make_ssa_name (m_limb_type);\n \t      g = gimple_build_assign (v, l);\n \t      insert_before (g);\n-\t      g = gimple_build_assign (make_ssa_name (m_limb_type),\n+\t      v = add_cast (signed_type_for (m_limb_type), v);\n+\t      g = gimple_build_assign (make_ssa_name (TREE_TYPE (v)),\n \t\t\t\t       RSHIFT_EXPR, v,\n \t\t\t\t       build_int_cst (unsigned_type_node,\n \t\t\t\t\t\t      limb_prec - 1));\n-\t      v = gimple_assign_lhs (g);\n \t      insert_before (g);\n+\t      v = add_cast (m_limb_type, gimple_assign_lhs (g));\n \t    }\n \t  tree l = limb_access (TREE_TYPE (lhs), obj, p2, true);\n \t  g = gimple_build_assign (l, v);\n@@ -4166,6 +4166,26 @@ bitint_large_huge::lower_muldiv_stmt (tr\n \t  add_eh_edge (e2->src, e1);\n \t}\n     }\n+  if (bitint_extended\n+      && rhs_code == MULT_EXPR\n+      && TYPE_UNSIGNED (type)\n+      && (prec % limb_prec) != 0)\n+    {\n+      /* Unsigned multiplication wraps, but libgcc function will return the\n+\t bits beyond prec within the top limb as another limb of the full\n+\t multiplication.  So, clear the padding bits here.  */\n+      tree idx = size_int (bitint_big_endian ? 0 : prec / limb_prec);\n+      tree l = limb_access (type, obj, idx, true);\n+      tree ctype = limb_access_type (type, idx);\n+      tree v = make_ssa_name (m_limb_type);\n+      g = gimple_build_assign (v, l);\n+      insert_before (g);\n+      v = add_cast (ctype, v);\n+      l = limb_access (type, obj, idx, true);\n+      v = add_cast (m_limb_type, v);\n+      g = gimple_build_assign (l, v);\n+      insert_before (g);\n+    }\n   if (zero_ms_limb)\n     {\n       unsigned int i = CEIL (prec, abi_limb_prec) * abi_limb_prec / limb_prec;\n@@ -4242,12 +4262,14 @@ bitint_large_huge::lower_float_conv_stmt\n \t\t\t\t\t\t    size_int (i - 2),\n \t\t\t\t\t\t    true));\n \t      insert_before (g);\n-\t      g = gimple_build_assign (make_ssa_name (m_limb_type),\n-\t\t\t\t       RSHIFT_EXPR, gimple_assign_lhs (g),\n+\t      val = add_cast (signed_type_for (m_limb_type),\n+\t\t\t      gimple_assign_lhs (g));\n+\t      g = gimple_build_assign (make_ssa_name (TREE_TYPE (val)),\n+\t\t\t\t       RSHIFT_EXPR, val,\n \t\t\t\t       build_int_cst (unsigned_type_node,\n \t\t\t\t\t\t      limb_prec - 1));\n \t      insert_before (g);\n-\t      val = gimple_assign_lhs (g);\n+\t      val = add_cast (m_limb_type, gimple_assign_lhs (g));\n \t    }\n \t  else\n \t    val = build_zero_cst (m_limb_type);\n",
    "prefixes": []
}