From patchwork Thu Aug 20 10:47:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 31718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 05D6AB70B0 for ; Thu, 20 Aug 2009 20:51:33 +1000 (EST) Received: from localhost ([127.0.0.1]:47941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me5Et-0003Eg-Tp for incoming@patchwork.ozlabs.org; Thu, 20 Aug 2009 06:51:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Me5Al-00029H-Fr for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:47:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Me5Ag-00026m-EK for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:47:10 -0400 Received: from [199.232.76.173] (port=48682 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me5Af-00026S-Vn for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:47:06 -0400 Received: from cantor.suse.de ([195.135.220.2]:52676 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Me5Af-0003u6-G8 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 06:47:05 -0400 Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id D62E48D893; Thu, 20 Aug 2009 12:47:01 +0200 (CEST) From: Ulrich Hecht To: qemu-devel@nongnu.org, Anthony Liguori Date: Thu, 20 Aug 2009 12:47:01 +0200 Message-Id: <1250765221-9481-1-git-send-email-uli@suse.de> X-Mailer: git-send-email 1.6.2.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Subject: [Qemu-devel] [PATCH 01/13] TCG "sync" op X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org sync allows concurrent accesses to locations in memory through different TCG variables. This comes in handy when you are emulating CPU registers that can be used as either 32 or 64 bit, as TCG doesn't know anything about aliases. See the s390x target for an example. Fixed sync_i64 build failure on 32-bit targets. Signed-off-by: Ulrich Hecht --- tcg/tcg-op.h | 12 ++++++++++++ tcg/tcg-opc.h | 2 ++ tcg/tcg.c | 6 ++++++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index f3f2f71..6bcaf5b 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -316,6 +316,18 @@ static inline void tcg_gen_br(int label) tcg_gen_op1i(INDEX_op_br, label); } +static inline void tcg_gen_sync_i32(TCGv_i32 arg) +{ + tcg_gen_op1_i32(INDEX_op_sync_i32, arg); +} + +#if TCG_TARGET_REG_BITS == 64 +static inline void tcg_gen_sync_i64(TCGv_i64 arg) +{ + tcg_gen_op1_i64(INDEX_op_sync_i64, arg); +} +#endif + static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg) { if (!TCGV_EQUAL_I32(ret, arg)) diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index 3a095fc..654a45f 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -40,6 +40,7 @@ DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */ DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS) DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS) +DEF2(sync_i32, 0, 1, 0, 0) DEF2(mov_i32, 1, 1, 0, 0) DEF2(movi_i32, 1, 0, 1, 0) /* load/store */ @@ -103,6 +104,7 @@ DEF2(neg_i32, 1, 1, 0, 0) #endif #if TCG_TARGET_REG_BITS == 64 +DEF2(sync_i64, 0, 1, 0, 0) DEF2(mov_i64, 1, 1, 0, 0) DEF2(movi_i64, 1, 0, 1, 0) /* load/store */ diff --git a/tcg/tcg.c b/tcg/tcg.c index 93066e2..1cea44b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1931,6 +1931,12 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, // dump_regs(s); #endif switch(opc) { + case INDEX_op_sync_i32: +#if TCG_TARGET_REG_BITS == 64 + case INDEX_op_sync_i64: +#endif + temp_save(s, args[0], s->reserved_regs); + break; case INDEX_op_mov_i32: #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: