From patchwork Thu Dec 10 21:43:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 40936 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 ozlabs.org (Postfix) with ESMTPS id E4B6AB70BA for ; Sat, 12 Dec 2009 12:27:44 +1100 (EST) Received: from localhost ([127.0.0.1]:36189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJGlp-0001py-QU for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2009 20:27:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJGhs-0007ow-6e for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJGhp-0007l8-1J for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:33 -0500 Received: from [199.232.76.173] (port=54741 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJGhn-0007kW-M0 for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:31 -0500 Received: from are.twiddle.net ([75.149.56.221]:43435) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJGhm-00035h-VI for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:31 -0500 Received: by are.twiddle.net (Postfix, from userid 5000) id 70197C8A; Fri, 11 Dec 2009 17:23:30 -0800 (PST) Message-Id: In-Reply-To: References: From: Richard Henderson Date: Thu, 10 Dec 2009 13:43:58 -0800 To: qemu-devel@nongnu.org MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 03/13] alpha: Expand zap/zapnot with immediate inline. 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 The vast majority of zap instructions have an immediate operand, since zapnot is the canonical method to zero-extend from u16 or u32. Signed-off-by: Richard Henderson --- target-alpha/translate.c | 61 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 2 deletions(-) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 4f923bb..bd193da 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -507,6 +507,65 @@ FCMOV(cmpfge) FCMOV(cmpfle) FCMOV(cmpfgt) +/* Implement zapnot with an immediate operand, which expands to some + form of immediate AND. This is a basic building block in the + definition of many of the other byte manipulation instructions. */ +static inline void gen_zapnoti(int ra, int rc, uint8_t lit) +{ + uint64_t mask; + int i; + + switch (lit) { + case 0x00: + tcg_gen_movi_i64(cpu_ir[rc], 0); + break; + case 0x01: + tcg_gen_ext8u_i64(cpu_ir[rc], cpu_ir[ra]); + break; + case 0x03: + tcg_gen_ext16u_i64(cpu_ir[rc], cpu_ir[ra]); + break; + case 0x0f: + tcg_gen_ext32u_i64(cpu_ir[rc], cpu_ir[ra]); + break; + case 0xff: + tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]); + break; + default: + for (mask = i = 0; i < 8; ++i) { + if ((lit >> i) & 1) + mask |= 0xffull << (i * 8); + } + tcg_gen_andi_i64 (cpu_ir[rc], cpu_ir[ra], mask); + break; + } +} + +static inline void gen_zapnot(int ra, int rb, int rc, int islit, uint8_t lit) +{ + if (unlikely(rc == 31)) + return; + else if (unlikely(ra == 31)) + tcg_gen_movi_i64(cpu_ir[rc], 0); + else if (islit) + gen_zapnoti(ra, rc, lit); + else + gen_helper_zapnot (cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); +} + +static inline void gen_zap(int ra, int rb, int rc, int islit, uint8_t lit) +{ + if (unlikely(rc == 31)) + return; + else if (unlikely(ra == 31)) + tcg_gen_movi_i64(cpu_ir[rc], 0); + else if (islit) + gen_zapnoti(ra, rc, ~lit); + else + gen_helper_zap (cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); +} + + /* EXTWH, EXTWH, EXTLH, EXTQH */ static inline void gen_ext_h(void(*tcg_gen_ext_i64)(TCGv t0, TCGv t1), int ra, int rb, int rc, int islit, uint8_t lit) @@ -598,8 +657,6 @@ ARITH3(mskwl) ARITH3(inswl) ARITH3(mskll) ARITH3(insll) -ARITH3(zap) -ARITH3(zapnot) ARITH3(mskql) ARITH3(insql) ARITH3(mskwh)