From patchwork Mon Apr 18 18:07:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 91824 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 B5F84B6F75 for ; Tue, 19 Apr 2011 04:07:25 +1000 (EST) Received: from localhost ([::1]:33528 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsr5-0002vi-2a for incoming@patchwork.ozlabs.org; Mon, 18 Apr 2011 14:07:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsqy-0002vd-5c for qemu-devel@nongnu.org; Mon, 18 Apr 2011 14:07:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBsqx-0001in-0C for qemu-devel@nongnu.org; Mon, 18 Apr 2011 14:07:16 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:35353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBsqw-0001if-Lu for qemu-devel@nongnu.org; Mon, 18 Apr 2011 14:07:14 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QBsqu-0007gE-KU; Mon, 18 Apr 2011 19:07:12 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 18 Apr 2011 19:07:11 +0100 Message-Id: <1303150032-29497-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1303150032-29497-1-git-send-email-peter.maydell@linaro.org> References: <1303150032-29497-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores 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 Handle the UNDEF and UNPREDICTABLE cases for Neon "single element to one lane" VLD and "single element from one lane" VST. Signed-off-by: Peter Maydell --- target-arm/translate.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 6190028..5820add 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -3975,6 +3975,7 @@ static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn) stride = (1 << size) * nregs; } else { /* Single element. */ + int idx = (insn >> 4) & 0xf; pass = (insn >> 7) & 1; switch (size) { case 0: @@ -3993,6 +3994,39 @@ static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn) abort(); } nregs = ((insn >> 8) & 3) + 1; + /* Catch the UNDEF cases. This is unavoidably a bit messy. */ + switch (nregs) { + case 1: + if (((idx & (1 << size)) != 0) || + (size == 2 && ((idx & 3) == 1 || (idx & 3) == 2))) { + return 1; + } + break; + case 3: + if ((idx & 1) != 0) { + return 1; + } + /* fall through */ + case 2: + if (size == 2 && (idx & 2) != 0) { + return 1; + } + break; + case 4: + if ((size == 2) && ((idx & 3) == 3)) { + return 1; + } + break; + default: + abort(); + } + if ((rd + stride * (nregs - 1)) > 31) { + /* Attempts to write off the end of the register file + * are UNPREDICTABLE; we choose to UNDEF because otherwise + * the neon_load_reg() would write off the end of the array. + */ + return 1; + } addr = tcg_temp_new_i32(); load_reg_var(s, addr, rn); for (reg = 0; reg < nregs; reg++) {