Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1475730/?format=api
{ "id": 1475730, "url": "http://patchwork.ozlabs.org/api/patches/1475730/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20210508014802.892561-36-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-36-richard.henderson@linaro.org>", "list_archive_url": null, "date": "2021-05-08T01:47:25", "name": "[35/72] softfloat: Implement float128_add/sub via parts", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ae9a02dafc0a3133e0fe308cdd0ab30176caaa29", "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-36-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/1475730/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1475730/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=HQiX0aS7;\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 4FcW3S3GTpz9sWp\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 8 May 2021 12:09:40 +1000 (AEST)", "from localhost ([::1]:41748 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 1lfCPS-0007bc-ES\n\tfor incoming@patchwork.ozlabs.org; Fri, 07 May 2021 22:09:38 -0400", "from eggs.gnu.org ([2001:470:142:3::10]:40966)\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 1lfC5D-0004kq-4W\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:43 -0400", "from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:43928)\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 1lfC50-0003et-3c\n for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:42 -0400", "by mail-pj1-x1032.google.com with SMTP id\n cl24-20020a17090af698b0290157efd14899so6550775pjb.2\n for <qemu-devel@nongnu.org>; Fri, 07 May 2021 18:48:27 -0700 (PDT)", "from localhost.localdomain ([71.212.144.24])\n by smtp.gmail.com with ESMTPSA id t4sm5819681pfq.165.2021.05.07.18.48.25\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 07 May 2021 18:48:26 -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=6i53BfFJgz07MWWKwgEBG9wk32Qsx014902OXCtKmIE=;\n b=HQiX0aS7S1w8nXYQlcw55llTHwWVEfGsSrB2cFrUj4VNKV/KfZZvW8gDzKji5R/8X3\n BdunHb0bT33IL2cWAsAlDAMI7x+7iQ7w4xnUAQEXl4XVWBdrRj4l3eJBADtkDC3EyHx9\n GPOaCsT5/BwihWad69r59DAejoTBdWXjLxpnUgrpEHRm9ju1BhEsV2jzFQV4ff6n466m\n I2cA8llpkY3yd+sRILkec6tH8QpIVyPDLFkw8YzHq9E9b1HPrE2E0i9gRAx1nzdwpZvl\n nQjJgR6Ko5GsWD2L6LiRCf9H34avXZlYC62kBIHqcLBw8StOUwUOGnj1uV8icIFqBb5V\n bepA==", "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=6i53BfFJgz07MWWKwgEBG9wk32Qsx014902OXCtKmIE=;\n b=LFzZmDB3wxlAl/Bovj11Asj0RHaw/O5WyyPbk9wBvtB1FLxTGbEZ5IRYonP88oNqfL\n p7n1Ly0W88J5zTcDwK2HYQLpHwnS4DjhrVDvsrORi7EKKcPikvBjRV4tfrNbBs2q9fBl\n aZeqwHaCvNbX7BUmur1fRQcE29KE820ZRNS1bttoEKzKuGD6kMw4e8g2xQO3gw6qamMN\n UPQ/GucLp9Abzei6szbpjtNobKpeUxMcgtC05xtx/xlO1FJxx7B0p6z0DrO0+vih+eRZ\n 06T8xUjg9HoFgptw4NHQBjx1/0tNCtEdq8d0A/XcqKdlM9CMbTcxMHwst33Wxm20BlOr\n c8kg==", "X-Gm-Message-State": "AOAM5338KebBdnMDxjeDVxy3fRNJf6jRhQaWandh3K0Y7dgP6YyG8z3k\n AP9zjDLfhxdg9lw7rqRxEeC05Q2Tsf/aCg==", "X-Google-Smtp-Source": "\n ABdhPJye6aY388QurYEcyO/AYxGCyCHojRqZfBb1tIzN7tkpA/6brRau7ORP2zIPw9G8DfxOLJCdsg==", "X-Received": "by 2002:a17:902:7402:b029:ed:1bf0:1ef1 with SMTP id\n g2-20020a1709027402b02900ed1bf01ef1mr13467596pll.24.1620438506304;\n Fri, 07 May 2021 18:48:26 -0700 (PDT)", "From": "Richard Henderson <richard.henderson@linaro.org>", "To": "qemu-devel@nongnu.org", "Subject": "[PATCH 35/72] softfloat: Implement float128_add/sub via parts", "Date": "Fri, 7 May 2021 18:47:25 -0700", "Message-Id": "<20210508014802.892561-36-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::1032;\n envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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": "Replace the existing Berkeley implementation with the\nFloatParts implementation.\n\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\n---\n fpu/softfloat.c | 257 +++++++-----------------------------------------\n 1 file changed, 36 insertions(+), 221 deletions(-)", "diff": "diff --git a/fpu/softfloat.c b/fpu/softfloat.c\nindex 22dc6da5ef..f48e6b1f64 100644\n--- a/fpu/softfloat.c\n+++ b/fpu/softfloat.c\n@@ -1045,6 +1045,20 @@ static float64 float64_round_pack_canonical(FloatParts64 *p,\n return float64_pack_raw(p);\n }\n \n+static void float128_unpack_canonical(FloatParts128 *p, float128 f,\n+ float_status *s)\n+{\n+ float128_unpack_raw(p, f);\n+ parts_canonicalize(p, s, &float128_params);\n+}\n+\n+static float128 float128_round_pack_canonical(FloatParts128 *p,\n+ float_status *s)\n+{\n+ parts_uncanon(p, s, &float128_params);\n+ return float128_pack_raw(p);\n+}\n+\n /*\n * Addition and subtraction\n */\n@@ -1212,6 +1226,28 @@ bfloat16 bfloat16_sub(bfloat16 a, bfloat16 b, float_status *status)\n return bfloat16_addsub(a, b, status, true);\n }\n \n+static float128 QEMU_FLATTEN\n+float128_addsub(float128 a, float128 b, float_status *status, bool subtract)\n+{\n+ FloatParts128 pa, pb, *pr;\n+\n+ float128_unpack_canonical(&pa, a, status);\n+ float128_unpack_canonical(&pb, b, status);\n+ pr = parts_addsub(&pa, &pb, status, subtract);\n+\n+ return float128_round_pack_canonical(pr, status);\n+}\n+\n+float128 float128_add(float128 a, float128 b, float_status *status)\n+{\n+ return float128_addsub(a, b, status, false);\n+}\n+\n+float128 float128_sub(float128 a, float128 b, float_status *status)\n+{\n+ return float128_addsub(a, b, status, true);\n+}\n+\n /*\n * Returns the result of multiplying the floating-point values `a' and\n * `b'. The operation is performed according to the IEC/IEEE Standard\n@@ -7031,227 +7067,6 @@ float128 float128_round_to_int(float128 a, float_status *status)\n \n }\n \n-/*----------------------------------------------------------------------------\n-| Returns the result of adding the absolute values of the quadruple-precision\n-| floating-point values `a' and `b'. If `zSign' is 1, the sum is negated\n-| before being returned. `zSign' is ignored if the result is a NaN.\n-| The addition is performed according to the IEC/IEEE Standard for Binary\n-| Floating-Point Arithmetic.\n-*----------------------------------------------------------------------------*/\n-\n-static float128 addFloat128Sigs(float128 a, float128 b, bool zSign,\n- float_status *status)\n-{\n- int32_t aExp, bExp, zExp;\n- uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;\n- int32_t expDiff;\n-\n- aSig1 = extractFloat128Frac1( a );\n- aSig0 = extractFloat128Frac0( a );\n- aExp = extractFloat128Exp( a );\n- bSig1 = extractFloat128Frac1( b );\n- bSig0 = extractFloat128Frac0( b );\n- bExp = extractFloat128Exp( b );\n- expDiff = aExp - bExp;\n- if ( 0 < expDiff ) {\n- if ( aExp == 0x7FFF ) {\n- if (aSig0 | aSig1) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- return a;\n- }\n- if ( bExp == 0 ) {\n- --expDiff;\n- }\n- else {\n- bSig0 |= UINT64_C(0x0001000000000000);\n- }\n- shift128ExtraRightJamming(\n- bSig0, bSig1, 0, expDiff, &bSig0, &bSig1, &zSig2 );\n- zExp = aExp;\n- }\n- else if ( expDiff < 0 ) {\n- if ( bExp == 0x7FFF ) {\n- if (bSig0 | bSig1) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- return packFloat128( zSign, 0x7FFF, 0, 0 );\n- }\n- if ( aExp == 0 ) {\n- ++expDiff;\n- }\n- else {\n- aSig0 |= UINT64_C(0x0001000000000000);\n- }\n- shift128ExtraRightJamming(\n- aSig0, aSig1, 0, - expDiff, &aSig0, &aSig1, &zSig2 );\n- zExp = bExp;\n- }\n- else {\n- if ( aExp == 0x7FFF ) {\n- if ( aSig0 | aSig1 | bSig0 | bSig1 ) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- return a;\n- }\n- add128( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 );\n- if ( aExp == 0 ) {\n- if (status->flush_to_zero) {\n- if (zSig0 | zSig1) {\n- float_raise(float_flag_output_denormal, status);\n- }\n- return packFloat128(zSign, 0, 0, 0);\n- }\n- return packFloat128( zSign, 0, zSig0, zSig1 );\n- }\n- zSig2 = 0;\n- zSig0 |= UINT64_C(0x0002000000000000);\n- zExp = aExp;\n- goto shiftRight1;\n- }\n- aSig0 |= UINT64_C(0x0001000000000000);\n- add128( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 );\n- --zExp;\n- if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;\n- ++zExp;\n- shiftRight1:\n- shift128ExtraRightJamming(\n- zSig0, zSig1, zSig2, 1, &zSig0, &zSig1, &zSig2 );\n- roundAndPack:\n- return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status);\n-\n-}\n-\n-/*----------------------------------------------------------------------------\n-| Returns the result of subtracting the absolute values of the quadruple-\n-| precision floating-point values `a' and `b'. If `zSign' is 1, the\n-| difference is negated before being returned. `zSign' is ignored if the\n-| result is a NaN. The subtraction is performed according to the IEC/IEEE\n-| Standard for Binary Floating-Point Arithmetic.\n-*----------------------------------------------------------------------------*/\n-\n-static float128 subFloat128Sigs(float128 a, float128 b, bool zSign,\n- float_status *status)\n-{\n- int32_t aExp, bExp, zExp;\n- uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1;\n- int32_t expDiff;\n-\n- aSig1 = extractFloat128Frac1( a );\n- aSig0 = extractFloat128Frac0( a );\n- aExp = extractFloat128Exp( a );\n- bSig1 = extractFloat128Frac1( b );\n- bSig0 = extractFloat128Frac0( b );\n- bExp = extractFloat128Exp( b );\n- expDiff = aExp - bExp;\n- shortShift128Left( aSig0, aSig1, 14, &aSig0, &aSig1 );\n- shortShift128Left( bSig0, bSig1, 14, &bSig0, &bSig1 );\n- if ( 0 < expDiff ) goto aExpBigger;\n- if ( expDiff < 0 ) goto bExpBigger;\n- if ( aExp == 0x7FFF ) {\n- if ( aSig0 | aSig1 | bSig0 | bSig1 ) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- float_raise(float_flag_invalid, status);\n- return float128_default_nan(status);\n- }\n- if ( aExp == 0 ) {\n- aExp = 1;\n- bExp = 1;\n- }\n- if ( bSig0 < aSig0 ) goto aBigger;\n- if ( aSig0 < bSig0 ) goto bBigger;\n- if ( bSig1 < aSig1 ) goto aBigger;\n- if ( aSig1 < bSig1 ) goto bBigger;\n- return packFloat128(status->float_rounding_mode == float_round_down,\n- 0, 0, 0);\n- bExpBigger:\n- if ( bExp == 0x7FFF ) {\n- if (bSig0 | bSig1) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- return packFloat128( zSign ^ 1, 0x7FFF, 0, 0 );\n- }\n- if ( aExp == 0 ) {\n- ++expDiff;\n- }\n- else {\n- aSig0 |= UINT64_C(0x4000000000000000);\n- }\n- shift128RightJamming( aSig0, aSig1, - expDiff, &aSig0, &aSig1 );\n- bSig0 |= UINT64_C(0x4000000000000000);\n- bBigger:\n- sub128( bSig0, bSig1, aSig0, aSig1, &zSig0, &zSig1 );\n- zExp = bExp;\n- zSign ^= 1;\n- goto normalizeRoundAndPack;\n- aExpBigger:\n- if ( aExp == 0x7FFF ) {\n- if (aSig0 | aSig1) {\n- return propagateFloat128NaN(a, b, status);\n- }\n- return a;\n- }\n- if ( bExp == 0 ) {\n- --expDiff;\n- }\n- else {\n- bSig0 |= UINT64_C(0x4000000000000000);\n- }\n- shift128RightJamming( bSig0, bSig1, expDiff, &bSig0, &bSig1 );\n- aSig0 |= UINT64_C(0x4000000000000000);\n- aBigger:\n- sub128( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 );\n- zExp = aExp;\n- normalizeRoundAndPack:\n- --zExp;\n- return normalizeRoundAndPackFloat128(zSign, zExp - 14, zSig0, zSig1,\n- status);\n-\n-}\n-\n-/*----------------------------------------------------------------------------\n-| Returns the result of adding the quadruple-precision floating-point values\n-| `a' and `b'. The operation is performed according to the IEC/IEEE Standard\n-| for Binary Floating-Point Arithmetic.\n-*----------------------------------------------------------------------------*/\n-\n-float128 float128_add(float128 a, float128 b, float_status *status)\n-{\n- bool aSign, bSign;\n-\n- aSign = extractFloat128Sign( a );\n- bSign = extractFloat128Sign( b );\n- if ( aSign == bSign ) {\n- return addFloat128Sigs(a, b, aSign, status);\n- }\n- else {\n- return subFloat128Sigs(a, b, aSign, status);\n- }\n-\n-}\n-\n-/*----------------------------------------------------------------------------\n-| Returns the result of subtracting the quadruple-precision floating-point\n-| values `a' and `b'. The operation is performed according to the IEC/IEEE\n-| Standard for Binary Floating-Point Arithmetic.\n-*----------------------------------------------------------------------------*/\n-\n-float128 float128_sub(float128 a, float128 b, float_status *status)\n-{\n- bool aSign, bSign;\n-\n- aSign = extractFloat128Sign( a );\n- bSign = extractFloat128Sign( b );\n- if ( aSign == bSign ) {\n- return subFloat128Sigs(a, b, aSign, status);\n- }\n- else {\n- return addFloat128Sigs(a, b, aSign, status);\n- }\n-\n-}\n-\n /*----------------------------------------------------------------------------\n | Returns the result of multiplying the quadruple-precision floating-point\n | values `a' and `b'. The operation is performed according to the IEC/IEEE\n", "prefixes": [ "35/72" ] }