get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2229694,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229694/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/d25fc719-db02-47b2-bd88-5fbf4c4b9b8b@gmail.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": "<d25fc719-db02-47b2-bd88-5fbf4c4b9b8b@gmail.com>",
    "date": "2026-04-28T16:06:58",
    "name": "[committed,V2,RISC-V,PR,tree-optimization/94892] Improve equality test of sign bit splat against zero",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7392e6e76babdaa90d483fb0cd86b95aa2be3d49",
    "submitter": {
        "id": 81263,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/81263/?format=api",
        "name": "Jeffrey Law",
        "email": "jeffreyalaw@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/d25fc719-db02-47b2-bd88-5fbf4c4b9b8b@gmail.com/mbox/",
    "series": [
        {
            "id": 501890,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501890/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501890",
            "date": "2026-04-28T16:06:58",
            "name": "[committed,V2,RISC-V,PR,tree-optimization/94892] Improve equality test of sign bit splat against zero",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/501890/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2229694/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2229694/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=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=qVAZ9wWN;\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=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=qVAZ9wWN",
            "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "sourceware.org; spf=pass smtp.mailfrom=gmail.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.179"
        ],
        "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 4g4lh82vghz1xrS\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 02:07:33 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id A61BA4BA2E3A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 16:07:31 +0000 (GMT)",
            "from mail-dy1-f179.google.com (mail-dy1-f179.google.com\n [74.125.82.179])\n by sourceware.org (Postfix) with ESMTPS id 49DCE4BA23C1\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 16:07:02 +0000 (GMT)",
            "by mail-dy1-f179.google.com with SMTP id\n 5a478bee46e88-2d891442388so2444451eec.0\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 09:07:02 -0700 (PDT)",
            "from [172.31.0.17] ([136.38.201.137])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ed09f8aa6esm2443636eec.2.2026.04.28.09.06.59\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Tue, 28 Apr 2026 09:06:59 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org A61BA4BA2E3A",
            "OpenDKIM Filter v2.11.0 sourceware.org 49DCE4BA23C1"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 49DCE4BA23C1",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 49DCE4BA23C1",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777392422; cv=none;\n b=udrvttJ6c7s5uE1PFTVCRbV/EmOLujDQ3t6bOoS1+HhBlCqQRHqZq565zS5ULXO1W4Gp3ok2UMVe3fQrWUtc5MbxLDgHetIEefF0RZGZ9sZaFMJ/T5n/LWnmiTLkhOhoG+GkxXjj1C3ZtC9UkL2I++NtNqt3CzDPmlfTw0j6zlA=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777392422; c=relaxed/simple;\n bh=aE67cZCJN4tI4ymUf/RtCQdQakMYFtUrJoNTCh6T/Jc=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:From:To:Subject;\n b=pYKRAHPgrnQa23/oLyjGanWtEYyYJQBHk5DC54pT93caoL4psQE9UqzElmzziPQKJNKF2TJ/gCo13FAdqVfqUAz5ktP78kLVtrF0iO5Ki4jvJrE1DY8piYN4qkV+wjYNVL0yJ6VocDW8VcgN23EEnCUq74/7aowH9DDutkPCH0M=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777392421; x=1777997221; 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=yd0I1lpWbKOV9Hq/bIq5Loj8YssFmhwsJbwhL+gvb/Q=;\n b=qVAZ9wWNF3ttuVE4kNagtp73j6hLVBmjvh4pt2nSywsCWeXfCvlde2eQcyOTL0JJ+V\n 6u4a8+Bfk840C8pttY6ERiME751mQ4y4iM2zIjSwSRbvPrlFl0Ul2j0AMkgY080DYZJi\n 3IwTF/YUgLMK7PzrH0HOgM+jgajP7Diwc9upWfcr61nE+t57SPAFjO/GQmV/aCxfPSUZ\n Js6zo9m47CObkneqZvk7rfAmz9EvVfRTXejEv19EEPGVV72jG0r0F/nsZBubTscdSCIC\n 1fGqFdeKyAbyhxLUhcvCrCWSzmedxI5lbXHGMWbWGy+AdT/YXADxueuVETL61tp0n5Ms\n P7bQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777392421; x=1777997221;\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=yd0I1lpWbKOV9Hq/bIq5Loj8YssFmhwsJbwhL+gvb/Q=;\n b=McbFhROdJ7NdE5UHSAH3SapsQv/tbsJKSo+mupZgqOm/Xqyu6nmIThTlogbQ86VNEI\n +3BM7pMRrC9ZMd5kr1hGU4+BE/VAFJE65I7d5U0qz7MLhdBkeuhRoRveReW5Ycin8+ke\n Yh55xA8xnvOcd7wqDznTrlz869eXSCd/Z5HG+iZLtpDLkpNcTdvbXUAlKjQUntnzDvwR\n JbEq7igjEEGwz553PcHDIInxVa2k1eTYMvEOhyjIUc9G01Q7AKWo4tXbGN/qFz3ocDp1\n 7r5BpE5a7afysw4jgYgt+lJ1IGn9tBq3tWPv/sDHfuj1YgHMk28pUZn9GLk2hq8xq1hN\n RKmA==",
        "X-Gm-Message-State": "AOJu0YzaMl7/kz5Uo3mwGtwtPSlA7SLzUH6gozVMG5ZV3uQw+w3JV03U\n /Y0SmvpXhGsP2IhH/oSzOAICLicBlFmopvaqLgO7PqlxTyG4VdmRaJRpYgvkBg==",
        "X-Gm-Gg": "AeBDietru0tTjo/BOc0b3118e9flRa3a6Swo4G0r3Ekkn9z4aUeI8aM88tanMgsybEn\n S5EnTOZXldTVf2w3VNcY5n09+q5cecGn5ImDtPxrGiBTY5RenjYVrML/dhNUQ6SDmBk2WPI5zXI\n 9BynDwDk0tHfe7szFoGh2WZtaceZx2CzBzOd53YnYfjPM59AZQKfFQZXUdUijgUhFUSpf4xAuPs\n GJ8RKBSztGA4xwdvINPUi0kszbOPbQa0hSXIQQ1Y1VJKWAh2lV1jk0FZ7aeGI8anH13E5MadEbP\n q0JzBbT3bSUOGEK6EUnnO+CGRXp4sOKpWQ8oi45fWQNSvd9Zfa7ouf9j+e0cSKP75lcoeg/WtMn\n xp+pfcOx4jI83rRk6Frl4OlJgrr8NAGb5CLmE2BU3pavCQU5Rm+eQbnxCHXO8cRIRyfE8HhM2bN\n 1E28zzAZMls2bwc7pnzW7C1teHdDKqN0Hsiwgo+N5oL2HzvGZQ3PSM",
        "X-Received": "by 2002:a05:693c:3005:b0:2c5:60d0:701e with SMTP id\n 5a478bee46e88-2ed09fafe8fmr1846280eec.3.1777392420482;\n Tue, 28 Apr 2026 09:07:00 -0700 (PDT)",
        "Content-Type": "multipart/mixed; boundary=\"------------wJ5v6FsKjBceQrKiMVqUczff\"",
        "Message-ID": "<d25fc719-db02-47b2-bd88-5fbf4c4b9b8b@gmail.com>",
        "Date": "Tue, 28 Apr 2026 10:06:58 -0600",
        "MIME-Version": "1.0",
        "User-Agent": "Mozilla Thunderbird",
        "Content-Language": "en-US",
        "From": "Jeffrey Law <jeffreyalaw@gmail.com>",
        "To": "'GCC Patches' <gcc-patches@gcc.gnu.org>",
        "Subject": "[committed][V2][RISC-V][PR tree-optimization/94892] Improve equality\n test of sign bit splat against zero",
        "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": "I sent the wrong version of the testcase; I'd been in the middle of \nupdating it when I got interrupted.  Came back and clearly never \nfinished adjusting the testcase. Implementation of the optimization is \nunchanged.  Posting here for the archivers and pushing the final patch \nto the trunk.\n\n--\n\nOne of the tests in pr94892 showed a case where we failed to convert a \nsign bit splat + equality test against into a simple lt/ge test which \ndoesn't require the sign bit splat.\n\nThis is only failing on rv64, probably because the case in question has \na DI sign bit splat, then we take a lowpart SI subreg.  The lowpart \ndance isn't needed for rv32, though I've structured the test to verify \nthat we get sensible code on rv32 as well as rv64.\n\nLike many other patches I'm submitting now, this has been in my tester \nfor a while, but the test has not.  I'll be waiting on the pre-commit \ntester to verify sanity before moving forward.  I'm particularly \ninterested to see how it behaves with no -march flags.  It should be \ntaking the defaults from when the toolchain was built, which should do \nwhat we want\n\nJeff\nPR tree-optimization/94892\ngcc/\n\t* config/riscv/riscv.md (sign_bit_splat_equality_test): New pattern.\n\ngcc/testsuite/\n\n\t* gcc.target/riscv/pr94892.c: New test.",
    "diff": "diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md\nindex 3487ab1954e..6b5f824109e 100644\n--- a/gcc/config/riscv/riscv.md\n+++ b/gcc/config/riscv/riscv.md\n@@ -5130,6 +5130,48 @@ (define_split\n   operands[6] = gen_int_mode (rshift, QImode);\n }\")\n \n+;; EQ/NE of a sign bit splat against zero is just GE/LT 0, so we can\n+;; recognize it directly.  Note there may be a subreg expression buried\n+;; in there\n+(define_insn \"*sign_bit_splat_equality_test\"\n+  [(set (pc)\n+\t(if_then_else\n+\t (any_eq\n+\t  (subreg:SI (ashiftrt:DI (match_operand:DI 1 \"register_operand\" \"r\")\n+\t\t\t\t  (const_int 63)) 0)\n+\t  (const_int 0))\n+\t (label_ref (match_operand 0 \"\" \"\"))\n+\t (pc)))]\n+  \"TARGET_64BIT\"\n+{\n+  rtx x = PATTERN (insn);\n+\n+  /* We'll always have a SET, so it's safe to extract the source.  */\n+  x = SET_SRC (x);\n+\n+  /* Get the condition of the IF_THEN_ELSE.  */\n+  x = XEXP (x, 0);\n+\n+  if (GET_CODE (x) == EQ)\n+    {\n+      if (get_attr_length (insn) == 12)\n+\treturn \"blt\\t%1,zero,1f; jump\\t%l0,ra; 1:\";\n+      return \"bge\\t%1,zero,%l0\";\n+    }\n+  else if (GET_CODE (x) == NE)\n+    {\n+      if (get_attr_length (insn) == 12)\n+\treturn \"bge\\t%1,zero,1f; jump\\t%l0,ra; 1:\";\n+      return \"blt\\t%1,zero,%l0\";\n+    }\n+  else\n+    gcc_unreachable ();\n+}\n+  [(set_attr \"type\" \"branch\")\n+   (set_attr \"mode\" \"none\")])\n+\t\t\t\t\t\n+\t\n+\n ;; Standard extensions and pattern for optimization\n (include \"bitmanip.md\")\n (include \"crypto.md\")\ndiff --git a/gcc/testsuite/gcc.target/riscv/pr94892.c b/gcc/testsuite/gcc.target/riscv/pr94892.c\nnew file mode 100644\nindex 00000000000..e868a4c1c36\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/riscv/pr94892.c\n@@ -0,0 +1,22 @@\n+/* { dg-do compile } */\n+/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" \"-O1\" } } */\n+\n+\n+  static __inline__ int sign(int x)\n+  {\n+    return (x >> 31) | ((unsigned)-x >> 31);\n+  }\n+\n+  void f1(void);\n+  void f2(void);\n+  void f(int x)\n+  {\n+    if (sign(x) > -1)\n+      f1();\n+    else\n+      f2();\n+  }\n+\n+/* { dg-final { scan-assembler-not \"srai\" } } */\n+/* { dg-final { scan-assembler-times \"blt\\t\" 1 } } */\n+\n",
    "prefixes": [
        "committed",
        "V2",
        "RISC-V",
        "PR",
        "tree-optimization/94892"
    ]
}