From patchwork Fri Aug 4 05:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9880611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A07F6031B for ; Fri, 4 Aug 2017 06:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E989289AA for ; Fri, 4 Aug 2017 06:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33370289AC; Fri, 4 Aug 2017 06:03:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E948289AA for ; Fri, 4 Aug 2017 06:03:35 +0000 (UTC) Received: from localhost ([::1]:37198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVhu-0003mn-VG for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Aug 2017 02:03:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVPo-00049b-65 for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:44:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddVPn-0003pz-DS for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:44:52 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:33066) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddVPn-0003oc-8a for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:44:51 -0400 Received: by mail-pg0-x241.google.com with SMTP id u185so853984pgb.0 for ; Thu, 03 Aug 2017 22:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=kDaZKPZ+qGIvGuQ/c4u6UAvwkpHrBioMfnL6xFXBg9g=; b=pOjkU5HA223wXExm16jV/jqQnCRKEHwir3GPcuHOTR/W/7CePXu0ra8BaL8uoX2YjO PfIcDbinEmLNH9Z4POgTC68GHa4457T0XEPhxldMyU0j5eFvKr9HyMHwES7b85+eWaDB yPY/8coCwnNBFN/imQyTDpt/w7NvzCJLicfxPUAr9NHtBamBgttJTS16zVH/O9VERheJ Iau+NtGcT7lmNanPnPKoyIluOJE195/PvFtf6zY3uGfl0SYGVpCS8rHfEctMqD7B65fs ZOnS99JVzeanChALleRylWt+u9FygM+gwS0kRkntTViP06MoUjFRg6p9u/J08wsDss+r NwSw== 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:subject:date:message-id :in-reply-to:references; bh=kDaZKPZ+qGIvGuQ/c4u6UAvwkpHrBioMfnL6xFXBg9g=; b=jaiFFdJkuJNw5hw7w+49NOVwvIyPDzEbMjzxZuyPX1RgxQZV7KgBPI/IX7Ny9hqn/j x/kk0pcO0EX1QOlTfKyEH76yJ1Okn76gFZlAaZOYbOfwX9nRiyzz4SHtw7XiFCe4HKTq heTxTaXaxPVyC6sc96dipAYUo/7F0xLo7EpYeFKTC0TdSupOdYWLoISSbg0kD+wRli9Z a3/Jt870iwXKYSMXwKNQm1/QXsS6yvKEIEPKFKItYfHarE/6a+wZfTWItLPbbdqUfnV3 lJ4va0rYdmgm1lmYM1Mo59Nj3QrPqUx3fXuiT0Nf6bvnf9RPdUpaad2mwlckRcmhc4/i xMBw== X-Gm-Message-State: AIVw113kSThGX+cwJgsorrYZhSqLDPwslH3RQ+W47ZFCSdnyZIdqWhEM +xTvtVVLGdUsc//Vd3I= X-Received: by 10.84.139.40 with SMTP id 37mr1422892plq.153.1501825490148; Thu, 03 Aug 2017 22:44:50 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id o14sm1061063pfi.158.2017.08.03.22.44.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Aug 2017 22:44:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 3 Aug 2017 22:44:25 -0700 Message-Id: <20170804054426.10590-23-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170804054426.10590-1-rth@twiddle.net> References: <20170804054426.10590-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PATCH for-2.11 22/23] tcg/ppc: Look for shifted constants 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.inc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index bc14d2c9c6..4b32809217 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -598,6 +598,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, { intptr_t tb_diff; int32_t high; + int lsb; tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32); @@ -638,6 +639,14 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + lsb = ctz64(arg); + high = arg >> lsb; + if (arg == (int16_t)arg) { + tcg_out32(s, ADDI | TAI(ret, 0, high)); + tcg_out_shli64(s, ret, ret, lsb); + return; + } + high = arg >> 31 >> 1; tcg_out_movi(s, TCG_TYPE_I32, ret, high); if (high) {