get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1475701,
    "url": "http://patchwork.ozlabs.org/api/patches/1475701/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20210508014802.892561-3-richard.henderson@linaro.org/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210508014802.892561-3-richard.henderson@linaro.org>",
    "list_archive_url": null,
    "date": "2021-05-08T01:46:52",
    "name": "[02/72] qemu/host-utils: Add wrappers for overflow builtins",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "85c693c1f1393f5df607dce3ea24abc34c197f5f",
    "submitter": {
        "id": 72104,
        "url": "http://patchwork.ozlabs.org/api/people/72104/?format=api",
        "name": "Richard Henderson",
        "email": "richard.henderson@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20210508014802.892561-3-richard.henderson@linaro.org/mbox/",
    "series": [
        {
            "id": 242770,
            "url": "http://patchwork.ozlabs.org/api/series/242770/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=242770",
            "date": "2021-05-08T01:46:53",
            "name": "Convert floatx80 and float128 to FloatParts",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/242770/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1475701/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1475701/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=DDoqlPhH;\n\tdkim-atps=neutral"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4FcVbv3rY9z9sWl\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  8 May 2021 11:49:13 +1000 (AEST)",
            "from localhost ([::1]:43160 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1lfC5e-0003vk-Ct\n\tfor incoming@patchwork.ozlabs.org; Fri, 07 May 2021 21:49:10 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10]:40436)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1lfC4e-0003v6-RF\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:08 -0400",
            "from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:38562)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1lfC4c-0003VN-Qn\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:08 -0400",
            "by mail-pf1-x42e.google.com with SMTP id k19so9143710pfu.5\n for <qemu-devel@nongnu.org>; Fri, 07 May 2021 18:48:06 -0700 (PDT)",
            "from localhost.localdomain ([71.212.144.24])\n by smtp.gmail.com with ESMTPSA id t4sm5819681pfq.165.2021.05.07.18.48.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 07 May 2021 18:48:05 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=4FUAz053Q8O4lxDctUgjdKConowhJ6wTho8iZJwG5rg=;\n b=DDoqlPhHgArnH3rPWW4cCfpZrOdA2CiVAMB3GupObKqU1w3vMVy3mbtHuvpDTdEfgQ\n oWIxgrEpNRC4AJYTNgkAypi6ETHhQgmnPh4bWEKCxISca/iFl0AVKuWhCKSswpESmz5D\n aQUXK1MGFn6ZUKOO1o5Ks5k8PoLLseYzRVOa3X2SYmtfSyhW6p0455SGBAR30Ux0Oz4Y\n hhkwDOjgHcLHMJrUr7Ua+nnDUgb/Be8zF7YecHpCAmtF+QVXVG01i41PlfO9acGQimqi\n xlxp0wAtx+eiZh09XI7yZwpqq6PkgyHgrCDDKbfqILa5jUwejfFUaKXu9/Uv4k1qWwUY\n gehg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=4FUAz053Q8O4lxDctUgjdKConowhJ6wTho8iZJwG5rg=;\n b=KBs/OfvjzdIs1PoWFF9/pcVPT8ciqfSXoerLHah3MnK3covrvr6qhVL9ubAEI8vb16\n 4tqvsz/g/wYbc7r1r6rybX0ZFaXD/SLTFlSZ3F0q91Q+WemTmZ1bQSHuqiFpRLUaEx2q\n kpCaHkjYqAb8i1h2RwnXZgjAAywrhM9vCncqaLMgtFy02dXpC9Nz2YFUBp3n5jNKzSv+\n GU2XywRVbJEUabyTNhYL1UUrLuYhuqDW7lE/NN1s30NVOf8WBv0gowHKR7ioRRqrrSCa\n x84JQ7aW3QS6Jx5zEaPMZRuyUlXJO9TOUVhILHjqCY+opn4HBk9AOUEkIhxG+wI3wcpL\n 0UKA==",
        "X-Gm-Message-State": "AOAM531rVQYKR7mIm7b/nwP7oiNCAgwd/40zEHAtJUOhvgDuu9gXOBqS\n +34kJMNBccQHTQN9NC1kEVMmsx6+AdEA+Q==",
        "X-Google-Smtp-Source": "\n ABdhPJzaILy2tAEtUTkfrzjsUeG4u0ZvW5tQCK/gmP5n2eo+s+udMd/fhax0zlf44nMqCGes4zchoA==",
        "X-Received": "by 2002:aa7:848f:0:b029:28f:916b:a220 with SMTP id\n u15-20020aa7848f0000b029028f916ba220mr13722173pfn.10.1620438485411;\n Fri, 07 May 2021 18:48:05 -0700 (PDT)",
        "From": "Richard Henderson <richard.henderson@linaro.org>",
        "To": "qemu-devel@nongnu.org",
        "Subject": "[PATCH 02/72] qemu/host-utils: Add wrappers for overflow builtins",
        "Date": "Fri,  7 May 2021 18:46:52 -0700",
        "Message-Id": "<20210508014802.892561-3-richard.henderson@linaro.org>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210508014802.892561-1-richard.henderson@linaro.org>",
        "References": "<20210508014802.892561-1-richard.henderson@linaro.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::42e;\n envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "alex.bennee@linaro.org, david@redhat.com",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "These builtins came in with gcc 5 and clang 3.8, which are\nslightly newer than our supported minimum compiler versions.\n\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\n---\n include/qemu/host-utils.h | 225 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 225 insertions(+)",
    "diff": "diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h\nindex f1e52851e0..fd76f0cbd3 100644\n--- a/include/qemu/host-utils.h\n+++ b/include/qemu/host-utils.h\n@@ -356,6 +356,231 @@ static inline uint64_t revbit64(uint64_t x)\n #endif\n }\n \n+/**\n+ * sadd32_overflow - addition with overflow indication\n+ * @x, @y: addends\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x + @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool sadd32_overflow(int32_t x, int32_t y, int32_t *ret)\n+{\n+#if __has_builtin(__builtin_add_overflow) || __GNUC__ >= 5\n+    return __builtin_add_overflow(x, y, ret);\n+#else\n+    *ret = x + y;\n+    return ((*ret ^ x) & ~(x ^ y)) < 0;\n+#endif\n+}\n+\n+/**\n+ * sadd64_overflow - addition with overflow indication\n+ * @x, @y: addends\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x + @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool sadd64_overflow(int64_t x, int64_t y, int64_t *ret)\n+{\n+#if __has_builtin(__builtin_add_overflow) || __GNUC__ >= 5\n+    return __builtin_add_overflow(x, y, ret);\n+#else\n+    *ret = x + y;\n+    return ((*ret ^ x) & ~(x ^ y)) < 0;\n+#endif\n+}\n+\n+/**\n+ * uadd32_overflow - addition with overflow indication\n+ * @x, @y: addends\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x + @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool uadd32_overflow(uint32_t x, uint32_t y, uint32_t *ret)\n+{\n+#if __has_builtin(__builtin_add_overflow) || __GNUC__ >= 5\n+    return __builtin_add_overflow(x, y, ret);\n+#else\n+    *ret = x + y;\n+    return *ret < x;\n+#endif\n+}\n+\n+/**\n+ * uadd64_overflow - addition with overflow indication\n+ * @x, @y: addends\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x + @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool uadd64_overflow(uint64_t x, uint64_t y, uint64_t *ret)\n+{\n+#if __has_builtin(__builtin_add_overflow) || __GNUC__ >= 5\n+    return __builtin_add_overflow(x, y, ret);\n+#else\n+    *ret = x + y;\n+    return *ret < x;\n+#endif\n+}\n+\n+/**\n+ * ssub32_overflow - subtraction with overflow indication\n+ * @x: Minuend\n+ * @y: Subtrahend\n+ * @ret: Output for difference\n+ *\n+ * Computes *@ret = @x - @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool ssub32_overflow(int32_t x, int32_t y, int32_t *ret)\n+{\n+#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >= 5\n+    return __builtin_sub_overflow(x, y, ret);\n+#else\n+    *ret = x - y;\n+    return ((*ret ^ x) & (x ^ y)) < 0;\n+#endif\n+}\n+\n+/**\n+ * ssub64_overflow - subtraction with overflow indication\n+ * @x: Minuend\n+ * @y: Subtrahend\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x - @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool ssub64_overflow(int64_t x, int64_t y, int64_t *ret)\n+{\n+#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >= 5\n+    return __builtin_sub_overflow(x, y, ret);\n+#else\n+    *ret = x - y;\n+    return ((*ret ^ x) & (x ^ y)) < 0;\n+#endif\n+}\n+\n+/**\n+ * usub32_overflow - subtraction with overflow indication\n+ * @x: Minuend\n+ * @y: Subtrahend\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x - @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool usub32_overflow(uint32_t x, uint32_t y, uint32_t *ret)\n+{\n+#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >= 5\n+    return __builtin_sub_overflow(x, y, ret);\n+#else\n+    *ret = x - y;\n+    return x < y;\n+#endif\n+}\n+\n+/**\n+ * usub64_overflow - subtraction with overflow indication\n+ * @x: Minuend\n+ * @y: Subtrahend\n+ * @ret: Output for sum\n+ *\n+ * Computes *@ret = @x - @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool usub64_overflow(uint64_t x, uint64_t y, uint64_t *ret)\n+{\n+#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >= 5\n+    return __builtin_sub_overflow(x, y, ret);\n+#else\n+    *ret = x - y;\n+    return x < y;\n+#endif\n+}\n+\n+/**\n+ * smul32_overflow - multiplication with overflow indication\n+ * @x, @y: Input multipliers\n+ * @ret: Output for product\n+ *\n+ * Computes *@ret = @x * @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool smul32_overflow(int32_t x, int32_t y, int32_t *ret)\n+{\n+#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5\n+    return __builtin_mul_overflow(x, y, ret);\n+#else\n+    int64_t z = (int64_t)x * y;\n+    *ret = z;\n+    return *ret != z;\n+#endif\n+}\n+\n+/**\n+ * smul64_overflow - multiplication with overflow indication\n+ * @x, @y: Input multipliers\n+ * @ret: Output for product\n+ *\n+ * Computes *@ret = @x * @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool smul64_overflow(int64_t x, int64_t y, int64_t *ret)\n+{\n+#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5\n+    return __builtin_mul_overflow(x, y, ret);\n+#else\n+    uint64_t hi, lo;\n+    muls64(&lo, &hi, x, y);\n+    *ret = lo;\n+    return hi != ((int64_t)lo >> 63);\n+#endif\n+}\n+\n+/**\n+ * umul32_overflow - multiplication with overflow indication\n+ * @x, @y: Input multipliers\n+ * @ret: Output for product\n+ *\n+ * Computes *@ret = @x * @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool umul32_overflow(uint32_t x, uint32_t y, uint32_t *ret)\n+{\n+#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5\n+    return __builtin_mul_overflow(x, y, ret);\n+#else\n+    uint64_t z = (uint64_t)x * y;\n+    *ret = z;\n+    return z > UINT32_MAX;\n+#endif\n+}\n+\n+/**\n+ * smul64_overflow - multiplication with overflow indication\n+ * @x, @y: Input multipliers\n+ * @ret: Output for product\n+ *\n+ * Computes *@ret = @x * @y, and returns true if and only if that\n+ * value has been truncated.\n+ */\n+static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret)\n+{\n+#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >= 5\n+    return __builtin_mul_overflow(x, y, ret);\n+#else\n+    uint64_t hi;\n+    mulu64(ret, &hi, x, y);\n+    return hi != 0;\n+#endif\n+}\n+\n /* Host type specific sizes of these routines.  */\n \n #if ULONG_MAX == UINT32_MAX\n",
    "prefixes": [
        "02/72"
    ]
}