get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806775,
    "url": "http://patchwork.ozlabs.org/api/patches/806775/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/d6adf5bf-1dea-b7ac-0021-00f4857bc264@linux.vnet.ibm.com/",
    "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": "<d6adf5bf-1dea-b7ac-0021-00f4857bc264@linux.vnet.ibm.com>",
    "list_archive_url": null,
    "date": "2017-08-28T21:34:16",
    "name": "[rs6000] Stop non-volatile CR usage from killing shrink-wrap",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fafaa6f75fe766e53544a0819df13e03d2211bea",
    "submitter": {
        "id": 5186,
        "url": "http://patchwork.ozlabs.org/api/people/5186/?format=api",
        "name": "Pat Haugen",
        "email": "pthaugen@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/d6adf5bf-1dea-b7ac-0021-00f4857bc264@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 263,
            "url": "http://patchwork.ozlabs.org/api/series/263/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=263",
            "date": "2017-08-28T21:34:16",
            "name": "[rs6000] Stop non-volatile CR usage from killing shrink-wrap",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/263/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806775/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806775/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-return-461051-incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "mailing list gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461051-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"hE2L06oq\"; dkim-atps=neutral",
            "sourceware.org; auth=none"
        ],
        "Received": [
            "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xh4my3f59z9t2M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 07:35:12 +1000 (AEST)",
            "(qmail 80165 invoked by alias); 28 Aug 2017 21:34:36 -0000",
            "(qmail 80141 invoked by uid 89); 28 Aug 2017 21:34:34 -0000",
            "from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com)\n\t(148.163.156.1) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 28 Aug 2017 21:34:24 +0000",
            "from pps.filterd (m0098393.ppops.net [127.0.0.1])\tby\n\tmx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7SLXxbw049142\tfor <gcc-patches@gcc.gnu.org>;\n\tMon, 28 Aug 2017 17:34:21 -0400",
            "from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151])\tby\n\tmx0a-001b2d01.pphosted.com with ESMTP id\n\t2cmnx0suj3-1\t(version=TLSv1.2 cipher=AES256-SHA bits=256\n\tverify=NOT)\tfor <gcc-patches@gcc.gnu.org>;\n\tMon, 28 Aug 2017 17:34:21 -0400",
            "from localhost\tby e33.co.us.ibm.com with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted\tfor\n\t<gcc-patches@gcc.gnu.org> from <pthaugen@linux.vnet.ibm.com>;\n\tMon, 28 Aug 2017 15:34:20 -0600",
            "from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19)\tby\n\te33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted;\n\tMon, 28 Aug 2017 15:34:17 -0600",
            "from b03ledav003.gho.boulder.ibm.com\n\t(b03ledav003.gho.boulder.ibm.com [9.17.130.234])\tby\n\tb03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0)\n\twith ESMTP id v7SLYHfv64290978; Mon, 28 Aug 2017 14:34:17 -0700",
            "from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1])\tby\n\tIMSVA (Postfix) with ESMTP id 65A2B6A03B;\n\tMon, 28 Aug 2017 15:34:17 -0600 (MDT)",
            "from oc1687012634.ibm.com (unknown [9.10.86.124])\tby\n\tb03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id\n\t290056A041; Mon, 28 Aug 2017 15:34:17 -0600 (MDT)"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:subject:to:cc:date:mime-version:content-type:message-id; q=dns;\n\ts=default; b=Ow6EJW5+rIzeCEE4ZgPqi34bRrcmR4szoGgDBRo/X3EBdtBK4b\n\tSfuSjOjJ7CWH0MhsQY5pkzxNldk7OW7w59xTQXpleitocSUcTbPBZScaVEB8J4LM\n\tU5gGaU/SKk20ihJRSjP9rpZp/WmSwXD2mZZDBiqtB6MzfXtkRpCLlXR/Y=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:subject:to:cc:date:mime-version:content-type:message-id; s=\n\tdefault; bh=ceABui6EqFo2l7TcGrQDxQzTgKo=; b=hE2L06oqVvpJ1/Oi70GV\n\tjoqGgfU7pL1tSxSpgxfDy8VRVIEU5edVJVS8sql7jEdIFOYHVJG0dubAeVUCXl30\n\tmui0lVEIXtnDqPOkF+UL6nDS0gC3wLIrGCJNjn69r7vzmdAJ9K1/d7puQDlKiBav\n\t+ef51NEHczJeu3Z4sK41d3U=",
        "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm",
        "Precedence": "bulk",
        "List-Id": "<gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>",
        "Sender": "gcc-patches-owner@gcc.gnu.org",
        "X-Virus-Found": "No",
        "X-Spam-SWARE-Status": "No, score=-10.2 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tKAM_LAZY_DOMAIN_SECURITY,\n\tRCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=crs",
        "X-HELO": "mx0a-001b2d01.pphosted.com",
        "From": "Pat Haugen <pthaugen@linux.vnet.ibm.com>",
        "Subject": "[PATCH, rs6000] Stop non-volatile CR usage from killing shrink-wrap",
        "To": "GCC Patches <gcc-patches@gcc.gnu.org>",
        "Cc": "Segher Boessenkool <segher@gcc.gnu.org>,\n\tDavid Edelsohn <dje.gcc@gmail.com>",
        "Date": "Mon, 28 Aug 2017 16:34:16 -0500",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.0",
        "MIME-Version": "1.0",
        "Content-Type": "multipart/mixed;\n\tboundary=\"------------433237EF5E28848115227F4C\"",
        "X-TM-AS-GCONF": "00",
        "x-cbid": "17082821-0008-0000-0000-0000087D1B6E",
        "X-IBM-SpamModules-Scores": "",
        "X-IBM-SpamModules-Versions": "BY=3.00007629; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000226; SDB=6.00908974; UDB=6.00455817;\n\tIPR=6.00689225; BA=6.00005557; NDR=6.00000001; ZLA=6.00000005;\n\tZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000;\n\tZU=6.00000002; MB=3.00016907; XFM=3.00000015;\n\tUTC=2017-08-28 21:34:19",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17082821-0009-0000-0000-000043BFEE47",
        "Message-Id": "<d6adf5bf-1dea-b7ac-0021-00f4857bc264@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-28_12:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0 malwarescore=0 phishscore=0\n\tadultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx\n\tscancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708280335",
        "X-IsSubscribed": "yes"
    },
    "content": "The following patch allows shrink-wrapping to succeed in the presence of\nnon-volatile CR save/restore. The movesi_from_cr define_insn used to\nlist all CRs as used, even though it's only the non-volatile values that\nwe are interested in saving/restoring. This prevented the prolog from\nbeing moved past the early exit test because that compare was defining a\nregister used in the prolog (a volatile CR). The patch removes the\nmentions of the volatile CRs and renames the functions involved so that\nit's hopefully clear they are for prolog generation only.\n\nBootstrap/regtest on powerpc64le-linux with no new regressions. Ok for\ntrunk?\n\n-Pat\n\n\n\n2017-08-28  Pat Haugen  <pthaugen@us.ibm.com>\n\n\t* config/rs6000/rs6000.c (rs6000_emit_prolog_move_from_cr): Rename from\n\trs6000_emit_move_from_cr and call renamed function.\n\t(rs6000_emit_prologue): Call renamed functions.\n\t* config/rs6000/rs6000.md (prolog_movesi_from_cr): Rename from\n\tprolog_movesi_from_cr, remove volatile CRs.\n\n\ntestsuite/ChangeLog:\n2017-08-28  Pat Haugen  <pthaugen@us.ibm.com>\n\n\t* gcc.target/powerpc/cr_shrink-wrap.c: New.",
    "diff": "Index: gcc/config/rs6000/rs6000.c\n===================================================================\n--- gcc/config/rs6000/rs6000.c\t(revision 251389)\n+++ gcc/config/rs6000/rs6000.c\t(working copy)\n@@ -26083,10 +26083,14 @@ rs6000_emit_savres_rtx (rs6000_stack_t *\n   return insn;\n }\n \n-/* Emit code to store CR fields that need to be saved into REG.  */\n+/* Emit prolog code to store CR fields that need to be saved into REG. This\n+   function should only be called when moving the non-volatile CRs to REG, it\n+   is not a general purpose routine to move the entire set of CRs to REG.\n+   Specifically, gen_prolog_movesi_from_cr() does not contain uses of the\n+   volatile CRs.  */\n \n static void\n-rs6000_emit_move_from_cr (rtx reg)\n+rs6000_emit_prolog_move_from_cr (rtx reg)\n {\n   /* Only the ELFv2 ABI allows storing only selected fields.  */\n   if (DEFAULT_ABI == ABI_ELFv2 && TARGET_MFCRF)\n@@ -26117,7 +26121,7 @@ rs6000_emit_move_from_cr (rtx reg)\n \t as well, using logical operations to combine the values.  */\n     }\n \n-  emit_insn (gen_movesi_from_cr (reg));\n+  emit_insn (gen_prolog_movesi_from_cr (reg));\n }\n \n /* Return whether the split-stack arg pointer (r12) is used.  */\n@@ -26857,7 +26861,7 @@ rs6000_emit_prologue (void)\n     {\n       cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno);\n       START_USE (cr_save_regno);\n-      rs6000_emit_move_from_cr (cr_save_rtx);\n+      rs6000_emit_prolog_move_from_cr (cr_save_rtx);\n     }\n \n   /* Do any required saving of fpr's.  If only one or two to save, do\n@@ -27095,7 +27099,7 @@ rs6000_emit_prologue (void)\n \t{\n \t  START_USE (0);\n \t  cr_save_rtx = gen_rtx_REG (SImode, 0);\n-\t  rs6000_emit_move_from_cr (cr_save_rtx);\n+\t  rs6000_emit_prolog_move_from_cr (cr_save_rtx);\n \t}\n \n       /* Saving CR requires a two-instruction sequence: one instruction\n@@ -27182,7 +27186,7 @@ rs6000_emit_prologue (void)\n       /* ??? We might get better performance by using multiple mfocrf\n \t instructions.  */\n       crsave = gen_rtx_REG (SImode, 0);\n-      emit_insn (gen_movesi_from_cr (crsave));\n+      emit_insn (gen_prolog_movesi_from_cr (crsave));\n \n       for (i = 0; i < 8; i++)\n \tif (!call_used_regs[CR0_REGNO + i])\nIndex: gcc/config/rs6000/rs6000.md\n===================================================================\n--- gcc/config/rs6000/rs6000.md\t(revision 251389)\n+++ gcc/config/rs6000/rs6000.md\t(working copy)\n@@ -13032,12 +13032,14 @@ (define_insn \"*movesi_from_cr_one\"\n }\"\n   [(set_attr \"type\" \"mfcrf\")])\n \n-(define_insn \"movesi_from_cr\"\n+;; Don't include the volatile CRs since their values are not used wrt CR save\n+;; in the prolog and doing so prevents shrink-wrapping because we can't move the\n+;; prolog past an insn (early exit test) that defines a register used in the\n+;; prolog.\n+(define_insn \"prolog_movesi_from_cr\"\n   [(set (match_operand:SI 0 \"gpc_reg_operand\" \"=r\")\n-        (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)\n-\t\t    (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)\n-\t\t    (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)\n-\t\t    (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]\n+        (unspec:SI [(reg:CC CR2_REGNO) (reg:CC CR3_REGNO)\n+\t\t    (reg:CC CR4_REGNO)]\n \t\t   UNSPEC_MOVESI_FROM_CR))]\n   \"\"\n   \"mfcr %0\"\nIndex: gcc/testsuite/gcc.target/powerpc/cr_shrink-wrap.c\n===================================================================\n--- gcc/testsuite/gcc.target/powerpc/cr_shrink-wrap.c\t(nonexistent)\n+++ gcc/testsuite/gcc.target/powerpc/cr_shrink-wrap.c\t(working copy)\n@@ -0,0 +1,11 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O2 -fdump-rtl-pro_and_epilogue\" } */\n+\n+void foo(int i)\n+{\n+  if (i > 0)\n+    /* Non-volatile CR kill on true path should not prevent shrink-wrap.  */\n+    asm (\"\" : : : \"cr2\", \"cr3\");\n+}\n+\n+/* { dg-final { scan-rtl-dump-times \"Performing shrink-wrapping\" 1 \"pro_and_epilogue\" } } */\n",
    "prefixes": [
        "rs6000"
    ]
}