From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294524464997.1029333268872; Thu, 27 Apr 2017 05:02:04 -0700 (PDT) Received: from localhost ([::1]:60202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i7X-00053a-5L for importer@patchew.org; Thu, 27 Apr 2017 08:02:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5q-0003rK-Px for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5o-0001Mm-8U for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:18 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5o-0001MA-1x for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:16 -0400 Received: by mail-wr0-x244.google.com with SMTP id g12so3522661wrg.2 for ; Thu, 27 Apr 2017 05:00:15 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=wLB7THZ04AUqkYfnidgIHeep/5NqZnmTEiBShxknpKE=; b=sL2Te01NavHa4IN7sIDEwvVcdfu8k2mHHomhTAH6t9/R2MQ5qLu3HQZq7SxunWV0Sy igHeZr5PYAQTQV1jo+SU3Dk6WAFAhverI3DAi5E+Wo7REukmp0WHzqzuX/voMYdqp6YF OZqUDSmmnOWh8NLrKLtfNQRJ8UZO0Or6R3lnjyGdoqPd5kkflM2bS/MdBCYZjJ1lM1Y2 Y1o/UT4h74QkFX6wUpT6vfIJwm60Tv02W6PLNXrK7+lAvXECkDoSp/wLYjTJavnzUeU8 jFveyMm4vlxw787Hnz4VN9i2AH1iCPo817OXhzRTp49NJ+LW5n9TRf1gj3rFx2tkG2Mz OMTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=wLB7THZ04AUqkYfnidgIHeep/5NqZnmTEiBShxknpKE=; b=EAjeqoNoFdS4covwzV6SzAp3f41QcYS7d+a4CzzQ+Zm4EtaG+GedgqfCOw4nDhfPsc cdDeh7QW7JbDQ+yivJQSpuN7Zr5M4afwo3G0wXxvHFSwngCcgAqSIe4KofmF1n64gCth hhyemJ8wm2J90D7eiiI23iWHmdRSqjyeSkoOiugmzQgrkpudngDNNVG8o2KtwvL9ArvB qreu7hISMXxu63arMENHsN9let/5N/BGhQMOoJyCG4ofPXfN4YJY2BnMt+83dOZyaaWp zSl2waEV25trT2q2msPbW5fAwbgSvkuXoZxTOjliYSJiLFg6+RtEWMH3cLHpAu6Ih/Rx Le6A== X-Gm-Message-State: AN3rC/7Ljj1CwzbUvVXHY3PW84QZ6MUh2xNcJoGLUS4rDYF+2we5z7jZ w7sXtU58LAIJGsWbLpA= X-Received: by 10.223.170.197 with SMTP id i5mr3137449wrc.143.1493294414582; Thu, 27 Apr 2017 05:00:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:48 +0200 Message-Id: <20170427120006.20564-2-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 01/19] target/nios2: Fix 64-bit ilp32 compilation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Avoid a "cast from pointer to integer of different size" warning by using the proper host type. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/nios2/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index cfec479..2f3c2e5 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -164,7 +164,7 @@ static void gen_goto_tb(DisasContext *dc, int n, uint32= _t dest) if (use_goto_tb(dc, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_tl(dc->cpu_R[R_PC], dest); - tcg_gen_exit_tb((tcg_target_long)tb + n); + tcg_gen_exit_tb((uintptr_t)tb + n); } else { tcg_gen_movi_tl(dc->cpu_R[R_PC], dest); tcg_gen_exit_tb(0); --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294678153101.2923713857831; Thu, 27 Apr 2017 05:04:38 -0700 (PDT) Received: from localhost ([::1]:60223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iA0-0007Q4-JF for importer@patchew.org; Thu, 27 Apr 2017 08:04:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5q-0003rJ-PG for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5p-0001N7-0f for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:18 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5o-0001Mj-QT for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:16 -0400 Received: by mail-wr0-x244.google.com with SMTP id w50so3539818wrc.0 for ; Thu, 27 Apr 2017 05:00:16 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q55tMjDBsgKg6czCMP/NhBeCPwRzUyWjBgFurKZqoIY=; b=DoQjo6JbZaEiPuFcfHZL79Wk/CJz00TT77VsmOui07NGm37lQzsVflNoehvnACQAnz h6W4+3hQFGZLmtJZ9v7Eg5krvUBXNVAJ10gjgH1v7CeUAn9tzHhFa1m8iMvi/s579ufh KoW3MLDYoChiAxUGjuw1ZyvY1+UdHslGol6gMfEecy1/t59rqknLAX39PudW1fFmfFBd k+Wbx/1I8jjieEdVey52FuoDYJHlM95RotmjnJih9sfCZooptSVetxsUk+oU7SHuGh4G 5MuFYWneQ49qgTc8RVk4ggtdVmQgyUBFs0evWGsSz5eeNR3XUPPhaFhRkrzdBgar7nOk Ru2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Q55tMjDBsgKg6czCMP/NhBeCPwRzUyWjBgFurKZqoIY=; b=TtbAEUPcjMzb50/ltl3x64pUjymrm/spUwftITQHZT1GNjE9AVTIHCSqfd42Hqvq2w 5t6GifqUxe97X4wajcbPjNVRcrpqTL41f7igqIf+xogVTeeB7AJ8BIvpIq/Z2MPeGYDG wJef7+T5jAvNIbg8Ts2Y2N9kjU06ZHL6No7jOddrk+wKztiB+fRDyK6whhRyg8M9KTuP gh1qih+N4DlbRLDx4oM/TpgdBnqhSrcNf1OuMfBhD678HM0s6/t9qAgtpz+7+ozOVEeR T0GS1cjb5DKfWYI41iQ2pxQXeGOUUg7w2t7lGoWK4CCxCsaKFN1NohFTe5To9r2FfET8 eTBA== X-Gm-Message-State: AN3rC/7W69ZU9WIheGDlQLw57VpaT6FBg+A4JZt5Ccgbd+WpYWLuDdZB QOsqkIv11GMSCw== X-Received: by 10.223.128.101 with SMTP id 92mr3474039wrk.108.1493294415784; Thu, 27 Apr 2017 05:00:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:49 +0200 Message-Id: <20170427120006.20564-3-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 02/19] tcg/sparc: Use the proper compilation flags for 32-bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We have required a v9 cpu since 9b9c37c36439ee0452632253dac7a31897f27f70. However, the flags we were using did not reliably enable v8plus, which meant that the compiler didn't know it could inline 64-bit atomics. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index c35acf1..55dd9c3 100755 --- a/configure +++ b/configure @@ -1206,12 +1206,12 @@ case "$cpu" in LDFLAGS=3D"-m64 $LDFLAGS" ;; sparc) - LDFLAGS=3D"-m32 $LDFLAGS" - CPU_CFLAGS=3D"-m32 -mcpu=3Dultrasparc" + CPU_CFLAGS=3D"-m32 -mv8plus -mcpu=3Dultrasparc" + LDFLAGS=3D"-m32 -mv8plus $LDFLAGS" ;; sparc64) - LDFLAGS=3D"-m64 $LDFLAGS" CPU_CFLAGS=3D"-m64 -mcpu=3Dultrasparc" + LDFLAGS=3D"-m64 $LDFLAGS" ;; s390) CPU_CFLAGS=3D"-m31" --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294834092723.9333460073973; Thu, 27 Apr 2017 05:07:14 -0700 (PDT) Received: from localhost ([::1]:60260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iCW-00014V-QZ for importer@patchew.org; Thu, 27 Apr 2017 08:07:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5r-0003rt-Ny for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5q-0001ON-IX for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:19 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33875) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5q-0001Nt-Cv for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:18 -0400 Received: by mail-wr0-x241.google.com with SMTP id 6so3543128wrb.1 for ; Thu, 27 Apr 2017 05:00:18 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BOc4rjn36S7SMICws/96OxukYlv/+kFwA4Mh33I3cXk=; b=jaH3da2uILOZMKHV2SWqyv8EMFZ11E99mck2+MSDoqlxVX4cJpksn+5B5wFTbmcDm6 MCXcLBnsPW5mNsOZ09jolVBRJ0C1AAalM8kM1yMzNmrB+EBCIYXFs/nEB+/po1e165FS DOyf2eLjdiYhEwjUSrMfxgpOLH3ZsqnIrgpkRp+Z2rO3zA2AAoi/IHFhaZW0P4Bf+Yzm WECMCMRsoqRa6rnS9ovzbwKOKwpUMZ9vdahSpzIg6tQ6G1n0xV95wKxkpcw6EMGZ94MT TC4VbBU4lIrLIlVm1NaSb14VTVm+lNkW20GMM2HDdrWq1AxPOybm80eRWqRuiq/La3RF a7nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BOc4rjn36S7SMICws/96OxukYlv/+kFwA4Mh33I3cXk=; b=Av0+FQDd7C0pV9b8aytbsGvp9h9SJ0G0QNgomIMBNcG6+X9s21W+pXIesutKiqAVRJ QbSq/fVr6dxJGGoIHck0Bk8/VkpdbJM3YJRl8wpNw8/kvbYjgOh8Vyshh7GGx3YkcAiv 5x2GIDheNWysqJihYaLOuvfEtmwajigwweCkmyg+K8XzR2Y9+DzaRrn15KDwdQZqSvNk KZBTa8rF1/0q/tvlp22O75cIa8cEVQFU+pnUiphic+WTk1jmTOLi/DG2h3Fl6JQsxEDo qVeePDAFXRZv6KNMbihqnLNavRWNB/CvAi00Jxdng62YKo4Slr/yrVnqjyVdTmCDH0NF 1/Eg== X-Gm-Message-State: AN3rC/6Gp7+6VX4fQkdbSKTT3F/aQDe83thI3JfC24b9uMWyf+2WYN0A gqdAFfB0NGwOfqEFtyQ= X-Received: by 10.223.135.84 with SMTP id 20mr3079562wrz.199.1493294416854; Thu, 27 Apr 2017 05:00:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:50 +0200 Message-Id: <20170427120006.20564-4-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v5 03/19] qemu/atomic: Loosen restrictions for 64-bit ILP32 hosts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We need to coordinate with the TCG_OVERSIZED_GUEST test in cputlb.c, and allow 64-bit atomics even though sizeof(void *) =3D=3D 4. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- include/qemu/atomic.h | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 878fa07..8a564e9 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -88,6 +88,24 @@ #define smp_read_barrier_depends() barrier() #endif =20 +/* Sanity check that the size of an atomic operation isn't "overly large". + * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not + * want to use them because we ought not need them, and this lets us do a + * bit of sanity checking that other 32-bit hosts might build. + * + * That said, 64-bit hosts running in ilp32 mode cannot use pointer size + * as the test; we need the full register size. + * ??? Testing TCG_TARGET_REG_BITS =3D=3D 64 would exact, but we probably = do + * not want to pull in everything else TCG related. + * + * Note that x32 is fully detected with __x64_64__ + _ILP32, and that for + * Sparc we always force the use of sparcv9 in configure. + */ +#if defined(__x86_64__) || defined(__sparc__) +# define ATOMIC_REG_SIZE 8 +#else +# define ATOMIC_REG_SIZE sizeof(void *) +#endif =20 /* Weak atomic operations prevent the compiler moving other * loads/stores past the atomic operation load/store. However there is @@ -104,7 +122,7 @@ =20 #define atomic_read(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ atomic_read__nocheck(ptr); \ }) =20 @@ -112,7 +130,7 @@ __atomic_store_n(ptr, i, __ATOMIC_RELAXED) =20 #define atomic_set(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ atomic_set__nocheck(ptr, i); \ } while(0) =20 @@ -130,27 +148,27 @@ =20 #define atomic_rcu_read(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ atomic_rcu_read__nocheck(ptr, &_val); \ _val; \ }) =20 #define atomic_rcu_set(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) =20 #define atomic_load_acquire(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ _val; \ }) =20 #define atomic_store_release(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) =20 @@ -162,7 +180,7 @@ }) =20 #define atomic_xchg(ptr, i) ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ atomic_xchg__nocheck(ptr, i); \ }) =20 @@ -175,7 +193,7 @@ }) =20 #define atomic_cmpxchg(ptr, old, new) ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ atomic_cmpxchg__nocheck(ptr, old, new); \ }) =20 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493295138652488.2749147148661; Thu, 27 Apr 2017 05:12:18 -0700 (PDT) Received: from localhost ([::1]:60327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iHR-0005UI-8I for importer@patchew.org; Thu, 27 Apr 2017 08:12:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5x-0003xR-BA for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5r-0001PI-Gv for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:25 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5r-0001OV-BF for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:19 -0400 Received: by mail-wm0-x243.google.com with SMTP id z129so4091769wmb.1 for ; Thu, 27 Apr 2017 05:00:19 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pXf9BXMZox9a09Wy+aQLf7QAL2I9F1bmMb038KhfBok=; b=XPijppCGM3wtHn/rgi9cFM589GFyF9riutNW6vedAdQ0qmrKCIvgDzTmbDHTu9mYHt oLfI/wm/ZooTRTrr/WQIOC0oq6Gc12sDIKvihiKEsjMfFOK1f/hjIKveEpI9iQP09EPk TOtmA6nITFqsURAVlJsOHk9IaTG/ENFLQWHnghzSn225C0S4IdrqEqmE/wDUTLroEP28 39cMnc7Htm21x0oE8Nhu8ykhA7g8nfGD5CoQBvmuKdpu1jQIGvomO5d6H8L9wl08jzdc 5GVppTDp0rvI7+63798MF71s6ALToCfXm6qSuDSPtGYN5Xstxp2hGKouI1rpJfkAe4AM Wo5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pXf9BXMZox9a09Wy+aQLf7QAL2I9F1bmMb038KhfBok=; b=GdPRP0fvYfrHET6bLgHNLGn4lDF0G9kA5s6f6k2J+3w3SJL4RWSyX9Q5fQnMR4SI7C /zqagGhw2wSXlm7+oG2fiCHPRlnknGIjF/Di9jjFrc6+y6muUOuk/yFzdE6Gh6fDikb7 I+WumLAeSv1M0Pebzugwku1HlY30pVeJrZUIulISjTUAai0+YFtNABc1bD9F/1l+ymfz 3jSpjhST8uD/sGoXF8ngjlOJ4FGDhmENBvaaZTIF0E0h9xDjsypF+tXylB6JRPrhlWZg gmJSa0fEGuCCwHrMW279dln6naH/kDsAIz/dQr+KilKL/t75dgk/9j8wxWhV3irPFQy6 rhIQ== X-Gm-Message-State: AN3rC/7f918/8JxWJuiusf8vRz0BNP+xJzWafnIRU10+lSNlQFGe1d5P GPzCWV7Qe6wvmA== X-Received: by 10.28.138.209 with SMTP id m200mr1904914wmd.109.1493294418176; Thu, 27 Apr 2017 05:00:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:51 +0200 Message-Id: <20170427120006.20564-5-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH v5 04/19] exec-all: export tb_htable_lookup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-2-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- cpu-exec.c | 6 ++---- include/exec/exec-all.h | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 63a56d0..5b181c1 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -309,10 +309,8 @@ static bool tb_cmp(const void *p, const void *d) return false; } =20 -static TranslationBlock *tb_htable_lookup(CPUState *cpu, - target_ulong pc, - target_ulong cs_base, - uint32_t flags) +TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, + target_ulong cs_base, uint32_t flags) { tb_page_addr_t phys_pc; struct tb_desc desc; diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index bcde1e6..87ae10b 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -368,6 +368,8 @@ struct TranslationBlock { void tb_free(TranslationBlock *tb); void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); +TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, + target_ulong cs_base, uint32_t flags); =20 #if defined(USE_DIRECT_JUMP) =20 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294531105657.5858758709404; Thu, 27 Apr 2017 05:02:11 -0700 (PDT) Received: from localhost ([::1]:60204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i7c-00057z-KJ for importer@patchew.org; Thu, 27 Apr 2017 08:02:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5t-0003tU-Gp for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5s-0001QC-Na for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:21 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33410) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5s-0001Pa-Gm for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:20 -0400 Received: by mail-wr0-x242.google.com with SMTP id w50so3540002wrc.0 for ; Thu, 27 Apr 2017 05:00:20 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q+oN2BnzGhA/aEQvXgKe4onnFwQsDRpheeO5aPPc5tk=; b=O/UWjmQqoPxpofuBerUe8kWjQ5HIbikTwGxG4dok1sEgqqJUmvyau+c498u+HVlsAQ IF8XiVuSejppkymI5Yu2iakQ8Zm91f0++rWocS3/GT2glNjN5ZeZdR+DqswXLMKKUxrT tQoBsTrdTnZjbQZO1JNhJagY12UgEvmh6/toZDRrQ6vEBp4uw78DWqp32kuNLWBh6QN2 jqmnZaCtUgOj//XwXRZBRT7z3ZjQO7MF/QdYyW9JaRXheTAWIRI5V2z+/1wVApF6BlgE kDUQNwykoiIN/Q9L3wh5lrPJ8cA4XkOzBFtzyYRHcu8UKa3kDH2hjGy6bzTdIZkP9hjG vghA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Q+oN2BnzGhA/aEQvXgKe4onnFwQsDRpheeO5aPPc5tk=; b=HZ5bdt4zIqIKMCy26AhSkO3PaumZX7hUCwbf5OFQGy5bwjzInYUAmLSkselFEpV6cK O3kYAG0ti3ok3CX9pJYQIQCx+gI5+gau8fS1b3mKPf3aJpLvAuaul2r0/a9LOqtLQH00 bCgkOCvlyFdO3s+KdI7xD9wkl8SmRwUrWULsHnlJLnhnjoAnnnTgYs1UXWbjtyktTjVA UJDd2uh4yFV+QxRNeDgQgL3h5kVcX8CR/NileUij5YDamHuNQXY39ge+Lsjg5bHcXEPk QjHIHpSAO5o6CDACMp8Jk4DU+dd+rFI0ZcDIT35XTIjDc3eK2X5ycRQK+P3kQAL/HyAe MmOw== X-Gm-Message-State: AN3rC/7c/7izQEO3aSAnF4MORw6E73vbjRTsaDkCtvAT1O6yEoL5zSLF Vs5HpolfoLClLA== X-Received: by 10.223.168.120 with SMTP id l111mr3159832wrc.137.1493294419361; Thu, 27 Apr 2017 05:00:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:52 +0200 Message-Id: <20170427120006.20564-6-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH v5 05/19] tcg-runtime: add lookup_tb_ptr helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: "Emilio G. Cota" This paves the way for upcoming work. Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-3-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson --- tcg-runtime.c | 24 ++++++++++++++++++++++++ tcg/tcg-runtime.h | 2 ++ tcg/tcg.h | 1 + 3 files changed, 27 insertions(+) diff --git a/tcg-runtime.c b/tcg-runtime.c index 4c60c96..8a24bdd 100644 --- a/tcg-runtime.c +++ b/tcg-runtime.c @@ -27,6 +27,7 @@ #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" +#include "exec/tb-hash.h" =20 /* 32-bit helpers */ =20 @@ -141,6 +142,29 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) return ctpop64(arg); } =20 +void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr) +{ + CPUState *cpu =3D ENV_GET_CPU(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)= ]); + if (likely(tb)) { + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + if (likely(tb->pc =3D=3D addr && tb->cs_base =3D=3D cs_base && + tb->flags =3D=3D flags)) { + return tb->tc_ptr; + } + tb =3D tb_htable_lookup(cpu, pc, cs_base, flags); + if (likely(tb)) { + atomic_set(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)], t= b); + return tb->tc_ptr; + } + } + return tcg_ctx.code_gen_epilogue; +} + void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC()); diff --git a/tcg/tcg-runtime.h b/tcg/tcg-runtime.h index 114ea6f..c41d38a 100644 --- a/tcg/tcg-runtime.h +++ b/tcg/tcg-runtime.h @@ -24,6 +24,8 @@ DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i6= 4) DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64) =20 +DEF_HELPER_FLAGS_2(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env, tl) + DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) =20 #ifdef CONFIG_SOFTMMU diff --git a/tcg/tcg.h b/tcg/tcg.h index 6c216bb..5ec48d1 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -699,6 +699,7 @@ struct TCGContext { extension that allows arithmetic on void*. */ int code_gen_max_blocks; void *code_gen_prologue; + void *code_gen_epilogue; void *code_gen_buffer; size_t code_gen_buffer_size; void *code_gen_ptr; --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294987190327.815403674657; Thu, 27 Apr 2017 05:09:47 -0700 (PDT) Received: from localhost ([::1]:60272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iEz-0003Qb-7K for importer@patchew.org; Thu, 27 Apr 2017 08:09:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5v-0003vI-Hg for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5u-0001Rm-EL for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:23 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5u-0001Qx-4i for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:22 -0400 Received: by mail-wr0-x241.google.com with SMTP id 6so3543367wrb.1 for ; Thu, 27 Apr 2017 05:00:21 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=spoGamuiN91L+aAcqJUG6NOrLLEC3OghfmPe+0GzV3Q=; b=hPPKiAZC9ZBx/vgY9iBvdiVMSxWbXTpm+z02+e62DibCyD6m+EW/zQj1wqb98fUNB9 9MKmW3niC2lC4WpPf+9jXMC+mz3ra9r+42Euq+PdJ42iNSkvf/C8+ODEsBJIM1fYPz2L e0L40pWHW9wTkYoqB2LuOwpH43dNCkxgSF86223yuX0pWu/HOiGfPe4+dwHudDYHSXVG hQGlOtKfDpeZ1yOI0wMj/lh1WEPv6p5yj7/lUo9xz3x2aLYp03Nrp8cNQeR5CvSsHrUF +Vh73z/kgxQ5BLHhqjHmqYE8pcoLI1oPy7+yaNPZRakTdVsu5uoFkzuR1FqNKyXk/iHv fiwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=spoGamuiN91L+aAcqJUG6NOrLLEC3OghfmPe+0GzV3Q=; b=C0lqauqxmlhNOUI5ZqMAi3nGmeBdi/NctHyHagUiOTOMdvkcly0pGAC8xoKLIQsO+r 8zqYTUwh3PEMs/GWifgF9tFivXRowlzHLxx7TQMqcR0vn/q+wCQTUTOQsAz2tSzeYGkJ eMnPJwDtLLBPikET7mIrKLzP/kx5fvJr5kSR6LE7nEhjyjB7ixJhkzROegvEq1Bc7aSP o+f8adBq3PjBxAdx2qiXgAUEkTuoblkiaqB53laZDVEm3qI3fHvwCSLxrqvusHgOcSFK mV8zSHBYSGVNHPQiBs9ChqCb5UuhUHr2WzO0gFq3WBmXh/Tcgdu3weyfSgxF49kRAbX8 6idw== X-Gm-Message-State: AN3rC/59PCR3dg9e3B9Uxn/QCtnImxw2YNOTlo5mBh/sPIKx7OwcBqOP HHr+8qbM9prqSlNNXbY= X-Received: by 10.223.133.97 with SMTP id 88mr3398080wrh.166.1493294420757; Thu, 27 Apr 2017 05:00:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:53 +0200 Message-Id: <20170427120006.20564-7-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v5 06/19] tcg: introduce goto_ptr opcode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-4-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/aarch64/tcg-target.h | 1 + tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ia64/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/s390/tcg-target.h | 1 + tcg/sparc/tcg-target.h | 1 + tcg/tcg-opc.h | 1 + tcg/tci/tcg-target.h | 1 + 10 files changed, 10 insertions(+) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 1a5ea23..b82eac4 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -77,6 +77,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 75ea247..c114df7 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_idiv_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_div_i32 use_idiv_instructions #define TCG_TARGET_HAS_rem_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 enum { TCG_AREG0 =3D TCG_REG_R6, diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 4275787..59d9835 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,6 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/ia64/tcg-target.h b/tcg/ia64/tcg-target.h index 42aea03..901bb75 100644 --- a/tcg/ia64/tcg-target.h +++ b/tcg/ia64/tcg-target.h @@ -173,6 +173,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i64 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_deposit_i32_valid(ofs, len) ((len) <=3D 16) #define TCG_TARGET_deposit_i64_valid(ofs, len) ((len) <=3D 16) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index f46d64a..e3240cf 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -130,6 +130,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index abd8b3d..a9aa974 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -82,6 +82,7 @@ extern bool have_isa_3_00; #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index cbdd2a6..6b7bcfb 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -92,6 +92,7 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div2_i64 1 #define TCG_TARGET_HAS_rot_i64 1 diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index b8b74f96f..9348ddd 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_extrl_i64_i32 1 #define TCG_TARGET_HAS_extrh_i64_i32 1 diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index f06f894..956fb1e 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -193,6 +193,7 @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_W= ORDS, TCG_OPF_NOT_PRESENT) DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_END) DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_END) +DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr)) =20 DEF(qemu_ld_i32, 1, TLADDR_ARGS, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 838bf3a..0696328 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -85,6 +85,7 @@ #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294844443333.42126109520586; Thu, 27 Apr 2017 05:07:24 -0700 (PDT) Received: from localhost ([::1]:60262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iCe-0001B6-SB for importer@patchew.org; Thu, 27 Apr 2017 08:07:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i5w-0003wp-Pq for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5v-0001SY-Oh for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:24 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:36485) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5v-0001S5-I9 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:23 -0400 Received: by mail-wr0-x244.google.com with SMTP id v42so3520993wrc.3 for ; Thu, 27 Apr 2017 05:00:23 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qqWlenhi9EeITH22lpF4gb12BwSiD8zOnLr7vHkHRt0=; b=mFPLEiTEPPade2u1LuKY76H77ovXa8nC9MtkdNYdmxbD9uZsU0UNxGh5H1Jsiszs52 g5qrIJP0By7jtwUoZI2FCocV6dLcOCfR7tYUbLkeuGYO/GvKgblCGmCK9SEsbn5TGu6h 2KPumhKZlywkVFMKFo1kI06aIXxCdZ8TW3Uf1BrYDMMNKZHF/oOnr+woLtPR2gm1RV1A Dx/U5+eI5Da6tsCs6Wj4pzn7YtJyIkB4dKCDVXnEcZEbQNLT/7PRYW5tmVfbQsYtkeRr YxmhXIzC9iAxSpAWr/i938g62AGgOQ3nOhkW8UQ2BsiVuQ+vk1LAXcL0mIrOprbZi/tm XM9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qqWlenhi9EeITH22lpF4gb12BwSiD8zOnLr7vHkHRt0=; b=GOl876uFM2xfTDWvtxSJird3uA88coWR1X74CO9i8zHEb2gX/OalV65/vwKZLcMgQq RE+yV4bnG0eNa6yDsu3ZrQmQzf+O/vZ+RZNAdEPW72Y6Bs7QSaLpMhbw1nBIShpp3NPX WKkyaxu2xfLKvlo6Ny6jxOTO13mdZNUy2D6SJ786b3ITs4OXGJU4f5mLN+wg45PLo4c2 iUJ/HtiPxCCIFgFioXCi8+aA2ffGSIsdyfsvK9QcJknLpxKZ+ehgEF48EHApa8+hxMm1 tvtRJ7nigZkfPU+TrvUey5IU08CJzHj9d4FLB9T8eZxm9M+M4+NaZVtkKxJLqnMQnLgL oXGg== X-Gm-Message-State: AN3rC/4SmStdfyw2cRd1Ln/GDd9GqBsGrSKILUceFI2zwE5CUTcqVHs5 0Lt3g05sBIlhUtSJYXg= X-Received: by 10.223.164.81 with SMTP id e17mr3191890wra.133.1493294422117; Thu, 27 Apr 2017 05:00:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:54 +0200 Message-Id: <20170427120006.20564-8-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 07/19] tcg: export tcg_gen_lookup_and_goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: "Emilio G. Cota" Instead of exporting goto_ptr directly to TCG frontends, export tcg_gen_lookup_and_goto_ptr(), which calls goto_ptr with the pointer returned by the lookup_tb_ptr() helper. This is the only use case we have for goto_ptr and lookup_tb_ptr, so having this function is very convenient. Furthermore, it trivially allows us to avoid calling the lookup helper if goto_ptr is not implemented by the backend. Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-5-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson --- tcg/README | 8 ++++++++ tcg/tcg-op.c | 13 +++++++++++++ tcg/tcg-op.h | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/tcg/README b/tcg/README index a9858c2..bf49e82 100644 --- a/tcg/README +++ b/tcg/README @@ -477,6 +477,14 @@ current TB was linked to this TB. Otherwise execute th= e next instructions. Only indices 0 and 1 are valid and tcg_gen_goto_tb may be is= sued at most once with each slot index per TB. =20 +* lookup_and_goto_ptr tb_addr + +Look up a TB address ('tb_addr') and jump to it if valid. If not valid, +jump to the TCG epilogue to go back to the exec loop. + +This operation is optional. If the TCG backend does not implement the +goto_ptr opcode, emitting this op is equivalent to emitting exit_tb(0). + * qemu_ld_i32/i64 t0, t1, flags, memidx * qemu_st_i32/i64 t0, t1, flags, memidx =20 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 6b1f415..660dac9 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2587,6 +2587,19 @@ void tcg_gen_goto_tb(unsigned idx) tcg_gen_op1i(INDEX_op_goto_tb, idx); } =20 +void tcg_gen_lookup_and_goto_ptr(TCGv addr) +{ + if (TCG_TARGET_HAS_goto_ptr) { + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + + gen_helper_lookup_tb_ptr(ptr, tcg_ctx.tcg_env, addr); + tcg_gen_op1i(INDEX_op_goto_ptr, GET_TCGV_PTR(ptr)); + tcg_temp_free_ptr(ptr); + } else { + tcg_gen_exit_tb(0); + } +} + static inline TCGMemOp tcg_canonicalize_memop(TCGMemOp op, bool is64, bool= st) { /* Trigger the asserts within as early as possible. */ diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index c68e300..5d3278f 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -796,6 +796,17 @@ static inline void tcg_gen_exit_tb(uintptr_t val) */ void tcg_gen_goto_tb(unsigned idx); =20 +/** + * tcg_gen_lookup_and_goto_ptr() - look up a TB and jump to it if valid + * @addr: Guest address of the target TB + * + * If the TB is not valid, jump to the epilogue. + * + * This operation is optional. If the TCG backend does not implement goto_= ptr, + * this op is equivalent to calling tcg_gen_exit_tb() with 0 as the argume= nt. + */ +void tcg_gen_lookup_and_goto_ptr(TCGv addr); + #if TARGET_LONG_BITS =3D=3D 32 #define tcg_temp_new() tcg_temp_new_i32() #define tcg_global_reg_new tcg_global_reg_new_i32 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294844253796.7496080114241; Thu, 27 Apr 2017 05:07:24 -0700 (PDT) Received: from localhost ([::1]:60261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iCe-0001Av-U6 for importer@patchew.org; Thu, 27 Apr 2017 08:07:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i60-00040i-N8 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5w-0001Tq-RQ for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:28 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33414) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5w-0001So-LC for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:24 -0400 Received: by mail-wr0-x244.google.com with SMTP id w50so3540192wrc.0 for ; Thu, 27 Apr 2017 05:00:24 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1C+xRNFJ5k8/d5H+Q6H1rGJmoNfLpuUP7DVW6ufqoLM=; b=CcJdKwoMWLrCdOk9jsyIQ/Xu3fv+t5TgfUZ9ndVr/1CpaHIUg2dl4NcWFjPVB3ezMy XcEgLzSDocHvxaTiuThsNVxmUiUZ1RyOX5w9cKU1LGur+AKzM5EWXoemfjkDoOmKq4js nqmW2vEBMxfe3+uyHNn/BxxKY0NF9ke9tHgnu3jptFy9rJL6v0fF2HuFCB85SuHHoTG7 RtQDJArOYTL1auVzwglzx13xb7ID/ZQh/bGZgIWi7hrRircYWr+QlcJjLiC0My1SIEib uALtUsIs5tKyXl1LSH24dxdg8I7jIVUYouhhEQXs5p7vZEIjlvkeOUO4UrCygzI1cVoi 1Ffg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1C+xRNFJ5k8/d5H+Q6H1rGJmoNfLpuUP7DVW6ufqoLM=; b=n8cov3kHqhT9mF0YXsIMAVBAxYl/GOpmMW96hcKB99Ro7u8QXVwpl8G9WDduETYn6c SdPddHdTjBBQU3kqeXfgi6dpn+YSzsbgwdT/m06wloETbeUx1Ya9iac2KR88S4lUGpnG sxae9XTNnKlsT2FFtH4b8hBHFc0t+dHthDcSHZeKVVvJ6iCngUbw2J8k7qiDJVYdebft Qg4rwibU2aCWBoZ728FE1wRQR9QgMfdkwqR4BXACb+eYHJHBiQu9GTJkuj1q3n/EEmeK KDXzKKm6lDPyUhOEtE2AUoYVmh5fdaYTnBjgR/0BMnY/X4YfCmDJePp7VxaVfM++lhCd O8jQ== X-Gm-Message-State: AN3rC/4HYQX2K0Qveaj4nvjWJHqTCopVsXwVFYSB2FGGfvaRsUYV+wpn Aefk9qcdzSuCJg== X-Received: by 10.223.138.137 with SMTP id y9mr3473905wry.26.1493294423606; Thu, 27 Apr 2017 05:00:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:55 +0200 Message-Id: <20170427120006.20564-9-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 08/19] target/arm: optimize cross-page direct jumps in softmmu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Instead of unconditionally exiting to the exec loop, use the lookup_and_goto_ptr helper to jump to the target if it is valid. Perf impact: see next commit's log. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-7-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 0b5a0bc..facb52f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4153,8 +4153,12 @@ static inline void gen_goto_tb(DisasContext *s, int = n, target_ulong dest) gen_set_pc_im(s, dest); tcg_gen_exit_tb((uintptr_t)s->tb + n); } else { + TCGv addr =3D tcg_temp_new(); + gen_set_pc_im(s, dest); - tcg_gen_exit_tb(0); + tcg_gen_extu_i32_tl(addr, cpu_R[15]); + tcg_gen_lookup_and_goto_ptr(addr); + tcg_temp_free(addr); } } =20 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149329455867313.089105908837723; Thu, 27 Apr 2017 05:02:38 -0700 (PDT) Received: from localhost ([::1]:60205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i85-0005c3-8W for importer@patchew.org; Thu, 27 Apr 2017 08:02:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i60-00040l-NV for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5y-0001Ur-J9 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:28 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36481) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5y-0001UY-93 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:26 -0400 Received: by mail-wm0-x244.google.com with SMTP id u65so4061503wmu.3 for ; Thu, 27 Apr 2017 05:00:26 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MTIofX2HSUo350jJsb2QJZoE/hDlny/hk0KoBg8Jjpw=; b=OUIT/bP+hSsGGAtZPe6E2FDnnTI6B6XM4qlkY6qMj690QtDlmhZ9gzcAV3340SaPrd 9LCio2jI+vMrMVEIbuM5LSp9jfySlbyKPTPvw9oZ4BYvrjo41Ee13J0wQYu4GxpqvXUP S8B4AkufyoGalD4HHHtUlcW6GurhgCmoDe5n97LFH+oPYwrkpsPaees9SGhubNiqVsET 76VjeId+/ACrqfoEc2EUQ8KdhzHHRX6w1h5e6pNCeUwUS8ZT5Gc13drHyqwGULaCUsXo oEifmeO7EtA0kAzzALLTJiiNgcN/uBmZn5lUiPwFtYXbRUyhWlmmKBtbdswstPCyPNcZ aYCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MTIofX2HSUo350jJsb2QJZoE/hDlny/hk0KoBg8Jjpw=; b=DFkB+VQDYZuhPdq40lhtXr1fWyYYv481p8HO/xmu5B/3v+P5KcBBRE8dKaYVQaiaDO pn6L/QW1WJ3+a6hSLqmYQ5WfSt+2cn8bzsI4kAopmf2aeGYLsXyK8yA3bIQH4JpauSG0 HaQEyWoDLc30YBMyJ1jPRZR13l+WEP/AIYSzsQFXpKOqR0Cz7QNH4cmeyKau3pgRF9hi 4IL40az/MreQJajElrNEGb0PSg72AyendGyfTgIIzHRv5YrmphFosgqgwphONllRiKQq 2zwe8WxBR4hA7WJVT4cbPF3289+HgmyKPjmzbgwNStTtfLemX9TJeqx9KsOtbJF8HQD4 Un2w== X-Gm-Message-State: AN3rC/4ZCTrDcdubE77a2tzHPZSqgoieW9H8k+ByEo4Ww5vk8f1Twjfy X/mrUIkrAhhsfkcINsM= X-Received: by 10.28.183.70 with SMTP id h67mr1878412wmf.115.1493294424662; Thu, 27 Apr 2017 05:00:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:56 +0200 Message-Id: <20170427120006.20564-10-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH v5 09/19] target/arm: optimize indirect branches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Speed up indirect branches by jumping to the target if it is valid. Softmmu measurements (see later commit for user-mode results): Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - Impact on Boot time | setup | ARM debian jessie boot+shutdown time | stddev | |--------+--------------------------------------+--------| | v2.9.0 | 8.84 | 0.07 | | +cross | 8.85 | 0.03 | | +jr | 8.83 | 0.06 | - NBench, arm-softmmu (debian jessie guest). Hos= t: Intel i7-4790K @ 4.00GHz 1.3x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | = | | cross #= ### | 1.25x +cross+jr..........................................................#= ++#.........................................+-+ | #### #= # | | +++# # #= # | | +++ **** # #= # | 1.2x +-+...................................####............*..*..#......#= ..#.........................................+-+ | **** # * * # #= # #### | | * * # * * # #= # # # | 1.15x +-+................................*..*..#............*..*..#......#= ..#.....#..#................................+-+ | * * # * * # #= # # # | | * * # #### * * # #= # # # | | * * # # # * * # #= # # # #### | 1.1x +-+................................*..*..#......#..#..*..*..#......#= ..#.....#..#.........................#..#...+-+ | * * # # # * * # #= # # # # # | | * * # # # * * # #= # # # # # | 1.05x +-+..........................####..*..*..#......#..#..*..*..#......#= ..#.....#..#......+++............*****..#...+-+ | ***** # * * # # # * * # *****= # # # +++ | ****### * * # | | *+++* # * * # # # * * # *+++*= # **** # *****### * * # * * # | | *****### +++#### * * # * * # ***** # * * # * *= # * * # * | *++# * * # * * # | 1x +-++-+*+++*-+#++****++#++*+-+*++#+-*++*++#-+*+++*-+#++*++*++#++*+-+*= ++#+-*++*++#-+*+++*-+#++*++*++#++*+-+*++#+-++-+ | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/eOLmZNR NB. 'cross' represents the previous commit. Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-8-git-send-email-cota@braap.org> [rth: Replace gen_jr global variable with DISAS_EXIT state.] Signed-off-by: Richard Henderson --- target/arm/translate.c | 25 ++++++++++++++++--------- target/arm/translate.h | 4 ++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index facb52f..f879da6 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1178,7 +1178,7 @@ static void gen_exception_internal_insn(DisasContext = *s, int offset, int excp) gen_set_condexec(s); gen_set_pc_im(s, s->pc - offset); gen_exception_internal(excp); - s->is_jmp =3D DISAS_JUMP; + s->is_jmp =3D DISAS_EXC; } =20 static void gen_exception_insn(DisasContext *s, int offset, int excp, @@ -1187,14 +1187,14 @@ static void gen_exception_insn(DisasContext *s, int= offset, int excp, gen_set_condexec(s); gen_set_pc_im(s, s->pc - offset); gen_exception(excp, syn, target_el); - s->is_jmp =3D DISAS_JUMP; + s->is_jmp =3D DISAS_EXC; } =20 /* Force a TB lookup after an instruction that changes the CPU state. */ static inline void gen_lookup_tb(DisasContext *s) { tcg_gen_movi_i32(cpu_R[15], s->pc & ~1); - s->is_jmp =3D DISAS_JUMP; + s->is_jmp =3D DISAS_EXIT; } =20 static inline void gen_hlt(DisasContext *s, int imm) @@ -4146,19 +4146,23 @@ static inline bool use_goto_tb(DisasContext *s, tar= get_ulong dest) #endif } =20 -static inline void gen_goto_tb(DisasContext *s, int n, target_ulong dest) +static void gen_goto_ptr(void) +{ + TCGv addr =3D tcg_temp_new(); + tcg_gen_extu_i32_tl(addr, cpu_R[15]); + tcg_gen_lookup_and_goto_ptr(addr); + tcg_temp_free(addr); +} + +static void gen_goto_tb(DisasContext *s, int n, target_ulong dest) { if (use_goto_tb(s, dest)) { tcg_gen_goto_tb(n); gen_set_pc_im(s, dest); tcg_gen_exit_tb((uintptr_t)s->tb + n); } else { - TCGv addr =3D tcg_temp_new(); - gen_set_pc_im(s, dest); - tcg_gen_extu_i32_tl(addr, cpu_R[15]); - tcg_gen_lookup_and_goto_ptr(addr); - tcg_temp_free(addr); + gen_goto_ptr(); } } =20 @@ -12091,11 +12095,14 @@ void gen_intermediate_code(CPUARMState *env, Tran= slationBlock *tb) gen_set_pc_im(dc, dc->pc); /* fall through */ case DISAS_JUMP: + gen_goto_ptr(); + break; default: /* indicate that the hash table must be used to find the next = TB */ tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: + case DISAS_EXC: /* nothing more to generate */ break; case DISAS_WFI: diff --git a/target/arm/translate.h b/target/arm/translate.h index 629dab9..93de13f 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -139,6 +139,10 @@ static void disas_set_insn_syndrome(DisasContext *s, u= int32_t syn) * custom end-of-TB code) */ #define DISAS_BX_EXCRET 11 +/* For instructions which want an immediate exit to the main loop, + * as opposed to attempting to use lookup_and_goto_ptr. + */ +#define DISAS_EXIT 12 =20 #ifdef TARGET_AARCH64 void a64_translate_init(void); --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294689290145.27286924808232; Thu, 27 Apr 2017 05:04:49 -0700 (PDT) Received: from localhost ([::1]:60225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iAA-0007X5-Fi for importer@patchew.org; Thu, 27 Apr 2017 08:04:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i60-00040k-NF for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i5z-0001VC-65 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:28 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34223) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i5z-0001Un-0c for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:27 -0400 Received: by mail-wm0-x242.google.com with SMTP id z129so4092416wmb.1 for ; Thu, 27 Apr 2017 05:00:26 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kI3gdVgs1hYf33sJszhz18HtnhbQZWLfCJpJHDoKDMU=; b=BIxmYSxFzFt0vWz8bzEUUrHvo+4Ct6uQR24A/0/uxpARV7KdLvzTI3OmN9ki3w5p9x KzDRsqDk6GEfLCwQn6TWHXSuVc0sdM0QKOvSK15ZzJqR1ZYdKqLDYFPWY5RYZEk5J0mx N5crzbdaJo16U2xW80B/NA5vgZPZsuWCUbqjooRlpt88Tn4z3jttcyPWMdRIqFuhKJ+D GVjyCLKi99aDw/H31Lhq1Mofd47UhaDmlhiOGjPi7wc96SXvpzWYQqTRQPNnQiqhp5gi um38mrX8db82uQBjWhNYBZVMsStaps+ymsphLTPwcPEJghNSVPy2i35qzLWSLS0sYwcR DcAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=kI3gdVgs1hYf33sJszhz18HtnhbQZWLfCJpJHDoKDMU=; b=T//bvhtEXVaAwCO1ypI6cSL+oqYI0z46ueh4lvkIXmG8Bf9DAgTcbuUD4vDZttbSyW y5jYJ5kV0OIv+ycCd9eQsrzAgX/5xSqaki3PdgmH2EwLLEogSmhXo2M/ftC1fzMx/7XB Ycglt7igCJXD1zQJh/osay/Ip9CSuiNzugyfbuTCw34Hd7+SmQatQIvay/ynNPdohtIr u7QOY2P5n9j+imgc7qjf7vq6AG1ATmbE6NCwFcv/V8iVGzpPjtYlAG21YKtyUt+JNkTt KlZTxkrgTuAI0kR5GkIIr0gNPAmp00jxbCbrh8H6wCpZ/FQW/KdnYuYYvIXinb4J3DSm Ej8w== X-Gm-Message-State: AN3rC/4SP+avHmyh9CW6OZRitNJcfu1LsGwBnCWIDglDwT0YhfRSx2ui 6Dy7QSIrnvttgA== X-Received: by 10.28.55.9 with SMTP id e9mr1958409wma.44.1493294425796; Thu, 27 Apr 2017 05:00:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:57 +0200 Message-Id: <20170427120006.20564-11-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v5 10/19] target/i386: introduce gen_jr helper to generate lookup_and_goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" This helper will be used by subsequent changes. Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-9-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/i386/translate.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 1d1372f..f0e48dc 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -141,6 +141,7 @@ typedef struct DisasContext { } DisasContext; =20 static void gen_eob(DisasContext *s); +static void gen_jr(DisasContext *s, TCGv dest); static void gen_jmp(DisasContext *s, target_ulong eip); static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num); static void gen_op(DisasContext *s1, int op, TCGMemOp ot, int d); @@ -2509,7 +2510,8 @@ static void gen_bnd_jmp(DisasContext *s) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. If RECHECK_TF, emit a rechecking helper for #DB, ignoring the state of S->TF. This is used by the syscall/sysret insns. */ -static void gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +static void +do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); =20 @@ -2530,12 +2532,27 @@ static void gen_eob_worker(DisasContext *s, bool in= hibit, bool recheck_tf) tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); + } else if (!TCGV_IS_UNUSED(jr)) { + TCGv vaddr =3D tcg_temp_new(); + + tcg_gen_add_tl(vaddr, jr, cpu_seg_base[R_CS]); + tcg_gen_lookup_and_goto_ptr(vaddr); + tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } s->is_jmp =3D DISAS_TB_JUMP; } =20 +static inline void +gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +{ + TCGv unused; + + TCGV_UNUSED(unused); + do_gen_eob_worker(s, inhibit, recheck_tf, unused); +} + /* End of block. If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. */ static void gen_eob_inhibit_irq(DisasContext *s, bool inhibit) @@ -2549,6 +2566,12 @@ static void gen_eob(DisasContext *s) gen_eob_worker(s, false, false); } =20 +/* Jump to register */ +static void gen_jr(DisasContext *s, TCGv dest) +{ + do_gen_eob_worker(s, false, false, dest); +} + /* generate a jump to eip. No segment change must happen before as a direct call to the next block may occur */ static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num) --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294688758630.8479322835692; Thu, 27 Apr 2017 05:04:48 -0700 (PDT) Received: from localhost ([::1]:60224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iAA-0007Wm-AK for importer@patchew.org; Thu, 27 Apr 2017 08:04:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i61-000414-3I for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i60-0001WL-CM for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:29 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i60-0001VW-5t for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:28 -0400 Received: by mail-wr0-x244.google.com with SMTP id g12so3523217wrg.2 for ; Thu, 27 Apr 2017 05:00:27 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=A4MgwEOeX4xKUWBJTE5PamsNzrZJ4Ns/0VBFdKYA+hE=; b=KfrbowanULw7P5vkFIdQcJVKSIXGWXLdvdDFxuwddnR4KmgEvmP8ZHCJaYplDuxzje Eo+q8eMU1WbZdlTr8/rxnZUuYduQlHaNUNdeDzMvh99LuwMfMyil0SrXK3vZivHZdIEh bUOhp/1gMvEKRWVPtfpdw58vOe//vzc59icFkZWhIWdGAoChyeIkZ60lshl4eNy8v1ad C6y7LxuPjVxlmMxKYu7NIboRRdsZAKJAHsds2WM01eWEmzGSaGVtKXSWV39SRnYN8IXt BD6EVO6xSdbkt4+6rAprXEHCTuKUs/yHu5Hgaagkj1tLffMsD8UqNL5d30Dy2ugm4/A3 vIBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=A4MgwEOeX4xKUWBJTE5PamsNzrZJ4Ns/0VBFdKYA+hE=; b=B1GmzsEqAZtaIeaX0pJqg1EOcWuVL2F0HrLy2jGmDisjT7Rm+ezclzsdRyXJCxt8Ne wfT0BpZHazbV/156A2rLXPNa0LkaySUXiWejG/RBQpTnq+shMR8BToVq8JHIG+wsDD/3 5ewikI53hBw7KW50ilnWU/le0zx4ym2Hh5SCXoSCJ0IdtHXlBhaJb7T8pjz7hw5xk5t/ Dp7atDUxl+cCtA0n0TW5sbQSxvvlm+agJToBs4jNzHKYGuuZuc5HaxkxY9DBoebgpCWP +Fi5uDeUPQreCKtZIn5ZmyLR6rsgoTGp0C8nMAa8JhZ/23cjMnvCKiwBQLS0kEyZzpmM 4OXA== X-Gm-Message-State: AN3rC/4XDLkMDVy5375ZNwMr48fgKXyerI0khy9h6Axa81dFZoS+T8hr 1rjtKGv6DztEqfSsu5U= X-Received: by 10.223.133.97 with SMTP id 88mr3398440wrh.166.1493294426845; Thu, 27 Apr 2017 05:00:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:58 +0200 Message-Id: <20170427120006.20564-12-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 11/19] target/i386: optimize cross-page direct jumps in softmmu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Instead of unconditionally exiting to the exec loop, use the gen_jr helper to jump to the target if it is valid. Perf impact: see next commit's log. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-10-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson --- target/i386/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index f0e48dc..ea113fe 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -2154,9 +2154,9 @@ static inline void gen_goto_tb(DisasContext *s, int t= b_num, target_ulong eip) gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); } else { - /* jump to another page: currently not optimized */ + /* jump to another page */ gen_jmp_im(eip); - gen_eob(s); + gen_jr(s, cpu_tmp0); } } =20 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294994239593.2340686871216; Thu, 27 Apr 2017 05:09:54 -0700 (PDT) Received: from localhost ([::1]:60273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iF5-0003Wf-F0 for importer@patchew.org; Thu, 27 Apr 2017 08:09:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i62-00042n-PW for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i61-0001Wq-Dv for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:30 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i61-0001WP-4s for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:29 -0400 Received: by mail-wr0-x242.google.com with SMTP id g12so3523258wrg.2 for ; Thu, 27 Apr 2017 05:00:28 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wa4+nMFQgUX2Om3c6BDAfOsCQJmJArldGbUYQwyatxs=; b=GmQopQ6FA8UJJCfWZbC9gh5jaGqY33iuPK7ywPU3EG0JuhEf/OysT8t1cmdErrg9Tr kTuA8tFnjeBolbT4vltNbIIjRd9zXyClboYVwfjValxP95ml6L6b/v4T9VnJOU+FX1JB z/Guu5MXBt3B7nJTi7fAwXkeW7z6d2BzobfatBxxpIczjRFeu/0w1Oxxd/nJKfcNvn0E q79qWc+VGIV6iC+Whkj7ElHa+G8RhXC88ScW1Z43dBxApMcks9Mltt8gffy8SmIpQPbd BOGDjryvJcwihlYfDfmzCcEMBrc7eb6lXb1SIw/cWJ6gvB0ksdOhJw2dJB0NGjK9/AIY Krpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Wa4+nMFQgUX2Om3c6BDAfOsCQJmJArldGbUYQwyatxs=; b=W08/wxVb7wm64DmmMLKfAQg02X8q1JAqTqw8E8wAWx7JxclakjA+mxLiJfOt18+Qkj pl4vrHBx65A0tmtQq/+08LYrcyupwXcGpgbzb55RAY73YOYq6k8Cc8X/eXVurE5gKRcf lSsq3pEUDxzSpHfvX2ndKP8G7IMm6Nr7xKDOuOYUrzoh9ka8CL1KuM5LD5uOsLfCrNwa BSWIf064O5iG8S+uzBcEJCZhb9PRSLhNtt5LZBpKKfGXEiFno8B+hT42kInQpjjRA7TP U10brLQVJhiuw5QxKiv8EG5w2IwGsdD8ffN50Ee8rZXPp6nvKg3bZHiumnhfiw3KeARs yQiA== X-Gm-Message-State: AN3rC/7S6o3LQoRuc9s5Ef7ya2FspMUr04cmQBJErVp2RwHhHEMoQY9R Ieuo+9is5sJutA== X-Received: by 10.223.170.197 with SMTP id i5mr3138214wrc.143.1493294428038; Thu, 27 Apr 2017 05:00:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 13:59:59 +0200 Message-Id: <20170427120006.20564-13-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH v5 12/19] target/i386: optimize indirect branches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Speed up indirect branches by jumping to the target if it is valid. Softmmu measurements (see later commit for user-mode numbers): Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-softmmu (Ubuntu 16.04 guest= ). Host: Intel i7-4790K @ 4.00GHz 2.4x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | cross = | 2.2x +cross+jr............................................................= ..............+++...........................+-+ | = | | | = +++ | | 2x +-+..................................................................= ............|..|............................+-+ | = | | | | = | | | 1.8x +-+..................................................................= ............|####...........................+-+ | = |# |# | | = **** |# | 1.6x +-+..................................................................= ..........*.|*.|#...........................+-+ | = * |* |# | | = * |* |# | 1.4x +-+..................................................................= .....+++..*.|*.|#...........................+-+ | ++++++ = #### * |*++# +++ | | +++ | | = #++# *++* # +++ | | 1.2x +-+......................###.....####....+++............|..|.........= ..****..#.*..*..#....####...|.###.....####..+-+ | +++ **** # **** # #### ***### = *++* # * * # #++# ****|# +++#++# | | ****### +++ *++* # *++* # ++# # #### *|* |# +++= * * # * * # *** # *| *|# **** # | 1x +-++-*++*++#++***###++*++*+#++*+-*++#+****++#++***++#+-*+*++#-+****##= ++*++*-+#+*++*-+#++*+*++#++*-+*+#++*++*++#-++-+ | * * # * * # * * # * * # * * # * * # *|* |# *++* #= * * # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # *+*++# * * #= * * # * * # * * # * * # * * # | 0.8x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/DU36YFU NB. 'cross' represents the previous commit. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-11-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/i386/translate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index ea113fe..674ec96 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4996,7 +4996,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_push_v(s, cpu_T1); gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 3: /* lcall Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5014,7 +5014,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, tcg_const_i32(dflag - 1), tcg_const_i32(s->pc - s->cs_base)); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 4: /* jmp Ev */ if (dflag =3D=3D MO_16) { @@ -5022,7 +5023,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, } gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 5: /* ljmp Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5037,7 +5038,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_op_movl_seg_T0_vm(R_CS); gen_op_jmp_v(cpu_T1); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 6: /* push Ev */ gen_push_v(s, cpu_T0); @@ -6417,7 +6419,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xc3: /* ret */ ot =3D gen_pop_T0(s); @@ -6425,7 +6427,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xca: /* lret im */ val =3D cpu_ldsw_code(env, s->pc); --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149329524024278.22897404456592; Thu, 27 Apr 2017 05:14:00 -0700 (PDT) Received: from localhost ([::1]:60359 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iJ4-0007BR-Qd for importer@patchew.org; Thu, 27 Apr 2017 08:13:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i69-00049l-Bj for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i63-0001Xh-7T for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:37 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i62-0001Wz-TK for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:31 -0400 Received: by mail-wm0-x242.google.com with SMTP id z129so4092768wmb.1 for ; Thu, 27 Apr 2017 05:00:30 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=nY7gKY38hus5cAbAP+itEEwuguvQg+GIIDLAJ1WLuzs=; b=FBPNoJoH44hVfeiSyfTGk+EZvTqIInHMy8M1R4OKQMVlc+6V8JnlnymYJ2C3y52xsV Nk/jZ80a1wz7sD2hsf+TP0mBVU5JwRg7ULfjjhUx8qGv0gvdeHTUdUT/ZdWGDFoDQACB NOST/KwZrvzMZOZDG+0hKNLlYh87vuQVVuZKqGcfFw5aUXu3nEKopD9gc+DusryIzUdi DZbCmd/OiYe0JMiAJJ3wT9F1MIdwNZmPC5JscuS+h33OvsCV87AVDYN92Fg66r1b+rcn lURIGrvKUPW0MSsQlkYK2DdFxa2XXvzFJs+7BjCvtVl2G+Z7D8KUcYW+mPgem8SnSPIw XqXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=nY7gKY38hus5cAbAP+itEEwuguvQg+GIIDLAJ1WLuzs=; b=rRhafi07HspJXwX47CspTgCGKmkFNSAYx9XP9gqrwKfHx4rJ+5mWWrpjJcaMRE43QS 1Gn3voJTIkNETimN6sjJOrQokiA2qOGdZl7hYjBfy9PlwD+Hf55o2bfoaRU9kcO4Enwc j3SsWepS/YUjFr4mnnkD9hHaKh5ytjdlb6ZN/9VZwhcwyRa2Kn8qO5RLOb5GowxHlg4T Nub1rN5mkQZMtg5/BRa8qxaWOvQ2WfH7QNgkzn0rBdFk9TGeVNINsvax6KVjf5ipMoCG ydgtLBD7taJMBjfqnowIzb9dd61Zgg6lA1fin7uw5agmDexoqDZdKAYCSO7mQa47CVkC KGtQ== X-Gm-Message-State: AN3rC/7bgLjBegq2v6YuYA+eSaZL33n/NYlL+UiTHClY0J65UTSy1GOc xKl4iz5Yn5YUE9PFZcY= X-Received: by 10.28.17.21 with SMTP id 21mr2114151wmr.83.1493294429061; Thu, 27 Apr 2017 05:00:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:00 +0200 Message-Id: <20170427120006.20564-14-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v5 13/19] tb-hash: improve tb_jmp_cache hash function in user mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Optimizations to cross-page chaining and indirect branches make performance more sensitive to the hit rate of tb_jmp_cache. The constraint of reserving some bits for the page number lowers the achievable quality of the hashing function. However, user-mode does not have this requirement. Thus, with this change we use for user-mode a hashing function that is both faster and of better quality than the previous one. Measurements: Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-linux-user. Host: = Intel i7-6700K @ 4.00GHz 2.2x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | jr = | 2x +jr+multhash +................................................= ....+++++...................................+-+ | jr+hash = |$$$ | | = |$+$ | | = ### $ | 1.8x +-+..................................................................= ....#|#.$...................................+-+ | = ++#+# $ | | = |# # $ | 1.6x +-+..................................................................= ..***.#.$....................++$$$..........+-+ | $$$ = *+* # $ |$+$ | | ++$$$ ### $ = * * # $ +++|$ $ | | ++###+$ # # $ = * * # $ ### ****## $ | 1.4x +-+...................***+#.$.........***.#.$........................= ..*.*.#.$...........#+#$$.*++*|#.$..........+-+ | *+* # $ * * # $ = * * # $ # # $ * *+# $ | | * * # $ +++++ * * # $ = * * # $ *** # $ * * # $ ###$$ | 1.2x +-+...................*.*.#.$.***##$$.*.*.#.$........................= ..*.*.#.$.........*.*.#.$.*..*.#.$.***+#+$..+-+ | * * # $ *+* # $ * * # $ +++ = * * # $ ++###$$ * * # $ * * # $ * * # $ | | ***##$$ * * # $ * * # $ * * # $ ***##$$ ++### = * * # $ *** #+$ * * # $ * * # $ * * # $ | | *+*+#+$ ***##$$$ * * # $ * * # $ * * # $ *+* # $ ++####$$ ***+# = * * # $ * * # $ * * # $ * * # $ * * # $ | 1x +-++-*+*+#+$+*+*+#-+$+*+*-#+$+*+*+#+$+*+*+#+$+*-*+#+$+***++#+$+*+*+#$= $+*+*+#+$+*+*+#+$+*+*-#+$+*+-*+#+$+*+*+#+$-++-+ | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # = $ * * # $ * * # $ * * # $ * * # $ * * # $ | | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * # = $ * * # $ * * # $ * * # $ * * # $ * * # $ | 0.8x +-+--***##$$-***##$$$-***##$$-***##$$-***##$$-***##$$-***###$$-***##$= $-***##$$-***##$$-***##$$-****##$$-***##$$--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/4UXTrEc Here I also tried the hash function suggested by Paolo ("multhash"): return ((uint64_t) (pc * 2654435761) >> 32) & (TB_JMP_CACHE_SIZE - 1); As you can see it is just as good as the other new function ("hash"), which is what I ended up going with. - SPECint06 (train set), x86_64-linux-user. Host: = Intel i7-6700K @ 4.00GHz 2.6x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | jr = ### | 2.4x +jr+hash.............................................................= ..............................#.#...........+-+ | = # # | | = # # | 2.2x +-+..................................................................= ..............................#.#...........+-+ | = # # | | = # # | 2x +-+..................................................................= ..............................#.#...........+-+ | = **** # | | = * * # | 1.8x +-+..................................................................= ...........................*..*.#...........+-+ | = +++ * * # | | = #### #### * * # | 1.6x +-+......................................####........................= .....#..#.****..#..........*..*.#...........+-+ | +++ #++# = **** # * * # #### * * # | | ### # # = * * # * * # # # * * # | 1.4x +-+...................****+#..........****..#........................= ..*..*..#.*..*..#....#..#..*..*.#...........+-+ | *++* # * * # = * * # * * # *** # * * # #### | | * * # #### * * # = * * # * * # * * # * * # **** # | 1.2x +-+...................*..*.#..****++#.*..*..#........................= ..*..*..#.*..*..#..*.*..#..*..*.#..*..*..#..+-+ | ****### * * # * * # * * # = * * # * * # * * # * * # * * # | | * * # ***### * * # * * # * * # ****##= * * # * * # * * # * * # * * # | 1x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/ArCbHqo - NBench, x86_64-linux-user. Host: Intel= i7-6700K @ 4.00GHz 1.12x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | = | | jr += ++ | 1.1x +jr+hash...........................................................#= ###.........................................+-+ | +++#= | # | | | #= ++# | 1.08x +-+................................+++................+++.+++..*****= ..#.........................................+-+ | | +++ | | * | *= # | | | | | | *+++*= # | 1.06x +-+................................****###.............|...|...*...*= ..#.........................+++.............+-+ | *| * |# ****### * *= # | | | *| *++# *| * |# * *= # #### | 1.04x +-+................................*++*..#............*|.*.|#..*...*= ..#........................#.|#.............+-+ | * * # *++*++# * *= # +++#++# | | * * # * * # * *= # | # # +++#### | 1.02x +-+................................*..*..#......+++...*..*..#..*...*= ..#.....................****..#..*****++#...+-+ | +++ * * # +++ | * * # * *= # +++ *| * # *+++* # | | +++ | +++ +++ ++++++ * * # *****### * * # * *= # | +++ ++++++ *++* # * * # | 1x +-++-+++++####++****###++++-+####+-*++*++#-+*+++*-+#++*++*++#++*+-+*= ++#+-+++####-+*****###++*++*++#++*+-+*++#+-++-+ | *****| # *++* |# *****| # * * # * *++# * * # * *= # **** |# * * # * * # * * # | | * | *| # * *++# * | *++# * * # * * # * * # * *= # *| *++# * * # * * # * * # | 0.98x +-+...*.|.*++#..*..*..#..*+++*..#..*..*..#..*...*..#..*..*..#..*...*= ..#..*++*..#..*...*..#..*..*..#..*...*..#...+-+ | *+++* # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.96x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/ZXFX0hJ - NBench, arm-linux-user. Host: Intel i7-= 4790K @ 4.00GHz 1.3x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | #### = | | jr # # = +++ | 1.25x +jr+hash.....................#..#...................................= ........####................................+-+ | # # = # # | | # # = # # | 1.2x +-+..........................#..#...................................= ........#..#................................+-+ | # # = # # | | # # = # # | 1.15x +-+..........................#..#...................................= ........#..#................................+-+ | # # #= ### # # | | # # #= # # # | 1.1x +-+..........................#..#..................................#= ..#.....#..#................................+-+ | # # #= # # # +++ | | # # #### #= # # # #### | 1.05x +-+..........................#..#...............#..#.....####......#= ..#.....#..#.........................#..#...+-+ | # # # # # # #= # # # +++ # # | | +++ ***** # #### ***** # # # +++#= # **** # ****### # # | 1x +-++-+*****###++****+++++*+-+*++#+-****++#-+*+++*-+#+++++#++#++*****= ++#+-*++*++#-+*****-++++*++*++#++*****++#+-++-+ | * * # * * | * * # * * # * * # **** # * *= # * * # * *### * *++# * * # | | * * # * *### * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+...*...*..#..*..*.|#..*...*..#..*..*..#..*...*..#..*..*..#..*...*= ..#..*..*..#..*...*..#..*..*..#..*...*..#...+-+ | * * # * * |# * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * |# * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.9x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/FfD27ey Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-12-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- include/exec/tb-hash.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 2c27490..b1fe2d0 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -22,6 +22,8 @@ =20 #include "exec/tb-hash-xx.h" =20 +#ifdef CONFIG_SOFTMMU + /* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for addresses on the same page. The top bits are the same. This allows TLB invalidation to quickly clear a subset of the hash table. */ @@ -45,6 +47,16 @@ static inline unsigned int tb_jmp_cache_hash_func(target= _ulong pc) | (tmp & TB_JMP_ADDR_MASK)); } =20 +#else + +/* In user-mode we can get better hashing because we do not have a TLB */ +static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) +{ + return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1); +} + +#endif /* CONFIG_SOFTMMU */ + static inline uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t fl= ags) { --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493295359522279.51173682253545; Thu, 27 Apr 2017 05:15:59 -0700 (PDT) Received: from localhost ([::1]:60375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iKz-0000D7-Nb for importer@patchew.org; Thu, 27 Apr 2017 08:15:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i69-00049m-By for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i63-0001Xv-DR for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:37 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33251) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i63-0001XE-4b for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:31 -0400 Received: by mail-wm0-x242.google.com with SMTP id y10so4098954wmh.0 for ; Thu, 27 Apr 2017 05:00:30 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=2kW66JtAdGMGoKO4X8R/B6BxYBYIjV6+Ab53z4C+qKQ=; b=soW24XLpFzz25Il6ujOz9NRDX2eOqi5xmzjydRej8yeBYh9FStAMcqU8rzw9DshmG0 Ui4767hh8B5n6zep7FZlmuw0/6OynZ1T2n8CD6v9bHDuq/VSyyRECvxoCC4qQq90MUJi MhtH35O7i2HgI6yW0HZTPhQyKG5ImOk084FxMEFPhdDXButzqN9yXqA6PwVnOJeJO5Ij Z/v/OSiYSThqQm4W0MSTJ564oFFSVdRVO+Bl7pOM0YI9furUenVE5gcrmAFlyPGu9r7U lw2NSUZF/njMuriwrieCbFi5PdB+rs+/Yyi1G82AK09/wb3Gv2Z+X3yeEakB023+S5OR Neug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2kW66JtAdGMGoKO4X8R/B6BxYBYIjV6+Ab53z4C+qKQ=; b=VzVPRbXGTnXS+BNTY1Bj4HA7ElNR27R4Nifaw0Gc7Ming4sG/vTTpVNY1AxqaxAwy9 MXQGFBbv0HKHBkpxyAngM8dD//Nsa1aJvO4V0kHX6bS3P3LfWVDUobIf9EhB/Wu9CMIy /rkKGREgbxynpq2UCVqhGnZDLdvxbDSDeZsJFurSHKrPBmDw5qbLrkGDR8pKNt51yuYr enZ4886hBerEwl+FrfP9gPvf0vRYVvojiD8FnBGfdpfm6/0eMDGYxMfYJP3uhEu03sWj QGFZU6ak6XsVFiNq0kCeUxQz0r9updQkrokjhmx1FZtkyv9byLEm74nHOIxngiMttVcG YmIQ== X-Gm-Message-State: AN3rC/5QGT+2kt9hs6Yw93qrWIbtXzd57e9sjyrmm69xhKtjr+/AxHKy tASUl/351iUv3A== X-Received: by 10.28.175.209 with SMTP id y200mr2110567wme.81.1493294430000; Thu, 27 Apr 2017 05:00:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:01 +0200 Message-Id: <20170427120006.20564-15-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v5 14/19] target/alpha: Use tcg_gen_goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/alpha/translate.c | 49 +++++++++++++++++++++++++++++++++++---------= ---- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index df5d695..c1a5fbf 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -89,6 +89,10 @@ typedef enum { updated the PC for the next instruction to be executed. */ EXIT_PC_STALE, =20 + /* Similarly, but force TB exit without chaining. */ + EXIT_PC_UPDATED_FORCE, + EXIT_PC_STALE_FORCE, + /* We are ending the TB with a noreturn function call, e.g. longjmp. No following code will be executed. */ EXIT_NORETURN, @@ -455,11 +459,16 @@ static bool in_superpage(DisasContext *ctx, int64_t a= ddr) #endif } =20 +static bool use_exit_tb(DisasContext *ctx) +{ + /* Suppress any optimization in the case of single-steping and IO. */ + return ((ctx->tb->cflags & CF_LAST_IO) + || ctx->singlestep_enabled || singlestep); +} + static bool use_goto_tb(DisasContext *ctx, uint64_t dest) { - /* Suppress goto_tb in the case of single-steping and IO. */ - if ((ctx->tb->cflags & CF_LAST_IO) - || ctx->singlestep_enabled || singlestep) { + if (use_exit_tb(ctx)) { return false; } #ifndef CONFIG_USER_ONLY @@ -1257,14 +1266,14 @@ static ExitStatus gen_call_pal(DisasContext *ctx, i= nt palcode) need the page permissions check. We'll see the existence of the page when we create the TB, and we'll flush all TBs if we change the PAL base register. */ - if (!ctx->singlestep_enabled && !(ctx->tb->cflags & CF_LAST_IO)) { + if (use_exit_tb(ctx)) { + tcg_gen_movi_i64(cpu_pc, entry); + return EXIT_PC_UPDATED; + } else { tcg_gen_goto_tb(0); tcg_gen_movi_i64(cpu_pc, entry); tcg_gen_exit_tb((uintptr_t)ctx->tb); return EXIT_GOTO_TB; - } else { - tcg_gen_movi_i64(cpu_pc, entry); - return EXIT_PC_UPDATED; } } #endif @@ -1323,7 +1332,7 @@ static ExitStatus gen_mfpr(DisasContext *ctx, TCGv va= , int regno) gen_io_start(); helper(va); gen_io_end(); - return EXIT_PC_STALE; + return EXIT_PC_STALE_FORCE; } else { helper(va); } @@ -1374,7 +1383,7 @@ static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb= , int regno) case 252: /* HALT */ gen_helper_halt(vb); - return EXIT_PC_STALE; + return EXIT_PC_STALE_FORCE; =20 case 251: /* ALARM */ @@ -1388,7 +1397,7 @@ static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb= , int regno) that ended with a CALL_PAL. Since the base register usually on= ly changes during boot, flushing everything works well. */ gen_helper_tb_flush(cpu_env); - return EXIT_PC_STALE; + return EXIT_PC_STALE_FORCE; =20 case 32 ... 39: /* Accessing the "non-shadow" general registers. */ @@ -2373,7 +2382,7 @@ static ExitStatus translate_one(DisasContext *ctx, ui= nt32_t insn) gen_io_start(); gen_helper_load_pcc(va, cpu_env); gen_io_end(); - ret =3D EXIT_PC_STALE; + ret =3D EXIT_PC_STALE_FORCE; } else { gen_helper_load_pcc(va, cpu_env); } @@ -2990,18 +2999,32 @@ void gen_intermediate_code(CPUAlphaState *env, stru= ct TranslationBlock *tb) case EXIT_GOTO_TB: case EXIT_NORETURN: break; + case EXIT_PC_STALE: tcg_gen_movi_i64(cpu_pc, ctx.pc); - /* FALLTHRU */ + goto do_exit_pc_updated; + case EXIT_PC_STALE_FORCE: + tcg_gen_movi_i64(cpu_pc, ctx.pc); + goto do_exit_pc_updated_force; + case EXIT_PC_UPDATED: + do_exit_pc_updated: + if (!use_exit_tb(&ctx)) { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + break; + } + /* FALLTHRU */ + case EXIT_PC_UPDATED_FORCE: + do_exit_pc_updated_force: if (ctx.singlestep_enabled) { gen_excp_1(EXCP_DEBUG, 0); } else { tcg_gen_exit_tb(0); } break; + default: - abort(); + g_assert_not_reached(); } =20 gen_tb_end(tb, num_insns); --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493295243030168.5727221819801; Thu, 27 Apr 2017 05:14:03 -0700 (PDT) Received: from localhost ([::1]:60360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iJ7-0007Dd-J7 for importer@patchew.org; Thu, 27 Apr 2017 08:14:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i68-00048h-Dl for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i64-0001YC-Fb for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:36 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34239) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i64-0001Xz-8k for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:32 -0400 Received: by mail-wm0-x242.google.com with SMTP id z129so4092886wmb.1 for ; Thu, 27 Apr 2017 05:00:32 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/7RPKOrF4upE4pTU8vz1GzObama5Ca73v1djSLCpa2s=; b=q8yK/i+sNbaEuDdVfhCXKQtnctj1nbc3BFfMFly+diAOck6i/9N7HSgHUTP3gHQaiv Zs6q+ygeueBpq4deup0oEgOJ1gR+/wbDjDxCOhLhH27IlWtXEmpcNq6GC0F/QmABdlWq /vCpfWeNOYLAwhzz4CcHD4X5acWG+OkY3wcMiSJea7Ww6osFroZ6tEKRyLmJCmRRzV/P UPfsLJ/pYKmnbHAGB7eIFQzTebrpF+OIQp0p1LJtEhUNyMuqUeAlQ6MuNK0vvqoA3dpy 2XM8nv4Bk5bHRdhdG3vv5miOYSGmbVtkiaHHbroXHMgqg8FCKKbl0bdMrKZD4Qc3RLQb bw8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/7RPKOrF4upE4pTU8vz1GzObama5Ca73v1djSLCpa2s=; b=gO7/7o5shhRLu4k8+mmqoETge8lFsvme8sxQdxt+y3gpgq8bv6wVNwsPQQ6YoEypQh xfiAMTwS8ShNrgJAIV5rLl77/2ubCCarcbXFjWGpbKdb2EuN5u/CbqigpKHRYBM7DH1f hpofMjRjW8KLM5QpSE4RI8bCZ8ToNAgwlRO2NzcAxp3keKttxrW4h6uLmI+J6P/Jm+BT lwVmpW/51hGnu8H/Dgg6Lltp8gH74fOMe3QfiJcaYl3SjqEwPjtrWm9WGPKSmFbufR9N OwO5nwIr4FU8VGy5gZwctuM8gOFAchlTYH1BarlG6eSlF6IsGGTeQYJhdZVSrCSOoQBH PrxQ== X-Gm-Message-State: AN3rC/7dB30FwmNOCaGsNDLmn3a0+ekRxDunRISh6ih1sXI1SH1tRoh8 Gauf1tDmDyhB0A== X-Received: by 10.28.72.84 with SMTP id v81mr2024610wma.43.1493294431162; Thu, 27 Apr 2017 05:00:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:02 +0200 Message-Id: <20170427120006.20564-16-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v5 15/19] tcg/i386: implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Message-Id: <1493263764-18657-6-git-send-email-cota@braap.org> [rth: Reuse goto_ptr epilogue for exit_tb 0.] Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 59d9835..73a15f7 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,7 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5918008..01e3b4e 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1882,8 +1882,13 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, =20 switch (opc) { case INDEX_op_exit_tb: - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_EAX, a0); - tcg_out_jmp(s, tb_ret_addr); + /* Reuse the zeroing that exists for goto_ptr. */ + if (a0 =3D=3D 0) { + tcg_out_jmp(s, s->code_gen_epilogue); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_EAX, a0); + tcg_out_jmp(s, tb_ret_addr); + } break; case INDEX_op_goto_tb: if (s->tb_jmp_insn_offset) { @@ -1906,6 +1911,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, } s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + /* jmp to the given host address (could be epilogue) */ + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, a0); + break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, arg_label(a0), 0); break; @@ -2277,6 +2286,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) { + static const TCGTargetOpDef r =3D { .args_ct_str =3D { "r" } }; static const TCGTargetOpDef ri_r =3D { .args_ct_str =3D { "ri", "r" } = }; static const TCGTargetOpDef re_r =3D { .args_ct_str =3D { "re", "r" } = }; static const TCGTargetOpDef qi_r =3D { .args_ct_str =3D { "qi", "r" } = }; @@ -2299,6 +2309,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpc= ode op) =3D { .args_ct_str =3D { "L", "L", "L", "L" } }; =20 switch (op) { + case INDEX_op_goto_ptr: + return &r; + case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i32: @@ -2567,6 +2580,13 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); #endif =20 + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_EAX, 0); + /* TB epilogue */ tb_ret_addr =3D s->code_ptr; =20 --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493295142662232.69776732415107; Thu, 27 Apr 2017 05:12:22 -0700 (PDT) Received: from localhost ([::1]:60329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iHV-0005ZM-Bc for importer@patchew.org; Thu, 27 Apr 2017 08:12:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i66-00046i-DV for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i65-0001YX-NK for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:34 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:35512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i65-0001YL-Gw for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:33 -0400 Received: by mail-wr0-x241.google.com with SMTP id g12so3523516wrg.2 for ; Thu, 27 Apr 2017 05:00:33 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=J1rjkpjIDXi2yU645dTm3yUHIGMCITTDyhEvIXPjjMI=; b=vh9HtGwRaLbeTOCzAsZtYbWu/b2+8zu0sfok8zOusQLkyaLirrNiEtLfXj88agQbLj L4JSrlyDrnVwuwlJlzcJU3IbUElHzH5/+OpqNrTTKSoBdKw7Sooz7eS1toZfJ6p/uEzi bueHfToQcS2ahWUD96nNBogsnqu6Q0OCmCyi4MW4I/I/GNZIJXtfVRf/nrCeufqCNYd5 t3wqtWNMf7fqADMILqniteNgWP3N4bZc1wyq9RNCBKLJkGAfhv2rImghTar4oR55ziqR WgWhCJLGFG4ycL8cPTXhQ3LWVsaqHPP5t3QhK7oOrkS78zKw+t8svqRyx9rL7bqC4Fsc UE9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=J1rjkpjIDXi2yU645dTm3yUHIGMCITTDyhEvIXPjjMI=; b=kjj1lKP8AYZpvAw4CJkRYxwdQQHe0TD+kRXapqAPJuJxsDqg2HW6UFakhK0+HpXG4I U+DTaj30whLpRT7DZxU43H9meyaNtf1WGsbwzE0SNXMo1gS4qhyIL37UsafaQYtKCuev pZ+FqNT/3cquaMbjELN46UCOW21NM5IWhXNhMTZ4/il4uDa4YOuRaVcG5wJA+sZCnmzV zmrumDN9hBDNqURZhstABv034/qmekoVECFKjD7LUAA+nTIX92Z8KxDvge8T38NVab2C 5av7ZgVeX5j16JDxKEoxg1UtjnJ5RPYR46j+r59Yv7O4cOopBWElxzPVYTCrsBSukDww nzFQ== X-Gm-Message-State: AN3rC/5EMAU5Lgl9TBNR7qtpsFxCNLyZVjSIIhv2FzqJZ4ltpIRC4eld L2foSBeTZYAIKjmeFUY= X-Received: by 10.223.171.68 with SMTP id r4mr3418580wrc.67.1493294432119; Thu, 27 Apr 2017 05:00:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:03 +0200 Message-Id: <20170427120006.20564-17-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v5 16/19] tcg/ppc: Implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.h | 2 +- tcg/ppc/tcg-target.inc.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index a9aa974..5f4a40a 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -82,7 +82,7 @@ extern bool have_isa_3_00; #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 64f67d2..8d50f18 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -1932,6 +1932,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) =20 /* Epilogue */ tcg_debug_assert(tb_ret_addr =3D=3D s->code_ptr); + s->code_gen_epilogue =3D tb_ret_addr; =20 tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_REG_R1, FRAME_SIZE+LR_OFFS= ET); for (i =3D 0; i < ARRAY_SIZE(tcg_target_callee_save_regs); ++i) { @@ -1986,6 +1987,11 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,= const TCGArg *args, #endif s->tb_jmp_reset_offset[args[0]] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + tcg_out32(s, MTSPR | RS(args[0]) | CTR); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R3, 0); + tcg_out32(s, BCCTR | BO_ALWAYS); + break; case INDEX_op_br: { TCGLabel *l =3D arg_label(args[0]); @@ -2555,6 +2561,7 @@ static const TCGTargetOpDef ppc_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294712817982.2268084882609; Thu, 27 Apr 2017 05:05:12 -0700 (PDT) Received: from localhost ([::1]:60226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iAZ-0007sO-6G for importer@patchew.org; Thu, 27 Apr 2017 08:05:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i6A-0004AX-AE for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i66-0001Yi-DX for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i66-0001YR-6i for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:34 -0400 Received: by mail-wm0-x244.google.com with SMTP id u65so4062254wmu.3 for ; Thu, 27 Apr 2017 05:00:33 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RN4ymCa+eOfW7iDQEHf/PDN9Gh43GItcFNOIj/tbGVg=; b=Wyigdv2LDB3mzZhBRWzXad00W1uNMMQYCnqRR1Rra4SCHoQbKYVuZFbA/WqVRuIaSk SqYcY7mU6vVcxWHyAy7QwytIf+d9rB3F/1HjNDY5Daig+4g2087n6LFTGC3IVFSB3xYc knpkaE2ATcrvkCHdNdAA7eIF38oNv21vSw78W9SsH/RPxgzfzBSWbgHpahrjtAm446bs eeZF0DV/xmKhWeO1X7Qp67xSwQ03S72dSlVnbrJHnJk1Jm+7JIa3zd5wxMKcObDtPaSn 5W2yxQHuctLoehZmhsAeY1vo3NTNat1fsH1qOXAHGM4iivEsf/qZxWFPyq6PGurT+rXk COYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=RN4ymCa+eOfW7iDQEHf/PDN9Gh43GItcFNOIj/tbGVg=; b=jsidUBfOpU/a97Z0Tdzhnql/w6bx6qtjKsODzBwqISf1Z5VYSmORX2hbLG8AvSK/GE jN+Z4hD/eofGXWVlG/QONyu497TzkhYqZ+VChKJ6lmVYR41bsYrggBiC9PLrP3L1UJvG 5tZilJWv0shqSDxIxNkM9nYmpEPg8BeZIbDE03MEVa276DpkOJL/rPJhkbaGKhut1bwj eW0UGfUttuy8sYWsKLv7QMvAA/GftnFSCg5CtkHP/JP4KkTP8ZstX97VdB4fuPk6QEof utxUXC9QwN5QY/L6G4pC/JFbHzwx/r/9N0VGKX0lT+Rjc+5oZV+PyL8qeJhsV6HTPGAj g7Fg== X-Gm-Message-State: AN3rC/7N7kJXIWTLYrYE0Ids3o18Wlj8gWxO/uQOnEpFuDNdfPVMW7go c5Aw1sOYqkTf8g== X-Received: by 10.28.102.65 with SMTP id a62mr226274wmc.29.1493294433099; Thu, 27 Apr 2017 05:00:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:04 +0200 Message-Id: <20170427120006.20564-18-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH v5 17/19] tcg/aarch64: Implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Tested-by: Emilio G. Cota --- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.inc.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index b82eac4..55a46ac 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -77,7 +77,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 290de6d..5f18545 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1357,8 +1357,13 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 switch (opc) { case INDEX_op_exit_tb: - tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); - tcg_out_goto(s, tb_ret_addr); + /* Reuse the zeroing that exists for goto_ptr. */ + if (a0 =3D=3D 0) { + tcg_out_goto(s, s->code_gen_epilogue); + } else { + tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); + tcg_out_goto(s, tb_ret_addr); + } break; =20 case INDEX_op_goto_tb: @@ -1374,6 +1379,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; =20 + case INDEX_op_goto_ptr: + tcg_out_insn(s, 3207, BR, a0); + break; + case INDEX_op_br: tcg_out_goto_label(s, arg_label(a0)); break; @@ -1735,6 +1744,7 @@ static const TCGTargetOpDef aarch64_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, @@ -1942,6 +1952,14 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out_insn(s, 3207, BR, tcg_target_call_iarg_regs[1]); =20 + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_X0, 0); + + /* TB epilogue */ tb_ret_addr =3D s->code_ptr; =20 /* Remove TCG locals stack space. */ --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493295359438707.1835299343018; Thu, 27 Apr 2017 05:15:59 -0700 (PDT) Received: from localhost ([::1]:60376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iKz-0000DS-PS for importer@patchew.org; Thu, 27 Apr 2017 08:15:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i6A-0004AW-9u for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i67-0001Z0-Fd for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33431) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i67-0001Yr-9t for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:35 -0400 Received: by mail-wr0-x241.google.com with SMTP id w50so3540762wrc.0 for ; Thu, 27 Apr 2017 05:00:35 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=mcHYbekBog45VUoPtmzy8HfKy2CCLzb9V2qQHFRTxp8=; b=Bxa4EXIsPBjmBxwNB/IxnZL5QsR+vRTcXGeRD6/+NCORZGfUuNG8DmBM7A0LuLWPJf EjbrwsubvXFijrKdzeDy+/A+C5cug/fPuoiCSQMCIrkDVkshpXXbxZlUVc+joUjLWJL8 ZkpGDcclvAMqmL2sOm3r0NWV/aNaHMw82onudrLOmEc4/eTZsRQi5oIOzIC5P1ZGsc2b eaFbJFqyOOydCrkxqYYli/Ti23WIbBi/a9DqLVA/hq4HxqZVcTN269Fsya4PAl/PnZvi JiSlopFOHPTAMOiUv0XfXKT6tYCbhvYCc/x62HzdkEjDjbpQjkxeeTG73jKNyuFhS1Oe JSiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=mcHYbekBog45VUoPtmzy8HfKy2CCLzb9V2qQHFRTxp8=; b=ZE5l75dE3XpK9ziuaZq+D45UpDSnGf2BWI8cQq3kROTmdPjM9pX63YWb5cLLYGNlPB WADKu14aivtYZCkcRDqMy++XZd0Bharp80oFbvzYTpxjv9f4NtKC+89AxGimvTRxB6JK 1uZx3c+NgbTD5u+WQhJw2LBsN8L3vwxjis1I2lWOC9Vr+zKtKpmTHUDfhPXHorMz5z1o qkCk1nYjl3eYdF2Gkzh01K4CyGKUjYJXdYXFopJuPcR6SkZE2cMGksx3CMKxx6lHrMKB qlYd+W/clVZ5HxN4t1uJcb8G8IpJf5MbjpkHzGXPLqqffJDmMcGMTpeUg+gcePVqCVZW SohQ== X-Gm-Message-State: AN3rC/5zrSNvyr15MMwiHg4wffLcWiY7A5epiLapWo/G26SQDPEtWtov 1uYMOxhBf73Wjw== X-Received: by 10.223.170.195 with SMTP id i3mr3874966wrc.49.1493294434232; Thu, 27 Apr 2017 05:00:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:05 +0200 Message-Id: <20170427120006.20564-19-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v5 18/19] tcg/sparc: Implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target.h | 2 +- tcg/sparc/tcg-target.inc.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index 9348ddd..854a0af 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -123,7 +123,7 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #define TCG_TARGET_HAS_extrl_i64_i32 1 #define TCG_TARGET_HAS_extrh_i64_i32 1 diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 3785d77..18afce2 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -1003,7 +1003,11 @@ static void tcg_target_qemu_prologue(TCGContext *s) /* delay slot */ tcg_out_nop(s); =20 - /* No epilogue required. We issue ret + restore directly in the TB. = */ + /* Epilogue for goto_ptr. */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_arithi(s, TCG_REG_G0, TCG_REG_I7, 8, RETURN); + /* delay slot */ + tcg_out_movi_imm13(s, TCG_REG_O0, 0); =20 #ifdef CONFIG_SOFTMMU build_trampolines(s); @@ -1288,6 +1292,10 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_nop(s); s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + tcg_out_arithi(s, TCG_REG_G0, a0, 0, JMPL); + tcg_out_nop(s); + break; case INDEX_op_br: tcg_out_bpcc(s, COND_A, BPCC_PT, arg_label(a0)); tcg_out_nop(s); @@ -1513,6 +1521,7 @@ static const TCGTargetOpDef sparc_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, --=20 2.9.3 From nobody Mon May 6 20:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493294996343117.87307052604478; Thu, 27 Apr 2017 05:09:56 -0700 (PDT) Received: from localhost ([::1]:60274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3iF8-0003Z2-Tj for importer@patchew.org; Thu, 27 Apr 2017 08:09:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3i6A-0004AY-AG for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3i69-0001ZS-B2 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:38 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33433) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3i69-0001Z9-4O for qemu-devel@nongnu.org; Thu, 27 Apr 2017 08:00:37 -0400 Received: by mail-wr0-x244.google.com with SMTP id w50so3540847wrc.0 for ; Thu, 27 Apr 2017 05:00:36 -0700 (PDT) Received: from bigtime.twiddle.net.com (251.red-80-29-7.adsl.static.ccgg.telefonica.net. [80.29.7.251]) by smtp.gmail.com with ESMTPSA id i199sm3056470wmf.33.2017.04.27.05.00.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 05:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dBmwEVB48wsKeXdziLR1GCg4mcvU+OTonPoNNJb7lI4=; b=EKQn7ms4u5vk1efurYxr4JkEk2nghIC+lVgGyoTEtaQyiZKQ1Fgd3N+kkTxvLa7fSG U5O7oJ0DIBZGid+GIUYpgyVUKbsK+xCy5h+D2mR71MQegT4lrwLw7zuEH2ZJ/w8IS+77 jUs5vPBCHgaJ3c97S5RdXzNtD9XIs+GI2pVW0iySc823vZbHXy2DX/YBEgOT/W+uAH4T Y8NAL28YLZjsvet5syJ38zEEFpmPJ7sgpOQUNeMF1qq0SuFDekPNghn7RrDr90bXa6nW Zz0HBa6SZu9dxmT8WZcIErQmIwW1yqDtsEt/GYVDJr0zgoO9NTswtXs6dm/CTiaA/K7A 5hrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dBmwEVB48wsKeXdziLR1GCg4mcvU+OTonPoNNJb7lI4=; b=JIhfXGoX0aaFYCiPrYaVoxxppbubzEWpp7xGzsPydVXxPr/fpNcFhXv18eMkPTm8IF tz8T085T/pfUgd14R7xHSkzU1abuCkJehp/OBADuFAjlA5rlgPoaF4kQqKo+ubfHmWCY h/cCN/V/ileYvH27ME6tXwniRsdi3SlfmerS9yKKRLByIxbxgHWflJ7fZt5slfBKthQ5 Xz0nBvgPaHp4x/9ueUnMDM0UlysUxSN3Rv4Gc2UDEpfW6JDsgFWDda6CJ3swdajXzzmi ZPNlCFCX2ubTIaxzuZz8JMJ/ogKDcXswqXcmBNJZdeLt24aUrg0pi/q2XQKagM3gZcsQ Myyg== X-Gm-Message-State: AN3rC/5HA4SQYb+/6qzXaK8qZLBS9RISx+SShjJGKh97hiKLknfCyf0V JkmC6j/wvntHmRIFFMU= X-Received: by 10.223.152.175 with SMTP id w44mr3253536wrb.122.1493294435754; Thu, 27 Apr 2017 05:00:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 14:00:06 +0200 Message-Id: <20170427120006.20564-20-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170427120006.20564-1-rth@twiddle.net> References: <20170427120006.20564-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v5 19/19] tcg/s390: Implement goto_ptr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.h | 2 +- tcg/s390/tcg-target.inc.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index 6b7bcfb..957f0c0 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -92,7 +92,7 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #define TCG_TARGET_HAS_div2_i64 1 #define TCG_TARGET_HAS_rot_i64 1 diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index a679280..5d7083e 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -1741,9 +1741,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, =20 switch (opc) { case INDEX_op_exit_tb: - /* return value */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, args[0]); - tgen_gotoi(s, S390_CC_ALWAYS, tb_ret_addr); + /* Reuse the zeroing that exists for goto_ptr. */ + a0 =3D args[0]; + if (a0 =3D=3D 0) { + tgen_gotoi(s, S390_CC_ALWAYS, s->code_gen_epilogue); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, a0); + tgen_gotoi(s, S390_CC_ALWAYS, tb_ret_addr); + } break; =20 case INDEX_op_goto_tb: @@ -1767,6 +1772,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, s->tb_jmp_reset_offset[args[0]] =3D tcg_current_code_size(s); break; =20 + case INDEX_op_goto_ptr: + tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, args[0]); + break; + OP_32_64(ld8u): /* ??? LLC (RXY format) is only present with the extended-immediate facility, whereas LLGC is always present. */ @@ -2241,6 +2250,7 @@ static const TCGTargetOpDef s390_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, @@ -2439,6 +2449,14 @@ static void tcg_target_qemu_prologue(TCGContext *s) /* br %r3 (go to TB) */ tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, tcg_target_call_iarg_regs[1]); =20 + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R2, 0); + + /* TB epilogue */ tb_ret_addr =3D s->code_ptr; =20 /* lmg %r6,%r15,fs+48(%r15) (restore registers) */ --=20 2.9.3