From patchwork Sun Jul 24 17:10:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 106527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3DD02B6F86 for ; Mon, 25 Jul 2011 03:12:20 +1000 (EST) Received: from localhost ([::1]:42834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ql2Dv-0001JX-UN for incoming@patchwork.ozlabs.org; Sun, 24 Jul 2011 13:12:15 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ql2Dh-00018G-Sg for qemu-devel@nongnu.org; Sun, 24 Jul 2011 13:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ql2Dg-0005E6-Nl for qemu-devel@nongnu.org; Sun, 24 Jul 2011 13:12:01 -0400 Received: from mail-fx0-f47.google.com ([209.85.161.47]:56785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ql2Dg-0004u6-GD for qemu-devel@nongnu.org; Sun, 24 Jul 2011 13:12:00 -0400 Received: by mail-fx0-f47.google.com with SMTP id 11so8353846fxg.34 for ; Sun, 24 Jul 2011 10:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=CKRWv+VS8SV3xYO6fz47dwG4SgWBsxMWXLa62O8+6C0=; b=K5sTB5+n0b9wgHgKWjzgFZz+DiITJRlYcr+8hTONqGzUVR62MgGzaT91/Z7V/KEJnL HS3VhBNlJqYuBkIFijrctgU5vYFaIWcl6eSkUMBxs8bPE9eUCU0PI9HH+Ku4SiLIRNaA pD9dJGCAM0J4bfc35HI7LMeGm+Z5+1rwKLhEw= Received: by 10.204.132.132 with SMTP id b4mr1188456bkt.266.1311527520091; Sun, 24 Jul 2011 10:12:00 -0700 (PDT) Received: from octofox.metropolis ([188.134.19.124]) by mx.google.com with ESMTPS id l22sm1070947bku.57.2011.07.24.10.11.57 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Jul 2011 10:11:59 -0700 (PDT) Received: by octofox.metropolis (sSMTP sendmail emulation); Sun, 24 Jul 2011 21:11:56 +0400 From: Max Filippov To: qemu-devel@nongnu.org Date: Sun, 24 Jul 2011 21:10:42 +0400 Message-Id: <1311527469-12963-5-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1311527469-12963-1-git-send-email-jcmvbkbc@gmail.com> References: <1311527469-12963-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.47 Cc: jcmvbkbc@gmail.com Subject: [Qemu-devel] [PATCH v2 04/31] target-xtensa: implement narrow instructions 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 Instructions with op0 >= 8 are 2 bytes long, others are 3 bytes long. Signed-off-by: Max Filippov --- target-xtensa/translate.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 049c3cd..2ff5838 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -106,6 +106,11 @@ static void gen_jump_slot(DisasContext *dc, TCGv dest, int slot) dc->is_jmp = DISAS_UPDATE; } +static void gen_jump(DisasContext *dc, TCGv dest) +{ + gen_jump_slot(dc, dest, -1); +} + static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot) { TCGv_i32 tmp = tcg_const_i32(dest); @@ -377,22 +382,71 @@ static void disas_xtensa_insn(DisasContext *dc) case 7: /*B*/ break; +#define gen_narrow_load_store(type) do { \ + TCGv_i32 addr = tcg_temp_new_i32(); \ + tcg_gen_addi_i32(addr, cpu_R[RRRN_S], RRRN_R << 2); \ + tcg_gen_qemu_##type(cpu_R[RRRN_T], addr, 0); \ + tcg_temp_free(addr); \ + } while (0) + case 8: /*L32I.Nn*/ + gen_narrow_load_store(ld32u); break; case 9: /*S32I.Nn*/ + gen_narrow_load_store(st32); break; +#undef gen_narrow_load_store case 10: /*ADD.Nn*/ + tcg_gen_add_i32(cpu_R[RRRN_R], cpu_R[RRRN_S], cpu_R[RRRN_T]); break; case 11: /*ADDI.Nn*/ + tcg_gen_addi_i32(cpu_R[RRRN_R], cpu_R[RRRN_S], RRRN_T ? RRRN_T : -1); break; case 12: /*ST2n*/ + if (RRRN_T < 8) { /*MOVI.Nn*/ + tcg_gen_movi_i32(cpu_R[RRRN_S], + RRRN_R | (RRRN_T << 4) | + ((RRRN_T & 6) == 6 ? 0xffffff80 : 0)); + } else { /*BEQZ.Nn*/ /*BNEZ.Nn*/ + } break; case 13: /*ST3n*/ + switch (RRRN_R) { + case 0: /*MOV.Nn*/ + tcg_gen_mov_i32(cpu_R[RRRN_T], cpu_R[RRRN_S]); + break; + + case 15: /*S3*/ + switch (RRRN_T) { + case 0: /*RET.Nn*/ + gen_jump(dc, cpu_R[0]); + break; + + case 1: /*RETW.Nn*/ + break; + + case 2: /*BREAK.Nn*/ + break; + + case 3: /*NOP.Nn*/ + break; + + case 6: /*ILL.Nn*/ + break; + + default: /*reserved*/ + break; + } + break; + + default: /*reserved*/ + break; + } break; default: /*reserved*/