Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1475699/?format=api
{ "id": 1475699, "url": "http://patchwork.ozlabs.org/api/patches/1475699/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20210508014802.892561-4-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-4-richard.henderson@linaro.org>", "list_archive_url": null, "date": "2021-05-08T01:46:53", "name": "[03/72] qemu/host-utils: Add wrappers for carry builtins", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ecbb62fc40d0ac41f4a8bc15279f408dd301cc0e", "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-4-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/1475699/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1475699/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=nIAB2VEt;\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 4FcVbv3p6Pz9sV5\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 8 May 2021 11:49:13 +1000 (AEST)", "from localhost ([::1]:43184 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-0003wh-9C\n\tfor incoming@patchwork.ozlabs.org; Fri, 07 May 2021 21:49:10 -0400", "from eggs.gnu.org ([2001:470:142:3::10]:40440)\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 1lfC4f-0003vE-9B\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:09 -0400", "from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:35769)\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 1lfC4d-0003VU-KW\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:09 -0400", "by mail-pg1-x534.google.com with SMTP id m190so8677876pga.2\n for <qemu-devel@nongnu.org>; Fri, 07 May 2021 18:48:07 -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=eUjZLMLZ+rzu+K8ZyMeakxAgdcLDgDe+zwm00dqzTMc=;\n b=nIAB2VEtfa2gXqOqdaCdTEHW4cUoGqKq980h/JSdtE2kzIoEocv5LClngB/UT9ptGm\n 77+Fq/QXFPtEgOEsn9lq5VRGxLy8PG+VaN4PGmP2IVr73UN1IvKIT4WYkiwMmkbvKwYt\n KvXQdOvn3tFJ+ydALq6OO40KVAV2uAQ1t/BXm9PcSK4a8jlxw2VV/RlcgEl4FZKTTsu4\n 8PfyX8GEPC/tqI30zgqaeYxCwqwTpKILSlpWoh51IvHTRDvLcobdBm7aeMh0pWdkRPLc\n MmDPDI9NY6Q9ZyZtgyK/SG+0mK7qKG0E+Nbm4kKqNkq4BQ+gJcX0xLeqqLFZIRTb2DZW\n LVog==", "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=eUjZLMLZ+rzu+K8ZyMeakxAgdcLDgDe+zwm00dqzTMc=;\n b=RbjAWcXiu4ipCIkLgo8OSvwDC1qO4kY3WmAz+psH7WbiCcd5h5lJ8VZg/rmlKQ4HcM\n WMiepd7wmvS6QdDcmn0az58wqAr6HHp/UCyucJhaZQPF6qsinNsSMf+30VjZrI96Yk15\n fLHJF11rjyczxpvKIDIg8pDniER1cxkxwc3VmRPkLx3jBwWb1Jt2JJQDcSVGaj707ZDI\n 6XqnncOsxAfuKBQX0K8YYCh2QB2qmTVKpgWf1lBsjSL2ACq+7WMb3XoI9PksWhwc7C3u\n 29UfsTCcqOZJCtbLvS/hnRKTG4C9PQVZyg0n6c39YdFUvb4slOhZ6weiJy8vMCSMHYc6\n 9gww==", "X-Gm-Message-State": "AOAM530Gi4Uf6xHh1l8cwfeVN5Z/bLy5QF1hZyYao0cIoQKjqSHpclEc\n CsPtwSx22rsc5LrHDepviXpXJtXGyAcpfQ==", "X-Google-Smtp-Source": "\n ABdhPJxWAjLgvIqRHn2k8YEyS2ACEmif6H5E2V1WQd+HVSB8B58aFobiUvgj0YxpgfwnynKxI6YbvA==", "X-Received": "by 2002:a05:6a00:87:b029:28d:f62f:a749 with SMTP id\n c7-20020a056a000087b029028df62fa749mr13354023pfj.54.1620438485997;\n Fri, 07 May 2021 18:48:05 -0700 (PDT)", "From": "Richard Henderson <richard.henderson@linaro.org>", "To": "qemu-devel@nongnu.org", "Subject": "[PATCH 03/72] qemu/host-utils: Add wrappers for carry builtins", "Date": "Fri, 7 May 2021 18:46:53 -0700", "Message-Id": "<20210508014802.892561-4-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::534;\n envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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 clang 3.8, but are not present in gcc through\nversion 11. Even in clang the optimization is not ideal except for\nx86_64, but no worse than the hand-coding that we currently do.\n\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\n---\n include/qemu/host-utils.h | 50 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 50 insertions(+)", "diff": "diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h\nindex fd76f0cbd3..2ea8b3000b 100644\n--- a/include/qemu/host-utils.h\n+++ b/include/qemu/host-utils.h\n@@ -26,6 +26,7 @@\n #ifndef HOST_UTILS_H\n #define HOST_UTILS_H\n \n+#include \"qemu/compiler.h\"\n #include \"qemu/bswap.h\"\n \n #ifdef CONFIG_INT128\n@@ -581,6 +582,55 @@ static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret)\n #endif\n }\n \n+/**\n+ * uadd64_carry - addition with carry-in and carry-out\n+ * @x, @y: addends\n+ * @pcarry: in-out carry value\n+ *\n+ * Computes @x + @y + *@pcarry, placing the carry-out back\n+ * into *@pcarry and returning the 64-bit sum.\n+ */\n+static inline uint64_t uadd64_carry(uint64_t x, uint64_t y, bool *pcarry)\n+{\n+#if __has_builtin(__builtin_addcll)\n+ unsigned long long c = *pcarry;\n+ x = __builtin_addcll(x, y, c, &c);\n+ *pcarry = c & 1;\n+ return x;\n+#else\n+ bool c = *pcarry;\n+ /* This is clang's internal expansion of __builtin_addc. */\n+ c = uadd64_overflow(x, c, &x);\n+ c |= uadd64_overflow(x, y, &x);\n+ *pcarry = c;\n+ return x;\n+#endif\n+}\n+\n+/**\n+ * usub64_borrow - subtraction with borrow-in and borrow-out\n+ * @x, @y: addends\n+ * @pborrow: in-out borrow value\n+ *\n+ * Computes @x - @y - *@pborrow, placing the borrow-out back\n+ * into *@pborrow and returning the 64-bit sum.\n+ */\n+static inline uint64_t usub64_borrow(uint64_t x, uint64_t y, bool *pborrow)\n+{\n+#if __has_builtin(__builtin_subcll)\n+ unsigned long long b = *pborrow;\n+ x = __builtin_subcll(x, y, b, &b);\n+ *pborrow = b & 1;\n+ return x;\n+#else\n+ bool b = *pborrow;\n+ b = usub64_overflow(x, b, &x);\n+ b |= usub64_overflow(x, y, &x);\n+ *pborrow = b;\n+ return x;\n+#endif\n+}\n+\n /* Host type specific sizes of these routines. */\n \n #if ULONG_MAX == UINT32_MAX\n", "prefixes": [ "03/72" ] }