get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806434,
    "url": "http://patchwork.ozlabs.org/api/patches/806434/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/87shgct84a.fsf@linaro.org/",
    "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": "<87shgct84a.fsf@linaro.org>",
    "list_archive_url": null,
    "date": "2017-08-28T08:21:57",
    "name": "Add subreg_memory_offset helper functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4e7f815c3d6cb390a0c666c01f9a22536657d676",
    "submitter": {
        "id": 5450,
        "url": "http://patchwork.ozlabs.org/api/people/5450/?format=api",
        "name": "Richard Sandiford",
        "email": "richard.sandiford@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/87shgct84a.fsf@linaro.org/mbox/",
    "series": [
        {
            "id": 100,
            "url": "http://patchwork.ozlabs.org/api/series/100/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=100",
            "date": "2017-08-28T08:21:57",
            "name": "Add subreg_memory_offset helper functions",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/100/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806434/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806434/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-return-460997-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-460997-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=\"oh1gMz4C\"; 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 3xgl9y1rcsz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 18:22:14 +1000 (AEST)",
            "(qmail 100029 invoked by alias); 28 Aug 2017 08:22:03 -0000",
            "(qmail 99973 invoked by uid 89); 28 Aug 2017 08:21:58 -0000",
            "from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com)\n\t(209.85.128.175) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 28 Aug 2017 08:21:53 +0000",
            "by mail-wr0-f175.google.com with SMTP id y14so8166170wrd.5 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 28 Aug 2017 01:21:53 -0700 (PDT)",
            "from localhost ([95.145.139.63]) by smtp.gmail.com with ESMTPSA id\n\tu127sm8271740wmd.15.2017.08.28.01.21.49 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 28 Aug 2017 01:21:50 -0700 (PDT)"
        ],
        "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:to:subject:date:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=jldX0QRyuxdHLkIwfUJA/5bESjpJQG5c6t239lkNsWVZgRGU07kK7\n\tqD07RPsuxSDdiXKUGcYaba2R8ioBF4Wtz1JZsXTimKi+ApwE4KVgNsDA5iU6f3+H\n\tG+Mac8cR5HxDKXuypFRlFdISCYypEnCaNn1Ngt4FCe1D98ahgsv800=",
        "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:to:subject:date:message-id:mime-version:content-type; s=\n\tdefault; bh=D8iNad2JVsrjZxx05LrWwsxNia8=; b=oh1gMz4C5YAG+Vfkly01\n\toDSAAT7wZx2OcIastMJSYQEqWJZD6wqvaPgEjSHun07d7wXOeJLuc6zHc7RzaaEi\n\tGi8RGhOsXWt6LBwrbarISLF/Tz/zCVyEsXagNlf8cUCa86EFfiOlq1hAIKTNnpd/\n\tHOb/nXcnHXVoU5ps8M/1ACQ=",
        "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=-11.0 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=irritating",
        "X-HELO": "mail-wr0-f175.google.com",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id\n\t:user-agent:mime-version;\n\tbh=ig1DXQX2IVVPeRAK05dIi7+TLdsoqdF5+WaD5LNU64s=;\n\tb=WnpIQbgpq3yWAtIG0/Ppi8wKuy5GtGDjtZ9JCfp66mZgWHKgH/uRXvuj2al9DIY7bz\n\tfSzYvWf2qk9vawiRYH4WTSU4LFSzM46K8WDzcNZEkPb4pj05sptTcgEeLDz++Kca3Fo9\n\t6cg3tclfa0/r8UbxbZxP2Xh79gyov1AlMEimUU95xTmV8gxZs+D/belCfkuLVeFt75vV\n\tUHd3TBX0Sc7iLKfjCjCg0V8+zZEWR3zrnqeWfmE6yJ/Httx3DJ2RPluGg/3lCrQViGUt\n\tQ1FeG8pwOQIbQj7SyS1kOBhRUMqgKLDmUsCFf4KaQ7vm4TA1fVjCPfK9sBqkvkDiXFix\n\tK/Iw==",
        "X-Gm-Message-State": "AHYfb5gT1/IchWGJpOMPpHliFDWPLdxFZerfzBwQ1aVNx314iud2seVB\t89ABX21fw4IO62DBF/oyNw==",
        "X-Received": "by 10.223.130.45 with SMTP id 42mr3866924wrb.327.1503908511238;\n\tMon, 28 Aug 2017 01:21:51 -0700 (PDT)",
        "From": "Richard Sandiford <richard.sandiford@linaro.org>",
        "To": "gcc-patches@gcc.gnu.org",
        "Mail-Followup-To": "gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org",
        "Subject": "Add subreg_memory_offset helper functions",
        "Date": "Mon, 28 Aug 2017 09:21:57 +0100",
        "Message-ID": "<87shgct84a.fsf@linaro.org>",
        "User-Agent": "Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain"
    },
    "content": "This patch adds routines for converting a SUBREG_BYTE offset into a\nmemory address offset.  The two only differ for paradoxical subregs,\nwhere SUBREG_BYTE is always 0 but the memory address offset can be\nnegative.\n\nTested on aarch64-linux-gnu and x86_64-linux-gnu, and by checking\nthere was no change in the testsuite assembly output for at least\none target per CPU.  OK to install?\n\nRichard\n\n\n2017-08-28  Richard Sandiford  <richard.sandiford@linaro.org>\n\t    Alan Hayward  <alan.hayward@arm.com>\n\t    David Sherwood  <david.sherwood@arm.com>\n\ngcc/\n\t* rtl.h (subreg_memory_offset): Declare.\n\t* emit-rtl.c (subreg_memory_offset): New function.\n\t* expmed.c (store_bit_field_1): Use it.\n\t* expr.c (undefined_operand_subword_p): Likewise.\n\t* simplify-rtx.c (simplify_subreg): Likewise.",
    "diff": "Index: gcc/rtl.h\n===================================================================\n--- gcc/rtl.h\t2017-08-27 23:19:56.284397205 +0100\n+++ gcc/rtl.h\t2017-08-28 09:19:13.737714836 +0100\n@@ -2827,6 +2827,8 @@ subreg_highpart_offset (machine_mode out\n }\n \n extern int byte_lowpart_offset (machine_mode, machine_mode);\n+extern int subreg_memory_offset (machine_mode, machine_mode, unsigned int);\n+extern int subreg_memory_offset (const_rtx);\n extern rtx make_safe_from (rtx, rtx);\n extern rtx convert_memory_address_addr_space_1 (machine_mode, rtx,\n \t\t\t\t\t\taddr_space_t, bool, bool);\nIndex: gcc/emit-rtl.c\n===================================================================\n--- gcc/emit-rtl.c\t2017-08-22 17:14:30.335896832 +0100\n+++ gcc/emit-rtl.c\t2017-08-28 09:19:13.736814836 +0100\n@@ -1013,6 +1013,33 @@ byte_lowpart_offset (machine_mode outer_\n   else\n     return subreg_lowpart_offset (outer_mode, inner_mode);\n }\n+\n+/* Return the offset of (subreg:OUTER_MODE (mem:INNER_MODE X) OFFSET)\n+   from address X.  For paradoxical big-endian subregs this is a\n+   negative value, otherwise it's the same as OFFSET.  */\n+\n+int\n+subreg_memory_offset (machine_mode outer_mode, machine_mode inner_mode,\n+\t\t      unsigned int offset)\n+{\n+  if (paradoxical_subreg_p (outer_mode, inner_mode))\n+    {\n+      gcc_assert (offset == 0);\n+      return -subreg_lowpart_offset (inner_mode, outer_mode);\n+    }\n+  return offset;\n+}\n+\n+/* As above, but return the offset that existing subreg X would have\n+   if SUBREG_REG (X) were stored in memory.  The only significant thing\n+   about the current SUBREG_REG is its mode.  */\n+\n+int\n+subreg_memory_offset (const_rtx x)\n+{\n+  return subreg_memory_offset (GET_MODE (x), GET_MODE (SUBREG_REG (x)),\n+\t\t\t       SUBREG_BYTE (x));\n+}\n \f\n /* Generate a REG rtx for a new pseudo register of mode MODE.\n    This pseudo is assigned the next sequential register number.  */\nIndex: gcc/expmed.c\n===================================================================\n--- gcc/expmed.c\t2017-08-27 23:19:56.284397205 +0100\n+++ gcc/expmed.c\t2017-08-28 09:19:13.736814836 +0100\n@@ -726,29 +726,7 @@ store_bit_field_1 (rtx str_rtx, unsigned\n \n   while (GET_CODE (op0) == SUBREG)\n     {\n-      /* The following line once was done only if WORDS_BIG_ENDIAN,\n-\t but I think that is a mistake.  WORDS_BIG_ENDIAN is\n-\t meaningful at a much higher level; when structures are copied\n-\t between memory and regs, the higher-numbered regs\n-\t always get higher addresses.  */\n-      int inner_mode_size = GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)));\n-      int outer_mode_size = GET_MODE_SIZE (GET_MODE (op0));\n-      int byte_offset = 0;\n-\n-      /* Paradoxical subregs need special handling on big-endian machines.  */\n-      if (paradoxical_subreg_p (op0))\n-\t{\n-\t  int difference = inner_mode_size - outer_mode_size;\n-\n-\t  if (WORDS_BIG_ENDIAN)\n-\t    byte_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-\t  if (BYTES_BIG_ENDIAN)\n-\t    byte_offset += difference % UNITS_PER_WORD;\n-\t}\n-      else\n-\tbyte_offset = SUBREG_BYTE (op0);\n-\n-      bitnum += byte_offset * BITS_PER_UNIT;\n+      bitnum += subreg_memory_offset (op0) * BITS_PER_UNIT;\n       op0 = SUBREG_REG (op0);\n     }\n \nIndex: gcc/expr.c\n===================================================================\n--- gcc/expr.c\t2017-08-27 23:19:56.149397206 +0100\n+++ gcc/expr.c\t2017-08-28 09:19:13.737714836 +0100\n@@ -3524,30 +3524,12 @@ emit_move_ccmode (machine_mode mode, rtx\n static bool\n undefined_operand_subword_p (const_rtx op, int i)\n {\n-  machine_mode innermode, innermostmode;\n-  int offset;\n   if (GET_CODE (op) != SUBREG)\n     return false;\n-  innermode = GET_MODE (op);\n-  innermostmode = GET_MODE (SUBREG_REG (op));\n-  offset = i * UNITS_PER_WORD + SUBREG_BYTE (op);\n-  /* The SUBREG_BYTE represents offset, as if the value were stored in\n-     memory, except for a paradoxical subreg where we define\n-     SUBREG_BYTE to be 0; undo this exception as in\n-     simplify_subreg.  */\n-  if (SUBREG_BYTE (op) == 0\n-      && GET_MODE_SIZE (innermostmode) < GET_MODE_SIZE (innermode))\n-    {\n-      int difference = (GET_MODE_SIZE (innermostmode) - GET_MODE_SIZE (innermode));\n-      if (WORDS_BIG_ENDIAN)\n-\toffset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-      if (BYTES_BIG_ENDIAN)\n-\toffset += difference % UNITS_PER_WORD;\n-    }\n-  if (offset >= GET_MODE_SIZE (innermostmode)\n-      || offset <= -GET_MODE_SIZE (word_mode))\n-    return true;\n-  return false;\n+  machine_mode innermostmode = GET_MODE (SUBREG_REG (op));\n+  HOST_WIDE_INT offset = i * UNITS_PER_WORD + subreg_memory_offset (op);\n+  return (offset >= GET_MODE_SIZE (innermostmode)\n+\t  || offset <= -UNITS_PER_WORD);\n }\n \n /* A subroutine of emit_move_insn_1.  Generate a move from Y into X.\nIndex: gcc/simplify-rtx.c\n===================================================================\n--- gcc/simplify-rtx.c\t2017-08-27 23:19:56.284397205 +0100\n+++ gcc/simplify-rtx.c\t2017-08-28 09:19:13.739514836 +0100\n@@ -6050,34 +6050,18 @@ simplify_subreg (machine_mode outermode,\n   if (GET_CODE (op) == SUBREG)\n     {\n       machine_mode innermostmode = GET_MODE (SUBREG_REG (op));\n-      int final_offset = byte + SUBREG_BYTE (op);\n       rtx newx;\n \n       if (outermode == innermostmode\n \t  && byte == 0 && SUBREG_BYTE (op) == 0)\n \treturn SUBREG_REG (op);\n \n-      /* The SUBREG_BYTE represents offset, as if the value were stored\n-\t in memory.  Irritating exception is paradoxical subreg, where\n-\t we define SUBREG_BYTE to be 0.  On big endian machines, this\n-\t value should be negative.  For a moment, undo this exception.  */\n-      if (byte == 0 && GET_MODE_SIZE (innermode) < GET_MODE_SIZE (outermode))\n-\t{\n-\t  int difference = (GET_MODE_SIZE (innermode) - GET_MODE_SIZE (outermode));\n-\t  if (WORDS_BIG_ENDIAN)\n-\t    final_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-\t  if (BYTES_BIG_ENDIAN)\n-\t    final_offset += difference % UNITS_PER_WORD;\n-\t}\n-      if (SUBREG_BYTE (op) == 0\n-\t  && GET_MODE_SIZE (innermostmode) < GET_MODE_SIZE (innermode))\n-\t{\n-\t  int difference = (GET_MODE_SIZE (innermostmode) - GET_MODE_SIZE (innermode));\n-\t  if (WORDS_BIG_ENDIAN)\n-\t    final_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-\t  if (BYTES_BIG_ENDIAN)\n-\t    final_offset += difference % UNITS_PER_WORD;\n-\t}\n+      /* Work out the memory offset of the final OUTERMODE value relative\n+\t to the inner value of OP.  */\n+      HOST_WIDE_INT mem_offset = subreg_memory_offset (outermode,\n+\t\t\t\t\t\t       innermode, byte);\n+      HOST_WIDE_INT op_mem_offset = subreg_memory_offset (op);\n+      HOST_WIDE_INT final_offset = mem_offset + op_mem_offset;\n \n       /* See whether resulting subreg will be paradoxical.  */\n       if (!paradoxical_subreg_p (outermode, innermostmode))\n@@ -6092,19 +6076,12 @@ simplify_subreg (machine_mode outermode,\n \t}\n       else\n \t{\n-\t  int offset = 0;\n-\t  int difference = (GET_MODE_SIZE (innermostmode) - GET_MODE_SIZE (outermode));\n-\n-\t  /* In paradoxical subreg, see if we are still looking on lower part.\n-\t     If so, our SUBREG_BYTE will be 0.  */\n-\t  if (WORDS_BIG_ENDIAN)\n-\t    offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-\t  if (BYTES_BIG_ENDIAN)\n-\t    offset += difference % UNITS_PER_WORD;\n-\t  if (offset == final_offset)\n-\t    final_offset = 0;\n-\t  else\n+\t  HOST_WIDE_INT required_offset\n+\t    = subreg_memory_offset (outermode, innermostmode, 0);\n+\t  if (final_offset != required_offset)\n \t    return NULL_RTX;\n+\t  /* Paradoxical subregs always have byte offset 0.  */\n+\t  final_offset = 0;\n \t}\n \n       /* Recurse for further possible simplifications.  */\n@@ -6145,22 +6122,9 @@ simplify_subreg (machine_mode outermode,\n       final_regno = simplify_subreg_regno (regno, innermode, byte, outermode);\n       if (HARD_REGISTER_NUM_P (final_regno))\n \t{\n-\t  rtx x;\n-\t  int final_offset = byte;\n-\n-\t  /* Adjust offset for paradoxical subregs.  */\n-\t  if (byte == 0\n-\t      && GET_MODE_SIZE (innermode) < GET_MODE_SIZE (outermode))\n-\t    {\n-\t      int difference = (GET_MODE_SIZE (innermode)\n-\t\t\t\t- GET_MODE_SIZE (outermode));\n-\t      if (WORDS_BIG_ENDIAN)\n-\t\tfinal_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;\n-\t      if (BYTES_BIG_ENDIAN)\n-\t\tfinal_offset += difference % UNITS_PER_WORD;\n-\t    }\n-\n-\t  x = gen_rtx_REG_offset (op, outermode, final_regno, final_offset);\n+\t  rtx x = gen_rtx_REG_offset (op, outermode, final_regno,\n+\t\t\t\t      subreg_memory_offset (outermode,\n+\t\t\t\t\t\t\t    innermode, byte));\n \n \t  /* Propagate original regno.  We don't have any way to specify\n \t     the offset inside original regno, so do so only for lowpart.\n",
    "prefixes": []
}