From patchwork Sun May 16 12:34:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 439855 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp260006jac; Sun, 16 May 2021 05:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVfKzsFr4dSqBvsjbEP0X05CwmuUNa5CIuyMz76NuDeYdZ+sQC2Ny57jSWhNxtb3YMi96W X-Received: by 2002:a02:ab87:: with SMTP id t7mr4494503jan.57.1621169258874; Sun, 16 May 2021 05:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621169258; cv=none; d=google.com; s=arc-20160816; b=LjXaya/QuAFsVdyNDLaZXe1NQAar8rmbLqyKIBpK2ueBTDE6S8SEFVqt1YQKNFdVTg 0ossPVZcCJlbJ9Fygu/mNVzvocXUXBuZP3oJPw8mQ2T8Cu8Ac9yL9sX+MBjB/sQmKV1Y gGuUSaEHVmaU3GjTPsus4OjSHus4O8PyM9Ti+KjqUFIms0J4EF4X4vTrJhhu/6g7sbsE QPDCGPUaVYYwByyR+7zzV3V2J6aZcGwpgr2uPYojwPyVNwxKf3wQtVsoI+16VdGpe8v7 qtDQgV+lMk8MfgUdTtBAxZh6tVQnDlT9n3t9CO9kpvOFVYBx9xsRBqwtmK7CayNayYm1 Vs8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ox0xEuSw27UkSWdR6GqHPFeB67qrzPm+Gy+AAkd2bwg=; b=p0lOr6Wrg/5/9IkFsbbP3PuiIB9hP6AVd5NJwrUVkHGyPmw26VB3iOJWuETlSknG+n anBFF42yIv6kvGDMmcXUSQg0UoLZsQGttBEpjxzzHuXHEBdszSuc/0lAVagf1UEXn+fL vQx8Iwwku8Enhxwnp6yGhu3gf8ZD9dnFMCnhUT/EUGnEHtLzuyX6cV1kPjM1URqw6vG8 SNGuTgnn2e5jaBpSnLyH4RPFSy5a6BGan7PqvaAwp56F3aKrlo4VLOdRcwRAWVOBeB3M OGQmjwkD8F6ciP2pybqKbMF5ACoaD7Kmimcf7GE9g0fxqsrZt6w+SONswppR3sxCfSzY yGXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xEOZir6y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p31si15983437jac.95.2021.05.16.05.47.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 May 2021 05:47:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xEOZir6y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liGBG-0005R4-B9 for patch@linaro.org; Sun, 16 May 2021 08:47:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liFz8-0007V8-BV for qemu-devel@nongnu.org; Sun, 16 May 2021 08:35:06 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:44620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1liFyp-0007mN-O1 for qemu-devel@nongnu.org; Sun, 16 May 2021 08:35:06 -0400 Received: by mail-qk1-x72a.google.com with SMTP id a2so3284599qkh.11 for ; Sun, 16 May 2021 05:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ox0xEuSw27UkSWdR6GqHPFeB67qrzPm+Gy+AAkd2bwg=; b=xEOZir6y03yEKESVlN4eCYHotoCmXNZmoA6+ixH0s7vjvf6mZUe1zMcGxQ31GXnfbH bwFmGOUyz8TjnU9fh6hDh5F/1/30owZAgEF9KhWC9NoInslvcsmEJ2zIYc30TPXrhhkJ egPel322GVdAlnfgf57YYbIgUHJkwJemYibTJZkX0+CrMOPFCcl/Y3gyEZzjUt1uxih3 JYn084uopxBt0We922T18myyl+VuiwAACN1HFZNf6XkRVORYtuJnOQdE1gmREgLPKZf9 b2EGYJ17sZnwRlEEgLsRFexkHg3+Wv7ACiT2/qPl9Uv/v9z6e4iSNaPTON6v/7h3pY44 y/1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ox0xEuSw27UkSWdR6GqHPFeB67qrzPm+Gy+AAkd2bwg=; b=rqH/evXn/8tOAs/tgihz0l90PLuOFfxEQTXTWA5Ml7cyOclFRn62yV9AUZK3x7w1BN JwL/cXD89SphOVbOiGOQjBHuhLhPnTDwOMS8fnEKbaFhAeBADbO6Z0rndH7hM/FR5eH2 yV113lSvFelDAyQnWZAKgttJCZBcDyprlpgCViQ9lpQVy9htloucrfRoc0DYx+4k7WQa GkhsRZwYD1u2eCVSMffiialwF7uZFubX7wR1qyrOUnQcVLhI5vak71fyWCsqSXexJJ32 ZyW0OU28Ly9EoeTqs4wmj6Ntn6VZHqMBfuqQ3n0a+SUL6rDnXpmVz8WX5zl2UvZ8vA8D s7HQ== X-Gm-Message-State: AOAM533YQiS9qhAvoMATGem1sxiSMNERf/+MoGrMNGFaZR+LA2pKQFuY uuUUqyRVSsz3Xiz3Mbuc034s6hUPPvDhvipJv+E= X-Received: by 2002:a05:620a:1223:: with SMTP id v3mr51814430qkj.470.1621168486547; Sun, 16 May 2021 05:34:46 -0700 (PDT) Received: from localhost.localdomain (163.189-204-200.bestelclientes.com.mx. [189.204.200.163]) by smtp.gmail.com with ESMTPSA id s5sm8500553qkg.88.2021.05.16.05.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 05:34:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 16/46] softfloat: Move type-specific pack/unpack routines Date: Sun, 16 May 2021 07:34:01 -0500 Message-Id: <20210516123431.718318-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210516123431.718318-1-richard.henderson@linaro.org> References: <20210516123431.718318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In preparation from moving sf_canonicalize. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- fpu/softfloat.c | 109 +++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 53 deletions(-) -- 2.25.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 27b51659c9..398a068b58 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -837,59 +837,6 @@ static FloatParts64 round_canonical(FloatParts64 p, float_status *s, return p; } -/* Explicit FloatFmt version */ -static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s, - const FloatFmt *params) -{ - return sf_canonicalize(float16_unpack_raw(f), params, s); -} - -static FloatParts64 float16_unpack_canonical(float16 f, float_status *s) -{ - return float16a_unpack_canonical(f, s, &float16_params); -} - -static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s) -{ - return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s); -} - -static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s, - const FloatFmt *params) -{ - return float16_pack_raw(round_canonical(p, s, params)); -} - -static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s) -{ - return float16a_round_pack_canonical(p, s, &float16_params); -} - -static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s) -{ - return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params)); -} - -static FloatParts64 float32_unpack_canonical(float32 f, float_status *s) -{ - return sf_canonicalize(float32_unpack_raw(f), &float32_params, s); -} - -static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s) -{ - return float32_pack_raw(round_canonical(p, s, &float32_params)); -} - -static FloatParts64 float64_unpack_canonical(float64 f, float_status *s) -{ - return sf_canonicalize(float64_unpack_raw(f), &float64_params, s); -} - -static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s) -{ - return float64_pack_raw(round_canonical(p, s, &float64_params)); -} - static FloatParts64 return_nan(FloatParts64 a, float_status *s) { g_assert(is_nan(a.cls)); @@ -964,6 +911,62 @@ static FloatParts64 pick_nan_muladd(FloatParts64 a, FloatParts64 b, FloatParts64 return a; } +/* + * Pack/unpack routines with a specific FloatFmt. + */ + +static FloatParts64 float16a_unpack_canonical(float16 f, float_status *s, + const FloatFmt *params) +{ + return sf_canonicalize(float16_unpack_raw(f), params, s); +} + +static FloatParts64 float16_unpack_canonical(float16 f, float_status *s) +{ + return float16a_unpack_canonical(f, s, &float16_params); +} + +static FloatParts64 bfloat16_unpack_canonical(bfloat16 f, float_status *s) +{ + return sf_canonicalize(bfloat16_unpack_raw(f), &bfloat16_params, s); +} + +static float16 float16a_round_pack_canonical(FloatParts64 p, float_status *s, + const FloatFmt *params) +{ + return float16_pack_raw(round_canonical(p, s, params)); +} + +static float16 float16_round_pack_canonical(FloatParts64 p, float_status *s) +{ + return float16a_round_pack_canonical(p, s, &float16_params); +} + +static bfloat16 bfloat16_round_pack_canonical(FloatParts64 p, float_status *s) +{ + return bfloat16_pack_raw(round_canonical(p, s, &bfloat16_params)); +} + +static FloatParts64 float32_unpack_canonical(float32 f, float_status *s) +{ + return sf_canonicalize(float32_unpack_raw(f), &float32_params, s); +} + +static float32 float32_round_pack_canonical(FloatParts64 p, float_status *s) +{ + return float32_pack_raw(round_canonical(p, s, &float32_params)); +} + +static FloatParts64 float64_unpack_canonical(float64 f, float_status *s) +{ + return sf_canonicalize(float64_unpack_raw(f), &float64_params, s); +} + +static float64 float64_round_pack_canonical(FloatParts64 p, float_status *s) +{ + return float64_pack_raw(round_canonical(p, s, &float64_params)); +} + /* * Returns the result of adding or subtracting the values of the * floating-point values `a' and `b'. The operation is performed