get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 815402,
    "url": "http://patchwork.ozlabs.org/api/patches/815402/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1505815439-18720-2-git-send-email-wei.guo.simon@gmail.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<1505815439-18720-2-git-send-email-wei.guo.simon@gmail.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1505815439-18720-2-git-send-email-wei.guo.simon@gmail.com/",
    "date": "2017-09-19T10:03:57",
    "name": "[v1,1/3] powerpc: Align bytes before fall back to .Lshort in powerpc memcmp",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8e2bc54dcf3461b192ba699222daac97eb0c1021",
    "submitter": {
        "id": 68632,
        "url": "http://patchwork.ozlabs.org/api/people/68632/?format=api",
        "name": "Simon Guo",
        "email": "wei.guo.simon@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1505815439-18720-2-git-send-email-wei.guo.simon@gmail.com/mbox/",
    "series": [
        {
            "id": 3823,
            "url": "http://patchwork.ozlabs.org/api/series/3823/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=3823",
            "date": "2017-09-19T10:03:56",
            "name": "powerpc: memcmp() optimization",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3823/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/815402/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/815402/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxJV11ph8z9ryr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 20:08:09 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xxJV10c1yzDqYG\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 20:08:09 +1000 (AEST)",
            "from mail-pg0-x241.google.com (mail-pg0-x241.google.com\n\t[IPv6:2607:f8b0:400e:c05::241])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xxJPj02LrzDq8f\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 19 Sep 2017 20:04:25 +1000 (AEST)",
            "by mail-pg0-x241.google.com with SMTP id i130so1797045pgc.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 19 Sep 2017 03:04:24 -0700 (PDT)",
            "from simonLocalRHEL7.x64 ([112.73.6.48])\n\tby smtp.gmail.com with ESMTPSA id\n\tf10sm2911307pgr.67.2017.09.19.03.04.20\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 03:04:22 -0700 (PDT)"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"hS0HARvU\"; dkim-atps=neutral",
            "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"hS0HARvU\"; dkim-atps=neutral",
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com;\n\tenvelope-from=wei.guo.simon@gmail.com; receiver=<UNKNOWN>)",
            "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"hS0HARvU\"; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=4ohzZvFun9UxjFlCym65D4uwe2GYAEso1wGKUGMw8Q0=;\n\tb=hS0HARvUz3895ODIzAdr7WdB+2OYAaC9a6P5eJQAu3VXFvPw4LP8QFqeXdq+PDBWbS\n\tgu0ELBikfXXh2Oc/Ej/DMAOqalwokQB5kgldr+2v7i/l9lPLl0lcMk6g1sldPf1o1/xh\n\tyDgXJxZYTHuO2FI3+5/rhlOFzxspy+36s7tMSRle6yFbqUghGiJAuj+/4So5Twc/AAwH\n\tptZYHOkXIM9MePARrXm+WmrS9ISY5eW74GsrTEXyuBjgBAOnN27EBz9vBzPvwZPynJ7y\n\t19993NEbXDzmENX+XCmCkWfVLzaeBcKEu7N94D7zXFCBUyz/Ev5nQXz8lLyx8eYT4+76\n\tUTrA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=4ohzZvFun9UxjFlCym65D4uwe2GYAEso1wGKUGMw8Q0=;\n\tb=IuUWbo21urkExmiWAks2NmNWsjYeDfpWZEwGfCW8hmh2uYkZWqOqBVa6rJx6m08JE9\n\tFGL91hdCSzfZ3Tnur52c5mdQ61TUjHU4k3KVaXMYFgbXxH1UusRvW1ma2qUgc4UwYSZH\n\tE1b3AGZm5EnvImG9kC+G9C4DvCfeeaXL4A0QMq50uTvPutqOdyvbzyAuQDXxk94RUamg\n\tNvspAWrVhFnD4XxTCCNICcU5IoOH164dDQVHiW9ZNTWewxA+H1zjtgh/OS+ScCK8KwBa\n\t3KCDtgAaQS0c7J8XTOlTLK/jGl0apHIxGAq2dSGr4Y4i/tJCALsU6xrjyJq6LM8qCmhe\n\tYDgQ==",
        "X-Gm-Message-State": "AHPjjUi+G33zqnZ/OMl5/r1dIz39jGxF7LEjuTwpTzd7PHbo61jWqGVi\n\teOwrza1ppBB7R8EUz5Ux3xYHOA==",
        "X-Google-Smtp-Source": "AOwi7QDtrM29cnHat3tjexYtLR7o40zAMR/GtWwPwLls8yncVU5TD1ulexeVh2OgKGlukWIKo07mbw==",
        "X-Received": "by 10.99.6.140 with SMTP id 134mr782296pgg.199.1505815463020;\n\tTue, 19 Sep 2017 03:04:23 -0700 (PDT)",
        "From": "wei.guo.simon@gmail.com",
        "To": "linuxppc-dev@lists.ozlabs.org",
        "Subject": "[PATCH v1 1/3] powerpc: Align bytes before fall back to .Lshort in\n\tpowerpc memcmp",
        "Date": "Tue, 19 Sep 2017 18:03:57 +0800",
        "Message-Id": "<1505815439-18720-2-git-send-email-wei.guo.simon@gmail.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1505815439-18720-1-git-send-email-wei.guo.simon@gmail.com>",
        "References": "<1505815439-18720-1-git-send-email-wei.guo.simon@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.24",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "\"Naveen N.  Rao\" <naveen.n.rao@linux.vnet.ibm.com>,\n\tSimon Guo <wei.guo.simon@gmail.com>",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"
    },
    "content": "From: Simon Guo <wei.guo.simon@gmail.com>\n\nCurrently memcmp() in powerpc will fall back to .Lshort (compare per byte\nmode) if either src or dst address is not 8 bytes aligned. It can be\nopmitized if both addresses are with the same offset with 8 bytes boundary.\n\nmemcmp() can align the src/dst address with 8 bytes firstly and then\ncompare with .Llong mode.\n\nThis patch optmizes memcmp() behavior in this situation.\n\nTest result:\n\n(1) 256 bytes\nTest with the existing tools/testing/selftests/powerpc/stringloops/memcmp:\n- without patch\n\t50.715169506 seconds time elapsed                                          ( +-  0.04% )\n- with patch\n\t28.906602373 seconds time elapsed                                          ( +-  0.02% )\n\t\t-> There is ~+75% percent improvement.\n\n(2) 32 bytes\nTo observe performance impact on < 32 bytes, modify\ntools/testing/selftests/powerpc/stringloops/memcmp.c with following:\n-------\n #include <string.h>\n #include \"utils.h\"\n\n-#define SIZE 256\n+#define SIZE 32\n #define ITERATIONS 10000\n\n int test_memcmp(const void *s1, const void *s2, size_t n);\n--------\n\n- Without patch\n\t0.390677136 seconds time elapsed                                          ( +-  0.03% )\n- with patch\n\t0.375685926 seconds time elapsed                                          ( +-  0.05% )\n\t\t-> There is ~+4% improvement\n\n(3) 0~8 bytes\nTo observe <8 bytes performance impact, modify\ntools/testing/selftests/powerpc/stringloops/memcmp.c with following:\n-------\n #include <string.h>\n #include \"utils.h\"\n\n-#define SIZE 256\n-#define ITERATIONS 10000\n+#define SIZE 8\n+#define ITERATIONS 100000\n\n int test_memcmp(const void *s1, const void *s2, size_t n);\n-------\n- Without patch\n\t3.169203981 seconds time elapsed                                          ( +-  0.23% )\n- With patch\n\t3.208257362 seconds time elapsed                                          ( +-  0.13% )\n\t\t-> There is ~ -1% decrease.\n(I don't know why yet, since there are the same number of instructions\nin the code path for 0~8 bytes memcmp() with/without this patch.  Any\ncomments will be appreciated).\n\nSigned-off-by: Simon Guo <wei.guo.simon@gmail.com>\n---\n arch/powerpc/lib/memcmp_64.S | 86 +++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 82 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/arch/powerpc/lib/memcmp_64.S b/arch/powerpc/lib/memcmp_64.S\nindex d75d18b..6dbafdb 100644\n--- a/arch/powerpc/lib/memcmp_64.S\n+++ b/arch/powerpc/lib/memcmp_64.S\n@@ -24,25 +24,95 @@\n #define rH\tr31\n \n #ifdef __LITTLE_ENDIAN__\n+#define LH\tlhbrx\n+#define LW\tlwbrx\n #define LD\tldbrx\n #else\n+#define LH\tlhzx\n+#define LW\tlwzx\n #define LD\tldx\n #endif\n \n _GLOBAL(memcmp)\n \tcmpdi\tcr1,r5,0\n \n-\t/* Use the short loop if both strings are not 8B aligned */\n-\tor\tr6,r3,r4\n+\t/* Use the short loop if the src/dst addresses are not\n+\t * with the same offset of 8 bytes align boundary.\n+\t */\n+\txor\tr6,r3,r4\n \tandi.\tr6,r6,7\n \n-\t/* Use the short loop if length is less than 32B */\n-\tcmpdi\tcr6,r5,31\n+\t/* fall back to short loop if compare at aligned addrs\n+\t * with no greater than 8 bytes.\n+\t */\n+\tcmpdi   cr6,r5,8\n \n \tbeq\tcr1,.Lzero\n \tbne\t.Lshort\n+\tble\tcr6,.Lshort\n+\n+.Lalignbytes_start:\n+\t/* The bits 0/1/2 of src/dst addr are the same. */\n+\tneg\tr0,r3\n+\tandi.\tr0,r0,7\n+\tbeq\t.Lalign8bytes\n+\n+\tPPC_MTOCRF(1,r0)\n+\tbf\t31,.Lalign2bytes\n+\tlbz\trA,0(r3)\n+\tlbz\trB,0(r4)\n+\tcmplw\tcr0,rA,rB\n+\tbne\tcr0,.LcmpAB_lightweight\n+\taddi\tr3,r3,1\n+\taddi\tr4,r4,1\n+\tsubi\tr5,r5,1\n+.Lalign2bytes:\n+\tbf\t30,.Lalign4bytes\n+\tLH\trA,0,r3\n+\tLH\trB,0,r4\n+\tcmplw\tcr0,rA,rB\n+\tbne\tcr0,.LcmpAB_lightweight\n+\tbne\t.Lnon_zero\n+\taddi\tr3,r3,2\n+\taddi\tr4,r4,2\n+\tsubi\tr5,r5,2\n+.Lalign4bytes:\n+\tbf\t29,.Lalign8bytes\n+\tLW\trA,0,r3\n+\tLW\trB,0,r4\n+\tcmpld\tcr0,rA,rB\n+\tbne\tcr0,.LcmpAB_lightweight\n+\taddi\tr3,r3,4\n+\taddi\tr4,r4,4\n+\tsubi\tr5,r5,4\n+.Lalign8bytes:\n+\t/* Now addrs are aligned with 8 bytes. Use the short loop if left\n+\t * bytes are less than 8B.\n+\t */\n+\tcmpdi   cr6,r5,7\n+\tble\tcr6,.Lshort\n+\n+\t/* Use .Llong loop if left cmp bytes are equal or greater than 32B */\n+\tcmpdi   cr6,r5,31\n \tbgt\tcr6,.Llong\n \n+.Lcmploop_8bytes_31bytes:\n+\t/* handle 8 ~ 31 bytes with 8 bytes aligned addrs */\n+\tsrdi.   r0,r5,3\n+\tclrldi  r5,r5,61\n+\tmtctr   r0\n+831:\n+\tLD\trA,0,r3\n+\tLD\trB,0,r4\n+\tcmpld\tcr0,rA,rB\n+\tbne\tcr0,.LcmpAB_lightweight\n+\taddi\tr3,r3,8\n+\taddi\tr4,r4,8\n+\tbdnz\t831b\n+\n+\tcmpwi   r5,0\n+\tbeq\t.Lzero\n+\n .Lshort:\n \tmtctr\tr5\n \n@@ -232,4 +302,12 @@ _GLOBAL(memcmp)\n \tld\tr28,-32(r1)\n \tld\tr27,-40(r1)\n \tblr\n+\n+.LcmpAB_lightweight:   /* skip NV GPRS restore */\n+\tli\tr3,1\n+\tbgt\tcr0,8f\n+\tli\tr3,-1\n+8:\n+\tblr\n+\n EXPORT_SYMBOL(memcmp)\n",
    "prefixes": [
        "v1",
        "1/3"
    ]
}