From patchwork Mon Jun 26 15:39:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 696456 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3298375wrm; Mon, 26 Jun 2023 08:43:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RovgweU0mNTkwoo0424Xskgvv6aPqAQCob1OyEbJPQFdN0SCfTJCYUzhoc8Wsw4i4ZRPZ X-Received: by 2002:ac8:5896:0:b0:3f0:a426:5f29 with SMTP id t22-20020ac85896000000b003f0a4265f29mr37437951qta.11.1687794187773; Mon, 26 Jun 2023 08:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687794187; cv=none; d=google.com; s=arc-20160816; b=ZysW6NtU5o+14QaYS+xT9nZeD/My2up61UTwqJ7TWBItHDYRZTGsP7e9H1LhROfm7H T+PGvWMOF0vElOaNpOVXRdeJdGkvkO0pW4rHS03OS9faI+ya2VMQ/cxFg49MOC9TxNwG l7rKcUXwGoAf91DaMJKdNTM2FcU5yo0t83enIa8bxeonUx5i5jHZGtBi/Idld1Ldb+Vy EVJnwaxsjCBhYgVYSCjdFH2FMV7qgtrCZW+OZECRivFe4wF3O/ZGnKR7vvK2wq+Rc7nw XAKGhy4TKQ/BIvvC0GBDpgxNyUpsOJyOKypotnbUiORHRiKKuSk3zL72pLKVlkbJBdDW ifkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=SfkiVCmLUBJ6DWFjAcx87ywe0kXi0048sFqWxzKvJ7o=; fh=5FH64luiLUkCluVeaKh9Uyc0mIU47knr4Hz6VZQOKAA=; b=psARyppm0u0Mnf8sff7o0O8bxVLSHDJSy0GVOjlFIm9mi1HKtsW6MQoi1OBn6KmKGO yZ6e/k6LVbzlBkRiLVG+Cu3Zf4hrfmzK8Ekt3JZQXD7PYa6rQFGw14/z6yKZS0LUGKJf glfB9tB3jR0MuAkB6n+Cpot2PqqTTedEdZgofxF2SbOSGdkKao8miLVhAUtAPoEJvXGF V97lru2+cKx7fB8bqP5VkdPKHLLO5xiFM3dI1mm8SxFhCSEacsZqjtCghbbD8vo73Dcj HFP0YdrgEQbWEqfCiqXk0xHRTPHeAPteOCGXQXRQRJ0ZSNApSkxbSCnjz8w7zstP1OKC VYiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hq9hOLZe; 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 c12-20020ac85a8c000000b003f6b218debbsi1980732qtc.372.2023.06.26.08.43.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 08:43:07 -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=Hq9hOLZe; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDoLJ-0002JW-8t; Mon, 26 Jun 2023 11:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDoJr-0000Im-Pc for qemu-devel@nongnu.org; Mon, 26 Jun 2023 11:39:59 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDoJn-0002qk-65 for qemu-devel@nongnu.org; Mon, 26 Jun 2023 11:39:59 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3113dabc549so5071517f8f.1 for ; Mon, 26 Jun 2023 08:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687793994; x=1690385994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SfkiVCmLUBJ6DWFjAcx87ywe0kXi0048sFqWxzKvJ7o=; b=Hq9hOLZeCglFzMEbtnY/zBnN43sfJCJyXgKk+bSvNvswG43KSj2OCpvyAv7phpfhpC +aCX6FAIHSX9SUz07e1eeXQsKEieJ4ETQHKTclLbylhEJy/omuodM65YfMXdS5W3doiw ISmSaj7blMLAa4cYpwPdN7OASzrQsS4WCresamI50C5JkdHvFva6KbjfXoET0nHfBy4U aEj34QBnus71dDvHe5nFckYhYNhKv/zNZR5VAK56JECrAM3U+3LlhhcCGR3YmaXk3hVr BNFDtmtXBNZZ6te89cqZJusO8IOzCbGQOOXRNhhQp8dPlc+Y1Cn1AtxSIMGfQINhDlf2 hJPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687793994; x=1690385994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SfkiVCmLUBJ6DWFjAcx87ywe0kXi0048sFqWxzKvJ7o=; b=W0nU2NHyp1YEQ2PsXO2yNrDKAOBUzb6r63o0+h/920pfBgcymFcrvJHtE7aCy08NVG 8RwH9bANg2svx5VDy5eDnxqptdUM1XnDv9muJBCRj1TVSO2UT3bOFyUuLLEdMXQ9JWiO 0WWBjxSU4EqRjlxLIVjYmhpnQkV9cOjlNkvzv2zBb/pxv+MI1tGpiRK/bVmOnwq/MK+q d75uura8yZB4LbF4xAZte5ZmTPEFxAbDJcsTDY6LOIq7DmOqJmUUbpAeNG2JmaF8uX+t Mgr6UCQEAThYfrwKpV+35P8AOuxHo49qzC1Fimhq846rJzVhkn79hA5Ocwb4VqrvIXhs T6vQ== X-Gm-Message-State: AC+VfDwGE6GAXFz26iqfzRfOKm3gx4O6OXErxWy0etTaCXbqgon2hcmE QwSUTVH/V2pkpqhpwzDcGYHdIIinZvEOyvRXCt5NuI7/ X-Received: by 2002:adf:f4cf:0:b0:313:f68d:acf9 with SMTP id h15-20020adff4cf000000b00313f68dacf9mr1397799wrp.10.1687793993960; Mon, 26 Jun 2023 08:39:53 -0700 (PDT) Received: from localhost.localdomain ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id t1-20020adfe441000000b00313f45f74a8sm2164178wrm.103.2023.06.26.08.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 08:39:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/22] softfloat: use QEMU_FLATTEN to avoid mistaken isra inlining Date: Mon, 26 Jun 2023 17:39:35 +0200 Message-Id: <20230626153945.76180-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626153945.76180-1-richard.henderson@linaro.org> References: <20230626153945.76180-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée Balton discovered that asserts for the extract/deposit calls had a significant impact on a lame benchmark on qemu-ppc. Replicating with: ./qemu-ppc64 ~/lsrc/tests/lame.git-svn/builds/ppc64/frontend/lame \ -h pts-trondheim-3.wav pts-trondheim-3.mp3 showed up the pack/unpack routines not eliding the assert checks as it should have done causing them to prominently figure in the profile:  11.44%  qemu-ppc64  qemu-ppc64               [.] unpack_raw64.isra.0  11.03%  qemu-ppc64  qemu-ppc64               [.] parts64_uncanon_normal   8.26%  qemu-ppc64  qemu-ppc64               [.] helper_compute_fprf_float64   6.75%  qemu-ppc64  qemu-ppc64               [.] do_float_check_status   5.34%  qemu-ppc64  qemu-ppc64               [.] parts64_muladd   4.75%  qemu-ppc64  qemu-ppc64               [.] pack_raw64.isra.0   4.38%  qemu-ppc64  qemu-ppc64               [.] parts64_canonicalize   3.62%  qemu-ppc64  qemu-ppc64               [.] float64r32_round_pack_canonical After this patch the same test runs 31 seconds faster with a profile where the generated code dominates more: + 14.12% 0.00% qemu-ppc64 [unknown] [.] 0x0000004000619420 + 13.30% 0.00% qemu-ppc64 [unknown] [.] 0x0000004000616850 + 12.58% 12.19% qemu-ppc64 qemu-ppc64 [.] parts64_uncanon_normal + 10.62% 0.00% qemu-ppc64 [unknown] [.] 0x000000400061bf70 + 9.91% 9.73% qemu-ppc64 qemu-ppc64 [.] helper_compute_fprf_float64 + 7.84% 7.82% qemu-ppc64 qemu-ppc64 [.] do_float_check_status + 6.47% 5.78% qemu-ppc64 qemu-ppc64 [.] parts64_canonicalize.constprop.0 + 6.46% 0.00% qemu-ppc64 [unknown] [.] 0x0000004000620130 + 6.42% 0.00% qemu-ppc64 [unknown] [.] 0x0000004000619400 + 6.17% 6.04% qemu-ppc64 qemu-ppc64 [.] parts64_muladd + 5.85% 0.00% qemu-ppc64 [unknown] [.] 0x00000040006167e0 + 5.74% 0.00% qemu-ppc64 [unknown] [.] 0x0000b693fcffffd3 + 5.45% 4.78% qemu-ppc64 qemu-ppc64 [.] float64r32_round_pack_canonical Suggested-by: Richard Henderson Message-Id: [AJB: Patchified rth's suggestion] Signed-off-by: Alex Bennée Cc: BALATON Zoltan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: BALATON Zoltan Message-Id: <20230523131107.3680641-1-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- fpu/softfloat.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 108f9cb224..42e6c188b4 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -593,27 +593,27 @@ static void unpack_raw64(FloatParts64 *r, const FloatFmt *fmt, uint64_t raw) }; } -static inline void float16_unpack_raw(FloatParts64 *p, float16 f) +static void QEMU_FLATTEN float16_unpack_raw(FloatParts64 *p, float16 f) { unpack_raw64(p, &float16_params, f); } -static inline void bfloat16_unpack_raw(FloatParts64 *p, bfloat16 f) +static void QEMU_FLATTEN bfloat16_unpack_raw(FloatParts64 *p, bfloat16 f) { unpack_raw64(p, &bfloat16_params, f); } -static inline void float32_unpack_raw(FloatParts64 *p, float32 f) +static void QEMU_FLATTEN float32_unpack_raw(FloatParts64 *p, float32 f) { unpack_raw64(p, &float32_params, f); } -static inline void float64_unpack_raw(FloatParts64 *p, float64 f) +static void QEMU_FLATTEN float64_unpack_raw(FloatParts64 *p, float64 f) { unpack_raw64(p, &float64_params, f); } -static void floatx80_unpack_raw(FloatParts128 *p, floatx80 f) +static void QEMU_FLATTEN floatx80_unpack_raw(FloatParts128 *p, floatx80 f) { *p = (FloatParts128) { .cls = float_class_unclassified, @@ -623,7 +623,7 @@ static void floatx80_unpack_raw(FloatParts128 *p, floatx80 f) }; } -static void float128_unpack_raw(FloatParts128 *p, float128 f) +static void QEMU_FLATTEN float128_unpack_raw(FloatParts128 *p, float128 f) { const int f_size = float128_params.frac_size - 64; const int e_size = float128_params.exp_size; @@ -650,27 +650,27 @@ static uint64_t pack_raw64(const FloatParts64 *p, const FloatFmt *fmt) return ret; } -static inline float16 float16_pack_raw(const FloatParts64 *p) +static float16 QEMU_FLATTEN float16_pack_raw(const FloatParts64 *p) { return make_float16(pack_raw64(p, &float16_params)); } -static inline bfloat16 bfloat16_pack_raw(const FloatParts64 *p) +static bfloat16 QEMU_FLATTEN bfloat16_pack_raw(const FloatParts64 *p) { return pack_raw64(p, &bfloat16_params); } -static inline float32 float32_pack_raw(const FloatParts64 *p) +static float32 QEMU_FLATTEN float32_pack_raw(const FloatParts64 *p) { return make_float32(pack_raw64(p, &float32_params)); } -static inline float64 float64_pack_raw(const FloatParts64 *p) +static float64 QEMU_FLATTEN float64_pack_raw(const FloatParts64 *p) { return make_float64(pack_raw64(p, &float64_params)); } -static float128 float128_pack_raw(const FloatParts128 *p) +static float128 QEMU_FLATTEN float128_pack_raw(const FloatParts128 *p) { const int f_size = float128_params.frac_size - 64; const int e_size = float128_params.exp_size;