get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2230632,
    "url": "http://patchwork.ozlabs.org/api/patches/2230632/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429222445.26301-28-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": "<20260429222445.26301-28-richard.henderson@linaro.org>",
    "list_archive_url": null,
    "date": "2026-04-29T22:24:24",
    "name": "[PULL,27/48] fpu: Drop parts_log2",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "0c481e5b8106eb98c3928ef519fe6c7cb08db82e",
    "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/20260429222445.26301-28-richard.henderson@linaro.org/mbox/",
    "series": [
        {
            "id": 502161,
            "url": "http://patchwork.ozlabs.org/api/series/502161/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502161",
            "date": "2026-04-29T22:23:57",
            "name": "[PULL,01/48] fpu: Drop parts_canonicalize",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502161/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230632/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230632/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=EI1WbAKE;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5X5q5dXqz1yJr\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 08:29:03 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIDM6-00015G-3x; Wed, 29 Apr 2026 18:26:06 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.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 1wIDM3-0000yq-Ns\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 18:26:03 -0400",
            "from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030])\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 1wIDM1-0005D4-OQ\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 18:26:03 -0400",
            "by mail-pj1-x1030.google.com with SMTP id\n 98e67ed59e1d1-36146ae9dd4so179122a91.3\n for <qemu-devel@nongnu.org>; Wed, 29 Apr 2026 15:26:01 -0700 (PDT)",
            "from stoup.. ([180.233.125.15]) by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-364a2732502sm1888471a91.3.2026.04.29.15.25.58\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 15:25:59 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777501560; x=1778106360; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=HkVVgcXR9FY/FmfQ7IydeeiDi2LGHO9RixdHIp7B3JY=;\n b=EI1WbAKEV6NpWTmTr6fBVuDN7lnwF0tu5GJkx0aS7bcgECjN7ka11WT5y4nVn4eHWz\n g9GjbQRejIDGkGqxIfeDvlr6ZwkjXfjqFcbUnvrqbQLvaELRzOdOvMOkd6DuF4wx+ZLg\n ktnjbHXvJFj+0b2d+0eIM8rg/XUuSAwtNY4Lx2ZhKwHI6//KaxPl4GKon7DOTnktt66B\n ov7dH0vVBYMDAcfjiDvv3LY2BIZ28gE/gU3qRpvsg3lQuYziK6p/rCfHc/uKCTpgBL1A\n puvWWEc9HDkMu066dzbeehzotUlDtgOnWsle96byGm/YP004hyTZhNERptYlB87/U4A9\n ZuqA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777501560; x=1778106360;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=HkVVgcXR9FY/FmfQ7IydeeiDi2LGHO9RixdHIp7B3JY=;\n b=k+o5/q3bRyAnkcY/JUUxRUsCvE17PotOhepQDu3T/WJOp3QXDKug/o1GFMaXv2fZcA\n R34DYLNttd8rXP1Mrk9HiPy6d+vZylKR8elSpjfestQ0JsNAVm6JYVUeW9P3X94EdZOZ\n yOzC8NwNMJXIp/+0QirNWtcZJtpO93Vuy46QwVN2gfdH5vfMhBU8x/CRMblkOPd1CYwL\n p9sr8RpRwX8mzZnrDHnAJ1KiyM5q2/oPga0e30G9MGspvqw4safAMxloujtAj16yxggR\n cSUKvBg9bNAGV7E/KiSe04z8QJLZ/Kwh7V0ULZU3hnjg2AhEuA88Svf6gWcLHnYfnHJb\n E/rw==",
        "X-Gm-Message-State": "AOJu0YwgjagT5rx5poXIIQbExNPZtLyJXQqj+WEljB44oAjrog+dObIy\n nZNLEvsiFlvn9aYo682DBCJrpCFqVKXU4ebTogLO+rAYOg3RmH6umR0sVUSlGZnvW1g+Sy4xLbI\n lpZn4BRE=",
        "X-Gm-Gg": "AeBDieszQKAe08JoJp71Jiz6jV1LwjeRh2M9oag/pESqPV/GpjsM/llvwbfGIgEd0sk\n sMKzSrxCWkkB7NMOgfD0AH3fKBwq+kFsVnC6Hh9KS/M0Nd+UN0QBxhq6VhZawTZSG4YTnLlte0v\n 2BF5c74sgBTL3ya1Uiuh2HIJS0ELXOQ8wGc/T9Z91WZY97P/TbiAQNkICwzXT26dEin1gm8y0Hx\n Lcv9Q0Q5DTulvAS9V6Y2258YlblfIpbO0ykYkcXbclHegQ80q3B9fvChMBJF3Td8o8YwdryNiXa\n p86DDhfeESYsFVDufgy8jwmxjdOfwAywrj4sf/3paJprcUSshifc3g2Zytk4ygGcF6WGzrhYNcO\n WvTyeGYUUPCzDS35s26TrKqC/61G+IWW2mWNZf2s/7XyUrLfda77kYitrzl3Ak6j+AQdXzf83+F\n WJKykWvCD/j0+m9uVE4AwPy8y6Z2LMBLX2xzzQiUdT8mYXeDCogCs=",
        "X-Received": "by 2002:a17:90b:264c:b0:359:fe72:3559 with SMTP id\n 98e67ed59e1d1-364c30ae64dmr192221a91.21.1777501560096;\n Wed, 29 Apr 2026 15:26:00 -0700 (PDT)",
        "From": "Richard Henderson <richard.henderson@linaro.org>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "stefanha@redhat.com,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>",
        "Subject": "[PULL 27/48] fpu: Drop parts_log2",
        "Date": "Thu, 30 Apr 2026 08:24:24 +1000",
        "Message-ID": "<20260429222445.26301-28-richard.henderson@linaro.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260429222445.26301-1-richard.henderson@linaro.org>",
        "References": "<20260429222445.26301-1-richard.henderson@linaro.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1030;\n envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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.29",
        "Precedence": "list",
        "List-Id": "qemu development <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>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Use parts64_log2 at each call site.\n\nThat leaves parts128_log2 unused, so move the whole function back\nto softfloat.c and specialize for FloatParts64.\n\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\n---\n fpu/softfloat.c           | 133 +++++++++++++++++++++++++++++++++++---\n fpu/softfloat-parts.c.inc | 131 -------------------------------------\n 2 files changed, 125 insertions(+), 139 deletions(-)",
    "diff": "diff --git a/fpu/softfloat.c b/fpu/softfloat.c\nindex 3e6f2a152a..6a38d161f7 100644\n--- a/fpu/softfloat.c\n+++ b/fpu/softfloat.c\n@@ -779,12 +779,6 @@ static float128 QEMU_FLATTEN float128_pack_raw(const FloatParts128 *p)\n                   FloatParts128 *: parts128_##NAME, \\\n                   FloatParts256 *: parts256_##NAME)\n \n-static void parts64_log2(FloatParts64 *a, float_status *s, const FloatFmt *f);\n-static void parts128_log2(FloatParts128 *a, float_status *s, const FloatFmt *f);\n-\n-#define parts_log2(A, S, F) \\\n-    PARTS_GENERIC_64_128(log2, A)(A, S, F)\n-\n /*\n  * Helper functions for softfloat-parts.c.inc, per-size operations.\n  */\n@@ -4851,12 +4845,135 @@ floatx80 floatx80_sqrt(floatx80 a, float_status *s)\n /*\n  * log2\n  */\n+\n+static void parts64_log2(FloatParts64 *a, float_status *s, const FloatFmt *fmt)\n+{\n+    uint64_t a0, a1, r, t, ign;\n+    int i, n, a_exp, f_exp;\n+\n+    if (unlikely(a->cls != float_class_normal)) {\n+        switch (a->cls) {\n+        case float_class_denormal:\n+            if (!a->sign) {\n+                /* -ve denormal will be InvalidOperation */\n+                float_raise(float_flag_input_denormal_used, s);\n+            }\n+            break;\n+        case float_class_snan:\n+        case float_class_qnan:\n+            parts64_return_nan(a, s);\n+            return;\n+        case float_class_zero:\n+            float_raise(float_flag_divbyzero, s);\n+            /* log2(0) = -inf */\n+            a->cls = float_class_inf;\n+            a->sign = 1;\n+            return;\n+        case float_class_inf:\n+            if (unlikely(a->sign)) {\n+                goto d_nan;\n+            }\n+            return;\n+        default:\n+            g_assert_not_reached();\n+        }\n+    }\n+    if (unlikely(a->sign)) {\n+        goto d_nan;\n+    }\n+\n+    a_exp = a->exp;\n+    f_exp = -1;\n+\n+    r = 0;\n+    t = DECOMPOSED_IMPLICIT_BIT;\n+    a0 = a->frac_hi;\n+    a1 = 0;\n+\n+    n = fmt->frac_size + 2;\n+    if (unlikely(a_exp == -1)) {\n+        /*\n+         * When a_exp == -1, we're computing the log2 of a value [0.5,1.0).\n+         * When the value is very close to 1.0, there are lots of 1's in\n+         * the msb parts of the fraction.  At the end, when we subtract\n+         * this value from -1.0, we can see a catastrophic loss of precision,\n+         * as 0x800..000 - 0x7ff..ffx becomes 0x000..00y, leaving only the\n+         * bits of y in the final result.  To minimize this, compute as many\n+         * digits as we can.\n+         * ??? This case needs another algorithm to avoid this.\n+         */\n+        n = fmt->frac_size * 2 + 2;\n+        /* Don't compute a value overlapping the sticky bit */\n+        n = MIN(n, 62);\n+    }\n+\n+    for (i = 0; i < n; i++) {\n+        if (a1) {\n+            mul128To256(a0, a1, a0, a1, &a0, &a1, &ign, &ign);\n+        } else if (a0 & 0xffffffffull) {\n+            mul64To128(a0, a0, &a0, &a1);\n+        } else if (a0 & ~DECOMPOSED_IMPLICIT_BIT) {\n+            a0 >>= 32;\n+            a0 *= a0;\n+        } else {\n+            goto exact;\n+        }\n+\n+        if (a0 & DECOMPOSED_IMPLICIT_BIT) {\n+            if (unlikely(a_exp == 0 && r == 0)) {\n+                /*\n+                 * When a_exp == 0, we're computing the log2 of a value\n+                 * [1.0,2.0).  When the value is very close to 1.0, there\n+                 * are lots of 0's in the msb parts of the fraction.\n+                 * We need to compute more digits to produce a correct\n+                 * result -- restart at the top of the fraction.\n+                 * ??? This is likely to lose precision quickly, as for\n+                 * float128; we may need another method.\n+                 */\n+                f_exp -= i;\n+                t = r = DECOMPOSED_IMPLICIT_BIT;\n+                i = 0;\n+            } else {\n+                r |= t;\n+            }\n+        } else {\n+            add128(a0, a1, a0, a1, &a0, &a1);\n+        }\n+        t >>= 1;\n+    }\n+\n+    /* Set sticky for inexact. */\n+    r |= (a1 || a0 & ~DECOMPOSED_IMPLICIT_BIT);\n+\n+ exact:\n+    parts64_sint_to_float(a, a_exp, 0, s);\n+    if (r != 0) {\n+        FloatParts64 f = {\n+            .cls = float_class_normal, .frac = r\n+        };\n+        f.exp = f_exp - frac_normalize(&f);\n+\n+        if (a_exp < 0) {\n+            parts64_sub_normal(a, &f);\n+        } else if (a_exp > 0) {\n+            parts64_add_normal(a, &f);\n+        } else {\n+            *a = f;\n+        }\n+    }\n+    return;\n+\n+ d_nan:\n+    float_raise(float_flag_invalid, s);\n+    parts64_default_nan(a, s);\n+}\n+\n float32 float32_log2(float32 a, float_status *status)\n {\n     FloatParts64 p;\n \n     float32_unpack_canonical(&p, a, status);\n-    parts_log2(&p, status, &float32_params);\n+    parts64_log2(&p, status, &float32_params);\n     return float32_round_pack_canonical(&p, status);\n }\n \n@@ -4865,7 +4982,7 @@ float64 float64_log2(float64 a, float_status *status)\n     FloatParts64 p;\n \n     float64_unpack_canonical(&p, a, status);\n-    parts_log2(&p, status, &float64_params);\n+    parts64_log2(&p, status, &float64_params);\n     return float64_round_pack_canonical(&p, status);\n }\n \ndiff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc\nindex 8405cf29cd..5f27efd288 100644\n--- a/fpu/softfloat-parts.c.inc\n+++ b/fpu/softfloat-parts.c.inc\n@@ -1671,134 +1671,3 @@ static void partsN(scalbn)(FloatPartsN *a, int n, float_status *s)\n         g_assert_not_reached();\n     }\n }\n-\n-/*\n- * Return log2(A)\n- */\n-static void partsN(log2)(FloatPartsN *a, float_status *s, const FloatFmt *fmt)\n-{\n-    uint64_t a0, a1, r, t, ign;\n-    FloatPartsN f;\n-    int i, n, a_exp, f_exp;\n-\n-    if (unlikely(a->cls != float_class_normal)) {\n-        switch (a->cls) {\n-        case float_class_denormal:\n-            if (!a->sign) {\n-                /* -ve denormal will be InvalidOperation */\n-                float_raise(float_flag_input_denormal_used, s);\n-            }\n-            break;\n-        case float_class_snan:\n-        case float_class_qnan:\n-            partsN(return_nan)(a, s);\n-            return;\n-        case float_class_zero:\n-            float_raise(float_flag_divbyzero, s);\n-            /* log2(0) = -inf */\n-            a->cls = float_class_inf;\n-            a->sign = 1;\n-            return;\n-        case float_class_inf:\n-            if (unlikely(a->sign)) {\n-                goto d_nan;\n-            }\n-            return;\n-        default:\n-            g_assert_not_reached();\n-        }\n-    }\n-    if (unlikely(a->sign)) {\n-        goto d_nan;\n-    }\n-\n-    /* TODO: This algorithm looses bits too quickly for float128. */\n-    g_assert(N == 64);\n-\n-    a_exp = a->exp;\n-    f_exp = -1;\n-\n-    r = 0;\n-    t = DECOMPOSED_IMPLICIT_BIT;\n-    a0 = a->frac_hi;\n-    a1 = 0;\n-\n-    n = fmt->frac_size + 2;\n-    if (unlikely(a_exp == -1)) {\n-        /*\n-         * When a_exp == -1, we're computing the log2 of a value [0.5,1.0).\n-         * When the value is very close to 1.0, there are lots of 1's in\n-         * the msb parts of the fraction.  At the end, when we subtract\n-         * this value from -1.0, we can see a catastrophic loss of precision,\n-         * as 0x800..000 - 0x7ff..ffx becomes 0x000..00y, leaving only the\n-         * bits of y in the final result.  To minimize this, compute as many\n-         * digits as we can.\n-         * ??? This case needs another algorithm to avoid this.\n-         */\n-        n = fmt->frac_size * 2 + 2;\n-        /* Don't compute a value overlapping the sticky bit */\n-        n = MIN(n, 62);\n-    }\n-\n-    for (i = 0; i < n; i++) {\n-        if (a1) {\n-            mul128To256(a0, a1, a0, a1, &a0, &a1, &ign, &ign);\n-        } else if (a0 & 0xffffffffull) {\n-            mul64To128(a0, a0, &a0, &a1);\n-        } else if (a0 & ~DECOMPOSED_IMPLICIT_BIT) {\n-            a0 >>= 32;\n-            a0 *= a0;\n-        } else {\n-            goto exact;\n-        }\n-\n-        if (a0 & DECOMPOSED_IMPLICIT_BIT) {\n-            if (unlikely(a_exp == 0 && r == 0)) {\n-                /*\n-                 * When a_exp == 0, we're computing the log2 of a value\n-                 * [1.0,2.0).  When the value is very close to 1.0, there\n-                 * are lots of 0's in the msb parts of the fraction.\n-                 * We need to compute more digits to produce a correct\n-                 * result -- restart at the top of the fraction.\n-                 * ??? This is likely to lose precision quickly, as for\n-                 * float128; we may need another method.\n-                 */\n-                f_exp -= i;\n-                t = r = DECOMPOSED_IMPLICIT_BIT;\n-                i = 0;\n-            } else {\n-                r |= t;\n-            }\n-        } else {\n-            add128(a0, a1, a0, a1, &a0, &a1);\n-        }\n-        t >>= 1;\n-    }\n-\n-    /* Set sticky for inexact. */\n-    r |= (a1 || a0 & ~DECOMPOSED_IMPLICIT_BIT);\n-\n- exact:\n-    partsN(sint_to_float)(a, a_exp, 0, s);\n-    if (r == 0) {\n-        return;\n-    }\n-\n-    memset(&f, 0, sizeof(f));\n-    f.cls = float_class_normal;\n-    f.frac_hi = r;\n-    f.exp = f_exp - frac_normalize(&f);\n-\n-    if (a_exp < 0) {\n-        partsN(sub_normal)(a, &f);\n-    } else if (a_exp > 0) {\n-        partsN(add_normal)(a, &f);\n-    } else {\n-        *a = f;\n-    }\n-    return;\n-\n- d_nan:\n-    float_raise(float_flag_invalid, s);\n-    partsN(default_nan)(a, s);\n-}\n",
    "prefixes": [
        "PULL",
        "27/48"
    ]
}