From patchwork Sat Sep 22 00:18:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 565B62C008E for ; Sat, 22 Sep 2012 11:07:48 +1000 (EST) Received: from localhost ([::1]:41228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFDRT-00079D-1C for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 20:19:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFDQU-0004bA-6K for qemu-devel@nongnu.org; Fri, 21 Sep 2012 20:18:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFDQT-00016J-6a for qemu-devel@nongnu.org; Fri, 21 Sep 2012 20:18:30 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:41851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFDQS-00015F-W7 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 20:18:29 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp12so8738004pbb.4 for ; Fri, 21 Sep 2012 17:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=yhRl+1EiUGvyrmaaNtFM2kQhxhI4KVG4AIp2l8ipgyU=; b=Eg4Z831Gh0Ful8nIr/IM5qx7a2/ADbFREJYTP9RkCso/pGA9lg9Yxxr5h9SN0BGNHv rdY5GV35uybMuCqTu4ibrbyUKunPXJmhOOqgI1Uf/PYhD9T2xC2NqUPGXGMX+mkPCBnS ceTj8HDr2OIKl1Z1yLu7lT0mMB+nL66e5AP/gyWmTn6B/BphX2+P3CMNoicTFAFzXR80 yrXPQJGAVwd/7UdOlkohxcuZ/4nrml6QuWpMT9gxS8c0cOHkEyea3EuDGtybLXLynF7c aS9IuHhzJTsxG6TshtuulVwhiUuFF6KXsHngWVdqZ7rGAgrblonIMkkUO9KnGePD/jsD 9VPQ== Received: by 10.68.202.38 with SMTP id kf6mr19444414pbc.46.1348273108683; Fri, 21 Sep 2012 17:18:28 -0700 (PDT) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id j9sm4837761pav.15.2012.09.21.17.18.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 17:18:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2012 17:18:13 -0700 Message-Id: <1348273096-1495-6-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348273096-1495-1-git-send-email-rth@twiddle.net> References: <1348273096-1495-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 5/8] tcg: Implement concat*_i64 with deposit_i64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For tcg_gen_concat_i32_i64 we only use deposit if the host supports it. For tcg_gen_concat32_i64 even if the host does not, as we get identical code before and after. Note that this relies on the ANDI -> EXTU patch for the identity claim. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- tcg/tcg-op.h | 60 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index bcfb60b..d2fb283 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -1809,36 +1809,6 @@ static inline void tcg_gen_discard_i64(TCGv_i64 arg) #endif } -static inline void tcg_gen_concat_i32_i64(TCGv_i64 dest, TCGv_i32 low, TCGv_i32 high) -{ -#if TCG_TARGET_REG_BITS == 32 - tcg_gen_mov_i32(TCGV_LOW(dest), low); - tcg_gen_mov_i32(TCGV_HIGH(dest), high); -#else - TCGv_i64 tmp = tcg_temp_new_i64(); - /* This extension is only needed for type correctness. - We may be able to do better given target specific information. */ - tcg_gen_extu_i32_i64(tmp, high); - tcg_gen_shli_i64(tmp, tmp, 32); - tcg_gen_extu_i32_i64(dest, low); - tcg_gen_or_i64(dest, dest, tmp); - tcg_temp_free_i64(tmp); -#endif -} - -static inline void tcg_gen_concat32_i64(TCGv_i64 dest, TCGv_i64 low, TCGv_i64 high) -{ -#if TCG_TARGET_REG_BITS == 32 - tcg_gen_concat_i32_i64(dest, TCGV_LOW(low), TCGV_LOW(high)); -#else - TCGv_i64 tmp = tcg_temp_new_i64(); - tcg_gen_ext32u_i64(dest, low); - tcg_gen_shli_i64(tmp, high, 32); - tcg_gen_or_i64(dest, dest, tmp); - tcg_temp_free_i64(tmp); -#endif -} - static inline void tcg_gen_andc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { if (TCG_TARGET_HAS_andc_i32) { @@ -2181,6 +2151,36 @@ static inline void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, tcg_temp_free_i64(t1); } +static inline void tcg_gen_concat_i32_i64(TCGv_i64 dest, TCGv_i32 low, + TCGv_i32 high) +{ +#if TCG_TARGET_REG_BITS == 32 + tcg_gen_mov_i32(TCGV_LOW(dest), low); + tcg_gen_mov_i32(TCGV_HIGH(dest), high); +#else + TCGv_i64 tmp = tcg_temp_new_i64(); + /* These extensions are only needed for type correctness. + We may be able to do better given target specific information. */ + tcg_gen_extu_i32_i64(tmp, high); + tcg_gen_extu_i32_i64(dest, low); + /* If deposit is available, use it. Otherwise use the extra + knowledge that we have of the zero-extensions above. */ + if (TCG_TARGET_HAS_deposit_i64 && TCG_TARGET_deposit_i64_valid(32, 32)) { + tcg_gen_deposit_i64(dest, dest, tmp, 32, 32); + } else { + tcg_gen_shli_i64(tmp, tmp, 32); + tcg_gen_or_i64(dest, dest, tmp); + } + tcg_temp_free_i64(tmp); +#endif +} + +static inline void tcg_gen_concat32_i64(TCGv_i64 dest, TCGv_i64 low, + TCGv_i64 high) +{ + tcg_gen_deposit_i64(dest, low, high, 32, 32); +} + static inline void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2)