From nobody Sun Nov 9 14:51:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551112206728660.8855291008666; Mon, 25 Feb 2019 08:30:06 -0800 (PST) Received: from localhost ([127.0.0.1]:40132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyJ8n-0006XA-Ft for importer@patchew.org; Mon, 25 Feb 2019 11:30:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyIOQ-0000av-BL for qemu-devel@nongnu.org; Mon, 25 Feb 2019 10:42:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyIOP-0008BP-G5 for qemu-devel@nongnu.org; Mon, 25 Feb 2019 10:42:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyIOP-0008Ag-71 for qemu-devel@nongnu.org; Mon, 25 Feb 2019 10:42:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9E7B81F19; Mon, 25 Feb 2019 15:42:07 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-105.ams2.redhat.com [10.36.117.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A1B760BE7; Mon, 25 Feb 2019 15:42:04 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 25 Feb 2019 16:42:04 +0100 Message-Id: <20190225154204.26751-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 25 Feb 2019 15:42:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64() 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: David Hildenbrand , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Will be helpful for s390x. Input 128 bit and output 64 bit only, which is sufficient for now. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand --- v1 -> v2: - Use one output (lower part) only - Shield off big shifts by an assert tcg/tcg-op.c | 15 +++++++++++++++ tcg/tcg-op.h | 1 + 2 files changed, 16 insertions(+) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 1bd7ef24af..e4fa75c074 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2381,6 +2381,21 @@ void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv= _i64 al, } } =20 +void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t cou= nt) +{ + tcg_debug_assert(count >=3D 0 && count <=3D 64); + if (count =3D=3D 0) { + tcg_gen_mov_i64(ret, al); + } else if (count =3D=3D 64) { + tcg_gen_mov_i64(ret, ah); + } else { + TCGv_i64 t0 =3D tcg_temp_new_i64(); + tcg_gen_shri_i64(t0, al, count); + tcg_gen_deposit_i64(ret, t0, ah, 64 - count, count); + tcg_temp_free_i64(t0); + } +} + void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 a= rg2) { if (TCG_TARGET_HAS_mulu2_i64) { diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index d3e51b15af..1ffe689276 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -513,6 +513,7 @@ void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i6= 4 al, TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh); void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al, TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh); +void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t cou= nt); void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 a= rg2); void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 a= rg2); void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 = arg2); --=20 2.17.2