From patchwork Tue Sep 8 12:44:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 274266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFC52C433E2 for ; Tue, 8 Sep 2020 12:45:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 331C221D81 for ; Tue, 8 Sep 2020 12:45:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WIblobIg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 331C221D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFd0N-0003Sk-2I for qemu-devel@archiver.kernel.org; Tue, 08 Sep 2020 08:45:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFczF-00022i-8L for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:37 -0400 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:39959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFczB-0001Kv-OD for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:36 -0400 Received: by mail-ej1-x642.google.com with SMTP id z22so22284412ejl.7 for ; Tue, 08 Sep 2020 05:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1g3oKVzWdmlYD9vf8mBq95tsayfNUOlsZ6AfVzlFnBs=; b=WIblobIg+Wntj+LTWy2KgvgEoSFlCs3ED5hya5YdRYfT9uiIWpih36w89axSL/aonw I1jw6uDeJAh7sNHv+g0wVkYf4t+t7/n8CbXH70ChGceO4WxTE0csItRUl3R6ujNRymft 19Y+myvrzIJzFHtJFcsIROvIV6wU0vwmTKT+etNpv0pvqRBGM+SAKkk+ask4MfGfRd53 ka0x+L2ydrk62q6ZniCg9+2rSMTjF0QYyeopvdjy/XHRx0d3tduF8wyIPzSQ5ZNTkxeO ewv9lH6E8whzy37hNuU2XJexIAXPc5rpV5Kwf0FPSEQIRD7qW5F+uTV7nsgdazl/pj6F cTtg== 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; bh=1g3oKVzWdmlYD9vf8mBq95tsayfNUOlsZ6AfVzlFnBs=; b=B3MbshDEM04/O+XpLQc/1jDXIRykINHLapxSpMbwJTELwmNK7V/UksZNZkL3V0C22F M/tskQsLWlu2PQFtOP4ZX3GWI6qSSw08nNCmCJshazwvawcwsqSriG6TFxEYU1j2xq4B yL4Ds6sd4f6AjIpFGzC5NcWjnFxAggwbxPTQBEUBfthB3qByf17fQfP3t+uIraCDDVzL oLiuMSuY1arcMNQJto+2/+82HNB74eSF89SEYQqbhWfARg99rhsyj+jNJlJE6ROB9KV4 ZSzaOhECIOC5SHtcHbysPsvO25eJqUQXjqUKlpLOMxOEAqkf0CIBJciau81HE3T9Ktng vOlg== X-Gm-Message-State: AOAM531TV6gtFiV9orzmPtbxv9WNxdiEU8dex4CClql6nBo+4NQCD8X1 UudLYtFRoS3D6lY3vh6Rl/+2G7fIx3U= X-Google-Smtp-Source: ABdhPJwe5C6KnNEjcc+ReesoAED3qsCqc/SykIjdbXlh5EmLKMDBtxVTrpGdAlwGvU0RgVhzugTGmA== X-Received: by 2002:a17:906:454e:: with SMTP id s14mr26412130ejq.137.1599569072107; Tue, 08 Sep 2020 05:44:32 -0700 (PDT) Received: from rtrkw774-lin.syrmia.com ([46.240.135.226]) by smtp.gmail.com with ESMTPSA id u23sm4396604ejc.108.2020.09.08.05.44.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 05:44:31 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH 1/4] target/mips: Demacro helpers for . Date: Tue, 8 Sep 2020 14:44:25 +0200 Message-Id: <1599569068-9855-2-git-send-email-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> References: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::642; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-ej1-x642.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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: aleksandar.rikalo@syrmia.com, Aleksandar Markovic , aurelien@aurel32.net Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Remove function definitions via macros to achieve better code clarity. Signed-off-by: Aleksandar Markovic --- target/mips/fpu_helper.c | 61 ++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index 7a3a61cab3..f89213947f 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -983,27 +983,46 @@ uint32_t helper_float_floor_2008_w_s(CPUMIPSState *env, uint32_t fst0) } /* unary operations, not modifying fp status */ -#define FLOAT_UNOP(name) \ -uint64_t helper_float_ ## name ## _d(uint64_t fdt0) \ -{ \ - return float64_ ## name(fdt0); \ -} \ -uint32_t helper_float_ ## name ## _s(uint32_t fst0) \ -{ \ - return float32_ ## name(fst0); \ -} \ -uint64_t helper_float_ ## name ## _ps(uint64_t fdt0) \ -{ \ - uint32_t wt0; \ - uint32_t wth0; \ - \ - wt0 = float32_ ## name(fdt0 & 0XFFFFFFFF); \ - wth0 = float32_ ## name(fdt0 >> 32); \ - return ((uint64_t)wth0 << 32) | wt0; \ -} -FLOAT_UNOP(abs) -FLOAT_UNOP(chs) -#undef FLOAT_UNOP + +uint64_t helper_float_abs_d(uint64_t fdt0) +{ + return float64_abs(fdt0); +} + +uint32_t helper_float_abs_s(uint32_t fst0) +{ + return float32_abs(fst0); +} + +uint64_t helper_float_abs_ps(uint64_t fdt0) +{ + uint32_t wt0; + uint32_t wth0; + + wt0 = float32_abs(fdt0 & 0XFFFFFFFF); + wth0 = float32_abs(fdt0 >> 32); + return ((uint64_t)wth0 << 32) | wt0; +} + +uint64_t helper_float_chs_d(uint64_t fdt0) +{ + return float64_chs(fdt0); +} + +uint32_t helper_float_chs_s(uint32_t fst0) +{ + return float32_chs(fst0); +} + +uint64_t helper_float_chs_ps(uint64_t fdt0) +{ + uint32_t wt0; + uint32_t wth0; + + wt0 = float32_chs(fdt0 & 0XFFFFFFFF); + wth0 = float32_chs(fdt0 >> 32); + return ((uint64_t)wth0 << 32) | wt0; +} /* MIPS specific unary operations */ uint64_t helper_float_recip_d(CPUMIPSState *env, uint64_t fdt0) From patchwork Tue Sep 8 12:44:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 305934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AD37C433E2 for ; Tue, 8 Sep 2020 12:47:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5DAB22224 for ; Tue, 8 Sep 2020 12:47:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j/Cfg6aZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5DAB22224 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFd1q-0005cf-Ov for qemu-devel@archiver.kernel.org; Tue, 08 Sep 2020 08:47:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFczF-00022w-T2 for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:37 -0400 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]:38285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFczC-0001Kz-76 for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:37 -0400 Received: by mail-ed1-x542.google.com with SMTP id c8so15835457edv.5 for ; Tue, 08 Sep 2020 05:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rV7pkNnDVb3Fup7JTagH3DCirUP2eQXNJHpnCF2Ra8o=; b=j/Cfg6aZoeKaHhPoybZFxbOzBFlIxBQMzg/XoY3Ay7W1G8j8lYOZyP9Q5z9v9Fzaek OQg0HHlU+tQc/PsjHWeRJUdCi2JsZey/GpFZiMewpfcgDW/CgKAIke2pg6bmcqmsFqEK cB+152BaztCFu50wmg19WY99/D1z5W8YokjuCwHCZxWJsj/8oxHptjQhMHtuUWfRQCAO 0vx+aDwkqptk6OIIoR/96PS3Coz5Y/ASt2IDNIwxxVQV5TAZfhk6q1k6lqy07H2JPVYi 6BsCmQK4W7fAbJRzTYraVeNlYPj6jr44ec82fLArii1ljPtN88Dcv5212Zi8wd2ZcYNx Ousw== 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; bh=rV7pkNnDVb3Fup7JTagH3DCirUP2eQXNJHpnCF2Ra8o=; b=hWHrZhzoQ96EvTQGwNwd/MGqGMJJNgJMzyU5hHsyhyJrOowLtInGyNhvm2VzurU28s EEjkc0JWr+lvF3ykDHqxqNfWL/h9hr7VrnBg48YnFrO2oAVss53kAgK392BCwIMtuBH8 bgpA1kKi/XBon43ypO7E5azO4SnI6iHm0BUfQuzS+no/CFsVN9MhWI4QTYWez65ZGXMK WxvgKazDpdpdY6j58H6FzCmcx0iA9/iu2AZ4VgVitY57kLQRhp9SbuY54j6j5Odu/tNr EAAlB2lSZqZosykTAX9vXVlv4bqnBDjKztBoJeQRr39Ou2JFQNuAZXNdU8dsgeC5g5OR PvnQ== X-Gm-Message-State: AOAM533+x4N6YDi2ogdz5/V55PbUP+9+t4ZzsZIlYrzxVS5j8+it/H6D Vb1V+BFzbDluZn71yl0zCJjcfw3P1mc= X-Google-Smtp-Source: ABdhPJywMA03Ckn8idHv0ZeQi3Gc4qKc4kGsScIsmlheuI6UyT0ieIjZFdmPmiullCWJsWn/JHR4yA== X-Received: by 2002:aa7:dcd9:: with SMTP id w25mr25601345edu.280.1599569072810; Tue, 08 Sep 2020 05:44:32 -0700 (PDT) Received: from rtrkw774-lin.syrmia.com ([46.240.135.226]) by smtp.gmail.com with ESMTPSA id u23sm4396604ejc.108.2020.09.08.05.44.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 05:44:32 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH 2/4] target/mips: Demacro helpers for MF. Date: Tue, 8 Sep 2020 14:44:26 +0200 Message-Id: <1599569068-9855-3-git-send-email-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> References: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::542; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-ed1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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: aleksandar.rikalo@syrmia.com, Aleksandar Markovic , aurelien@aurel32.net Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Remove function definitions via macros to achieve better code clarity. Signed-off-by: Aleksandar Markovic --- target/mips/fpu_helper.c | 63 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index f89213947f..98313951cb 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -1666,25 +1666,54 @@ uint64_t helper_float_nmsub_ps(CPUMIPSState *env, uint64_t fdt0, } -#define FLOAT_FMADDSUB(name, bits, muladd_arg) \ -uint ## bits ## _t helper_float_ ## name(CPUMIPSState *env, \ - uint ## bits ## _t fs, \ - uint ## bits ## _t ft, \ - uint ## bits ## _t fd) \ -{ \ - uint ## bits ## _t fdret; \ - \ - fdret = float ## bits ## _muladd(fs, ft, fd, muladd_arg, \ - &env->active_fpu.fp_status); \ - update_fcr31(env, GETPC()); \ - return fdret; \ +uint32_t helper_float_maddf_s(CPUMIPSState *env, uint32_t fs, + uint32_t ft, uint32_t fd) +{ + uint32_t fdret; + + fdret = float32_muladd(fs, ft, fd, 0, + &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_maddf_d(CPUMIPSState *env, uint64_t fs, + uint64_t ft, uint64_t fd) +{ + uint64_t fdret; + + fdret = float64_muladd(fs, ft, fd, 0, + &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint32_t helper_float_msubf_s(CPUMIPSState *env, uint32_t fs, + uint32_t ft, uint32_t fd) +{ + uint32_t fdret; + + fdret = float32_muladd(fs, ft, fd, float_muladd_negate_product, + &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_msubf_d(CPUMIPSState *env, uint64_t fs, + uint64_t ft, uint64_t fd) +{ + uint64_t fdret; + + fdret = float64_muladd(fs, ft, fd, float_muladd_negate_product, + &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; } -FLOAT_FMADDSUB(maddf_s, 32, 0) -FLOAT_FMADDSUB(maddf_d, 64, 0) -FLOAT_FMADDSUB(msubf_s, 32, float_muladd_negate_product) -FLOAT_FMADDSUB(msubf_d, 64, float_muladd_negate_product) -#undef FLOAT_FMADDSUB /* compare operations */ #define FOP_COND_D(op, cond) \ From patchwork Tue Sep 8 12:44:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 305935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2180C2BBD0 for ; Tue, 8 Sep 2020 12:45:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9007C21D81 for ; Tue, 8 Sep 2020 12:45:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KAemnoxf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9007C21D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFd0K-0003PG-Kd for qemu-devel@archiver.kernel.org; Tue, 08 Sep 2020 08:45:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFczG-00023N-Km for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:38 -0400 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:39396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFczD-0001L5-Ij for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:38 -0400 Received: by mail-ed1-x541.google.com with SMTP id c10so15830395edk.6 for ; Tue, 08 Sep 2020 05:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=59FKQ7FjWGaMx6p/hgj1RpZbTEenTpc0lYB9ZMhjTO0=; b=KAemnoxfBQ+nO1USzzfug3TssaL5EeZCvlxT0pYckJdeP2ZXgrfoqQrK/2A4naz2ZK 2fghgpZu13p/ud7Kc9XPd+Pilkl1ZW2FYFBd4BYQp5z1vGGoiWkxJV3e9H88k53cYXVn Q3kwwnKvLDNKo+8wdjdXSy7TZ99dq/oSiuf+EjkISlE6pHh/9B/o0rum/lN6uSQXKA+k R+wXs1y+dWHqgDCEctZnPsYClo3qzMGKOglh6mS8RJrBoLo8nTouK4CwFOwA2moO5W2f AuJJ5ZOREBWjp2PbTe2Gx9t6ILYrL/jIK/51ce9IccRf7JEW4zFmBh36m1V3Jx2EToGK AkYQ== 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; bh=59FKQ7FjWGaMx6p/hgj1RpZbTEenTpc0lYB9ZMhjTO0=; b=XUtg5wiWH+/jThJ64XY4LHZjcNP7qKByHZa6ffU/8tzLRy2/kzz0ObS/oLkeG2qYpC CNg/XyXzVbFQ3t1GWw9eSi51pb5AG0gzdtkFuR/IeQ3Z5CoLzygO7blHOZsvNI1fUH7k UeQdPwKwoBacTeqi9GAfyWu3HzkuxhdzGf+Vbirw9KR3b8ym8hOe1X1oW2EBnH791Gp+ u6aGL4tQr7pL1eGAY9O9Brb+upmBEO+rIGgXi1zgLPHOHdBpvrERzjnN16ZhiHdVS4Lg aG/BYDrI9qFXfh3ZBSGW+2oAtVZ8cvK0WIz7GNXP7hOI/Nbjjnkr1pAJ5Ryx3mXyarQM SGrw== X-Gm-Message-State: AOAM5310vturKgmKQye5OGz3oAlWb28rRvbnWr+VEzq2Nmf6fj4gXwLQ DG6ANJ5KqtJBY9+h6+H7d3LsGzsLv0Q= X-Google-Smtp-Source: ABdhPJyfNV9WzZ+GFjTXkjCziWt4HcwmFxK552NnSGtfbY1sNN0QwVboMD9CjXuMr8Gm1xM7yU4Qxw== X-Received: by 2002:a50:ce06:: with SMTP id y6mr26094683edi.273.1599569073489; Tue, 08 Sep 2020 05:44:33 -0700 (PDT) Received: from rtrkw774-lin.syrmia.com ([46.240.135.226]) by smtp.gmail.com with ESMTPSA id u23sm4396604ejc.108.2020.09.08.05.44.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 05:44:33 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH 3/4] target/mips: Demacro helpers for . Date: Tue, 8 Sep 2020 14:44:27 +0200 Message-Id: <1599569068-9855-4-git-send-email-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> References: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::541; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-ed1-x541.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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: aleksandar.rikalo@syrmia.com, Aleksandar Markovic , aurelien@aurel32.net Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Remove function definitions via macros to achieve better code clarity. Signed-off-by: Aleksandar Markovic --- target/mips/fpu_helper.c | 104 ++++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 23 deletions(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index 98313951cb..f480c7296e 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -1475,29 +1475,87 @@ uint64_t helper_float_mulr_ps(CPUMIPSState *env, uint64_t fdt0, uint64_t fdt1) return ((uint64_t)fsth2 << 32) | fstl2; } -#define FLOAT_MINMAX(name, bits, minmaxfunc) \ -uint ## bits ## _t helper_float_ ## name(CPUMIPSState *env, \ - uint ## bits ## _t fs, \ - uint ## bits ## _t ft) \ -{ \ - uint ## bits ## _t fdret; \ - \ - fdret = float ## bits ## _ ## minmaxfunc(fs, ft, \ - &env->active_fpu.fp_status); \ - update_fcr31(env, GETPC()); \ - return fdret; \ -} - -FLOAT_MINMAX(max_s, 32, maxnum) -FLOAT_MINMAX(max_d, 64, maxnum) -FLOAT_MINMAX(maxa_s, 32, maxnummag) -FLOAT_MINMAX(maxa_d, 64, maxnummag) - -FLOAT_MINMAX(min_s, 32, minnum) -FLOAT_MINMAX(min_d, 64, minnum) -FLOAT_MINMAX(mina_s, 32, minnummag) -FLOAT_MINMAX(mina_d, 64, minnummag) -#undef FLOAT_MINMAX + +uint32_t helper_float_max_s(CPUMIPSState *env, uint32_t fs, uint32_t ft) +{ + uint32_t fdret; + + fdret = float32_maxnum(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_max_d(CPUMIPSState *env, uint64_t fs, uint64_t ft) +{ + uint64_t fdret; + + fdret = float64_maxnum(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint32_t helper_float_maxa_s(CPUMIPSState *env, uint32_t fs, uint32_t ft) +{ + uint32_t fdret; + + fdret = float32_maxnummag(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_maxa_d(CPUMIPSState *env, uint64_t fs, uint64_t ft) +{ + uint64_t fdret; + + fdret = float64_maxnummag(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint32_t helper_float_min_s(CPUMIPSState *env, uint32_t fs, uint32_t ft) +{ + uint32_t fdret; + + fdret = float32_minnum(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_min_d(CPUMIPSState *env, uint64_t fs, uint64_t ft) +{ + uint64_t fdret; + + fdret = float64_minnum(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint32_t helper_float_mina_s(CPUMIPSState *env, uint32_t fs, uint32_t ft) +{ + uint32_t fdret; + + fdret = float32_minnummag(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + +uint64_t helper_float_mina_d(CPUMIPSState *env, uint64_t fs, uint64_t ft) +{ + uint64_t fdret; + + fdret = float64_minnummag(fs, ft, &env->active_fpu.fp_status); + + update_fcr31(env, GETPC()); + return fdret; +} + /* ternary operations */ From patchwork Tue Sep 8 12:44:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Markovic X-Patchwork-Id: 274265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D9D2C43461 for ; Tue, 8 Sep 2020 12:47:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D8B622225 for ; Tue, 8 Sep 2020 12:47:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GUBcHA1w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D8B622225 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFd1j-0005YK-52 for qemu-devel@archiver.kernel.org; Tue, 08 Sep 2020 08:47:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFczF-00022n-Er for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:37 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:42472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFczD-0001LC-LV for qemu-devel@nongnu.org; Tue, 08 Sep 2020 08:44:37 -0400 Received: by mail-ed1-x543.google.com with SMTP id l63so15814899edl.9 for ; Tue, 08 Sep 2020 05:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lCrIb5WUVl3SkQdV+w3xyR/zikAcpGVj/acDDdcJ41k=; b=GUBcHA1wqnvxU9PRbwyJncSD8jwDS7+xXWNt6Sul3RQdFjWCvW2cI4uQ2lCKY2Wcdm vOeDHM9OeTcojR1WsvqzaolMGC/2ysfgG1yZBHrGwuhEAAjZHvcqYnTyaxrRvWB0XxLN W6lC5sZQaNCKr3Q13uypLX2aXHojXro+a7ZIqAhHjMbXloctrhu7ZSD/w87rVnZOWZRr VrI/oHRtRzKmPKBi5LbYL8e4+ux270Bhq2L+beO8Pp35e+SC7dp1GyefQ4sYqogE9oo7 lXoaHtI8yVpzHTywkj/jWwLFkZNSB5tSjung+utPvH4TKUevFM5xUNq8ItRDDNonZ3nk l8hQ== 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; bh=lCrIb5WUVl3SkQdV+w3xyR/zikAcpGVj/acDDdcJ41k=; b=rNFQ6tGM2J719osnefqqMNi3TTwoUoNQpnXNQLhBQIAmXGvJ/jQAlM9YheN4LSSRYW +05SDAFHyG61Whk1W+u5SJw2B8KTfkxbD19KRy0wDk5ih81rPUEklzPBTP8Vqa4+6HcB 5diWtw/JaoLxVTv/smtlH+FiFH/JIS8IpU7flRxhWuvlQOn6iOttrQzTFMzDaTG3uTgE R/n1sQWNxc8T+THzEmZ316QA40VWTybDbCfu/BCLTiMZg/FT7zDnuDP1fOhHi5E/6n4T IoYrLqZsXJhou7UO0YMB+utfksY50AqF8fmYGWvoWnE21f20ti3vFKXpXCU6Ryju5iXB M71A== X-Gm-Message-State: AOAM532RYSS2rux6+HV2K8GtKTU8ecgWGDGU5SHzTrz/QIW6U6jfsv0t 71rPbGPn13RqjEuuHOUJ0PXYO68bxqo= X-Google-Smtp-Source: ABdhPJx7/2ArYX2RyR9jknaODlJ/BLuBavNs2ZRrHyHFmkmV5t3Y2YxeTF8xV+c2PMLSdY9VfiDodw== X-Received: by 2002:a50:84a2:: with SMTP id 31mr27602764edq.138.1599569074200; Tue, 08 Sep 2020 05:44:34 -0700 (PDT) Received: from rtrkw774-lin.syrmia.com ([46.240.135.226]) by smtp.gmail.com with ESMTPSA id u23sm4396604ejc.108.2020.09.08.05.44.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 05:44:33 -0700 (PDT) From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PATCH 4/4] target/mips: Refactor helpers for fp comparison instructions Date: Tue, 8 Sep 2020 14:44:28 +0200 Message-Id: <1599569068-9855-5-git-send-email-aleksandar.qemu.devel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> References: <1599569068-9855-1-git-send-email-aleksandar.qemu.devel@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::543; envelope-from=aleksandar.qemu.devel@gmail.com; helo=mail-ed1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, 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: aleksandar.rikalo@syrmia.com, Aleksandar Markovic , aurelien@aurel32.net Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This change causes slighlty better performance of emulation of fp comparison instructions via better compiler optimization of refactored code. The functionality is otherwise unchanged. Signed-off-by: Aleksandar Markovic --- target/mips/fpu_helper.c | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/target/mips/fpu_helper.c b/target/mips/fpu_helper.c index f480c7296e..22d533322b 100644 --- a/target/mips/fpu_helper.c +++ b/target/mips/fpu_helper.c @@ -1780,11 +1780,12 @@ void helper_cmp_d_ ## op(CPUMIPSState *env, uint64_t fdt0, \ { \ int c; \ c = cond; \ - update_fcr31(env, GETPC()); \ - if (c) \ + if (c) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } \ void helper_cmpabs_d_ ## op(CPUMIPSState *env, uint64_t fdt0, \ uint64_t fdt1, int cc) \ @@ -1793,11 +1794,12 @@ void helper_cmpabs_d_ ## op(CPUMIPSState *env, uint64_t fdt0, \ fdt0 = float64_abs(fdt0); \ fdt1 = float64_abs(fdt1); \ c = cond; \ - update_fcr31(env, GETPC()); \ - if (c) \ + if (c) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } /* @@ -1859,11 +1861,12 @@ void helper_cmp_s_ ## op(CPUMIPSState *env, uint32_t fst0, \ { \ int c; \ c = cond; \ - update_fcr31(env, GETPC()); \ - if (c) \ + if (c) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } \ void helper_cmpabs_s_ ## op(CPUMIPSState *env, uint32_t fst0, \ uint32_t fst1, int cc) \ @@ -1872,11 +1875,12 @@ void helper_cmpabs_s_ ## op(CPUMIPSState *env, uint32_t fst0, \ fst0 = float32_abs(fst0); \ fst1 = float32_abs(fst1); \ c = cond; \ - update_fcr31(env, GETPC()); \ - if (c) \ + if (c) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } /* @@ -1944,15 +1948,17 @@ void helper_cmp_ps_ ## op(CPUMIPSState *env, uint64_t fdt0, \ fsth1 = fdt1 >> 32; \ cl = condl; \ ch = condh; \ - update_fcr31(env, GETPC()); \ - if (cl) \ + if (cl) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ - if (ch) \ + } \ + if (ch) { \ SET_FP_COND(cc + 1, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc + 1, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } \ void helper_cmpabs_ps_ ## op(CPUMIPSState *env, uint64_t fdt0, \ uint64_t fdt1, int cc) \ @@ -1965,15 +1971,17 @@ void helper_cmpabs_ps_ ## op(CPUMIPSState *env, uint64_t fdt0, \ fsth1 = float32_abs(fdt1 >> 32); \ cl = condl; \ ch = condh; \ - update_fcr31(env, GETPC()); \ - if (cl) \ + if (cl) { \ SET_FP_COND(cc, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc, env->active_fpu); \ - if (ch) \ + } \ + if (ch) { \ SET_FP_COND(cc + 1, env->active_fpu); \ - else \ + } else { \ CLEAR_FP_COND(cc + 1, env->active_fpu); \ + } \ + update_fcr31(env, GETPC()); \ } /* @@ -2080,12 +2088,12 @@ uint64_t helper_r6_cmp_d_ ## op(CPUMIPSState *env, uint64_t fdt0, \ { \ uint64_t c; \ c = cond; \ - update_fcr31(env, GETPC()); \ if (c) { \ return -1; \ } else { \ return 0; \ } \ + update_fcr31(env, GETPC()); \ } /* @@ -2175,12 +2183,12 @@ uint32_t helper_r6_cmp_s_ ## op(CPUMIPSState *env, uint32_t fst0, \ { \ uint64_t c; \ c = cond; \ - update_fcr31(env, GETPC()); \ if (c) { \ return -1; \ } else { \ return 0; \ } \ + update_fcr31(env, GETPC()); \ } /*