get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2228896,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228896/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260427130223.1253-1-netanelkomm@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": "<20260427130223.1253-1-netanelkomm@gmail.com>",
    "date": "2026-04-27T13:02:23",
    "name": "match.pd: x != CST1 ? x + CST2 : CST3 -> x + CST2 [PR112659, PR122996]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c4c869a88402554efa14df52d793157706e2422d",
    "submitter": {
        "id": 92716,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/92716/?format=api",
        "name": "Netanel Komm",
        "email": "netanelkomm@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260427130223.1253-1-netanelkomm@gmail.com/mbox/",
    "series": [
        {
            "id": 501646,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501646/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501646",
            "date": "2026-04-27T13:02:23",
            "name": "match.pd: x != CST1 ? x + CST2 : CST3 -> x + CST2 [PR112659, PR122996]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501646/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2228896/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2228896/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=jyQKRyl9;\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=jyQKRyl9",
            "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=209.85.128.49"
        ],
        "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 4g43gJ360Vz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 23:04:27 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 370614BAD175\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 13:04:25 +0000 (GMT)",
            "from mail-wm1-f49.google.com (mail-wm1-f49.google.com\n [209.85.128.49])\n by sourceware.org (Postfix) with ESMTPS id CB2B14B9DB70\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 13:03:56 +0000 (GMT)",
            "by mail-wm1-f49.google.com with SMTP id\n 5b1f17b1804b1-48334ee0aeaso107262805e9.1\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 06:03:56 -0700 (PDT)",
            "from natis-laptop.technion.ac.il (IGLD-84-229-254-181.inter.net.il.\n [84.229.254.181]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488fc1c0354sm730351265e9.11.2026.04.27.06.03.54\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 27 Apr 2026 06:03:54 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 370614BAD175",
            "OpenDKIM Filter v2.11.0 sourceware.org CB2B14B9DB70"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org CB2B14B9DB70",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org CB2B14B9DB70",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777295037; cv=none;\n b=AssjMUWjpNW2OCp015P8BNTUu0VFTdIU1kDC0ytouSDffdtuv/NaLb+KFDi/0Vf6Rs1lkVp6HbHUBq3kmIKH8R4+TxIM4kZBIPxLIPSVsA8BChqchCcPd0ey2vKQvmaso4R8+fouxSM7U/aAJqDwShor5INQOjl2jFgjZqtIcv4=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777295037; c=relaxed/simple;\n bh=XowrCMSsYQUGqj8CECq/8fVobePbxbLOJa5d904DDGg=;\n h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version;\n b=FUGTJmLcsoaizEDXXM0D9k7jihPa79UCCCXAc1v83PzJmGdiphuE77ZTHvIdkthevpDh5QI63pMcFdz0OL5WxRLvBPI9fry5JaP9pZCaEqU82dA7bdfWjPEZoHgmbeccYC4XSj8sGYZfK3kSupjJBy4YnItn2o7MYn6e54BZ2uo=",
        "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=1777295035; x=1777899835; 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=UhcfRIByuR3r600e8jsEcWVowDZuD7MhnS3a4pzonm0=;\n b=jyQKRyl9fexuLF+WAOdw8MtKi+Fp0K4cJkhhvVHR9WVbRSn3tlO6otSuDQzua2qj36\n DouQWtU8BwM5KH1OjBcLBQSKKx7iz6dScG81eh//eWZdTRfkN2aNIEWcjctw4J96szui\n mljeM8Swz+7jWKl3t+MGLQQ5MkQVRMWjJe9aabQ83Me1imKJcq6RDO8X3Fstqbt/+hld\n 7olQMu8coBeGjxG5JM8l+dzXN4tPJd87aZgK8O6aINtAuhmCA3Wu6d3BcTmXbWftFEkT\n Mc9flewYOzJptFrt+k/Fh1yhXIBuMrTAihk3SDpHHlPmWzc51lZfgDE2yiv81Hp3RfBi\n pTCQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777295035; x=1777899835;\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=UhcfRIByuR3r600e8jsEcWVowDZuD7MhnS3a4pzonm0=;\n b=U0q1R/fMB3vjluPhIVCtV6zAUPuPLMS0fh966RprctRbHRZiTxA9U4QgsNeIRNzRsz\n G3+IzE/2G2JmVRd/1lWVIingBjlkXj6c2Q9zNazSxypuZAdv0jT6GMz8PAAdE2qns+ko\n mgvJwwQL4OaI/Oz5ENIUnPgd7S1iv95uQBDEu3VpjyNEEyCx/lk60bpk8kVayD5vSy5U\n gE8beRzUjfifcetX3mQBYAqwSlETwwjDT+CJ4yHBKbG/JuZSPtbPG3pzrymT8GJ1nY8v\n eKULVlLDaY+4ap3n2xot+GmFeXsUjlCvf/gnXlIPyMW3622J9M2Rrib2vDc6QMekCg8c\n 8VzA==",
        "X-Gm-Message-State": "AOJu0YydsD4eyeyylcnOLCjIHU8Rs5wX3LxoaxMSKyDckfZe0R8snyKW\n WRDv8mKgFRZO0TPB01RbMW+H2+cArJVXCyI23yIE2bAMoxLb3kqi+PPA7v7fiRcU",
        "X-Gm-Gg": "AeBDiesgFqkp0qzMpU9Kwxxz/pPqrin3SEGoCqhXn+mO2Ek0EyS9eMr4aFnfD4gsOw8\n 9zmpy+k9MPVTp67nlxYC0ws5oWypdv/FIGT9FI68NQvZ5TrmMc6QRwczXjxTTwhaHmx/CeDrFOc\n YxyVcHIpcK3Xx0Z/ad1abQlGJ3NF3SQYPwOSsN2uhcQPyfMOXfZlSd1D0/MCi7FlyRTzsTuZgVw\n QfOZW4Rz1MlcFAiUBoqxZLXXUnpzEBqQD0tbcKU04QQsUpYFSLogJfCsRfCD1AYRDxvq3nIOrgs\n Rp+1s8ulIyFoZMPrky5L6/8FnpxWbIzF5Vg5q4GJ+kXi7Wl/ojfwQTx+1wNBP4P8ryqImFYsAq+\n ZNOHVEPHXN9KkcH3Ra/d2hiQy4n5bQr72Wd7/vQJiGSeFtPp/9FYWOVVgXPgI7/De2UoFLqaZZJ\n BAMwbjnT5KrQqm7iiZyvHBHANLRurUWt8JNCuGoir04wqwM0kvRsZ+Sd7KInBGmYmta23h3mbZ1\n I4skaMaY7NsWcJVVwL4wAM4g/Ln2w==",
        "X-Received": "by 2002:a05:600c:8a08:b0:488:a82f:bb9b with SMTP id\n 5b1f17b1804b1-488ff369a1cmr480503925e9.30.1777295035037;\n Mon, 27 Apr 2026 06:03:55 -0700 (PDT)",
        "From": "Netanel Komm <netanelkomm@gmail.com>",
        "To": "gcc-patches@gcc.gnu.org",
        "Cc": "andrew.pinski@oss.qualcomm.com,\n\tNetanel Komm <netanelkomm@gmail.com>",
        "Subject": "[PATCH] match.pd: x != CST1 ? x + CST2 : CST3 -> x + CST2 [PR112659,\n PR122996]",
        "Date": "Mon, 27 Apr 2026 16:02:23 +0300",
        "Message-Id": "<20260427130223.1253-1-netanelkomm@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "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 extends conditional addition simplification introduced in\nPR 122996 to handle a third constant and uniform vectors. This also\nresolves the missing vector addition fold noted in PR 112659.\n\nIt simplifies x != CST1 ? x + CST2 : CST3 into x + CST2 when\nCST1 + CST2 == CST3.\n\nBootstrapped and regression tested on x86_64-pc-linux-gnu.\n\n\tPR tree-optimization/112659\n\tPR tree-optimization/122996\n\ngcc/ChangeLog:\n\n\t* match.pd: Extend conditional addition pattern to handle\n\ta third constant and uniform vectors.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/tree-ssa/cond-add-vec-1.C: New test.\n\t* gcc.dg/tree-ssa/cond-add-1.c: New test.\n---\n gcc/match.pd                                  | 19 +++++--\n .../g++.dg/tree-ssa/cond-add-vec-1.C          | 49 +++++++++++++++++++\n gcc/testsuite/gcc.dg/tree-ssa/cond-add-1.c    | 26 ++++++++++\n 3 files changed, 89 insertions(+), 5 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/tree-ssa/cond-add-vec-1.C\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/cond-add-1.c",
    "diff": "diff --git a/gcc/match.pd b/gcc/match.pd\nindex cb3a558a07d..8cdb6ddcba3 100644\n--- a/gcc/match.pd\n+++ b/gcc/match.pd\n@@ -5251,11 +5251,20 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)\n \t&& expr_no_side_effects_p (@1))\n    @2)))\n \n-/* x != CST1 ? x + CST2 : 0 -> x + CST2 when CST1 == -CST2.  */\n-(simplify\n- (cond (ne @0 INTEGER_CST@2) (plus@1 @0 INTEGER_CST@3) integer_zerop)\n- (if (wi::to_wide (@2) == -wi::to_wide (@3))\n-  @1))\n+/* x != CST1 ? x + CST2 : CST3 -> x + CST2 when CST1 + CST2 == CST3.\n+ * This handles both scalars and uniform vectors. */\n+(for cnd (cond vec_cond)\n+ (simplify\n+  (cnd (ne @0 uniform_integer_cst_p@1)\n+       (plus@2 @0 uniform_integer_cst_p@3)\n+       uniform_integer_cst_p@4)\n+  (with {\n+    tree cst1 = uniform_integer_cst_p (@1);\n+    tree cst2 = uniform_integer_cst_p (@3);\n+    tree cst3 = uniform_integer_cst_p (@4);\n+  }\n+  (if (wi::to_wide (cst1) + wi::to_wide (cst2) == wi::to_wide (cst3))\n+   @2))))\n \n /* Simplifications of shift and rotates.  */\n \ndiff --git a/gcc/testsuite/g++.dg/tree-ssa/cond-add-vec-1.C b/gcc/testsuite/g++.dg/tree-ssa/cond-add-vec-1.C\nnew file mode 100644\nindex 00000000000..d095a8d9fcd\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/tree-ssa/cond-add-vec-1.C\n@@ -0,0 +1,49 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O2 -fdump-tree-optimized\" } */\n+\n+#define vector4 __attribute__((vector_size(4*sizeof(int))))\n+#define vector4_u8 __attribute__((vector_size(4*sizeof(unsigned char))))\n+#define vector4_u32 __attribute__((vector_size(4*sizeof(unsigned int))))\n+#define vector2_u64 __attribute__((vector_size(2*sizeof(unsigned long))))\n+\n+void unopt(vector4 int *v) {\n+  vector4 int t = *v;\n+  vector4 int t1 = t + 8;\n+  *v = (t != -8) ? (t1) : (vector4 int){0, 0, 0, 0};\n+}\n+\n+vector2_u64 unsigned long f1 (vector2_u64 unsigned long x) { \n+  return x != (vector2_u64 unsigned long){5, 5}\n+\t ? x + (vector2_u64 unsigned long){10, 10}\n+\t : (vector2_u64 unsigned long){15, 15}; \n+}\n+\n+vector4_u32 unsigned int f2 (vector4_u32 unsigned int x)\n+{ \n+  return x != (vector4_u32 unsigned int){20, 20, 20, 20}\n+\t ? x - (vector4_u32 unsigned int){5, 5, 5, 5}\n+\t : (vector4_u32 unsigned int){15, 15, 15, 15}; \n+}\n+\n+vector4_u8 unsigned char\n+f3 (vector4_u8 unsigned char x)\n+{\n+  return x != (vector4_u8 unsigned char){100, 100, 100, 100}\n+\t ? x + (vector4_u8 unsigned char){166, 166, 166, 166}\n+\t : (vector4_u8 unsigned char){10, 10, 10, 10};\n+}\n+\n+vector4 int g1 (vector4 int x) {\n+  vector4 int cst1 = {5, 1};\n+  vector4 int cst2 = {10, 2};\n+  vector4 int cst3 = {15, 3};\n+  return x != cst1 ? x + cst2 : cst3;\n+}\n+\n+vector2_u64 unsigned long g2 (vector2_u64 unsigned long x) { \n+  return x != (vector2_u64 unsigned long){10, 10}\n+\t ? x + (vector2_u64 unsigned long){20, 20}\n+\t : (vector2_u64 unsigned long){40, 40}; \n+}\n+\n+/* { dg-final { scan-tree-dump-times \".VCOND_MASK\" 2 \"optimized\" } } */\ndiff --git a/gcc/testsuite/gcc.dg/tree-ssa/cond-add-1.c b/gcc/testsuite/gcc.dg/tree-ssa/cond-add-1.c\nnew file mode 100644\nindex 00000000000..8b851d8350c\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/tree-ssa/cond-add-1.c\n@@ -0,0 +1,26 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O2 -fdump-tree-optimized\" } */\n+\n+typedef unsigned char u8;\n+typedef unsigned short u16;\n+typedef unsigned int u32;\n+typedef unsigned long u64;\n+\n+u64 f1 (u64 x) { return x != 5 ? x + 10 : 15; }\n+\n+u32 f2 (u32 x) { return x != 20 ? x - 5 : 15; }\n+\n+u16 f3 (u16 x) { return x == 100 ? 150 : x + 50; }\n+\n+u8  f4 (u8 x)  { return x != 250 ? x + 2 : 252; }\n+\n+u8  f5 (u8 x) {\n+  if (x == 100)\n+    return 10;\n+  else\n+    return x + 166;\n+}\n+\n+u64 g1 (u64 x) { return x != 10 ? x + 20 : 40; }\n+\n+/* { dg-final { scan-tree-dump-times \"if \" 1 \"optimized\" } } */\n",
    "prefixes": []
}