From patchwork Fri Feb 7 21:49:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 24323 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F356B202B2 for ; Fri, 7 Feb 2014 21:50:37 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf17480269oah.6 for ; Fri, 07 Feb 2014 13:50:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=HONeEczktM95Sp/fDXkb9lS+96/6922qtsW7+zJW660=; b=MvmitoAOxLmtZgz5QB2axbJjUg0WDWj1XGVXIOxXkTXlup/V6x/tn5mXnsm89PX12r 1URU45jTfTeE9sJhZ8BT0MJDvleuu3TrWn8jyl+09YiFl7zIABa0+o0J81QQ0WX4+H0n WTavXqjTFuwpd37TgRH2sRv7Ba2e0k+KOPdJ+NUVeP2V0dcUPQUD6Egs7LFrqLZVWinp YdmoqJ2OLfGJ0WZT2irHdQn/5j6sWgKTGikL21WTHRvAoIzwbRJv8AvPBqVXy1gyIP7A PS4LYEZWFh6alQdTvK++Fx7jFAeDjvadHNF/8MnAye8j/UGl8c8lCXh750PDv/0kqHVu SWHA== X-Gm-Message-State: ALoCoQkX0tGcDorbwtWa4DT6nUsNuxNtSZGP+Kf1X6dVHdoPAXU2azElbfu1HrWFZ28uxQ0r+jsV X-Received: by 10.182.116.39 with SMTP id jt7mr6765081obb.33.1391809837046; Fri, 07 Feb 2014 13:50:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.113 with SMTP id p104ls1184811qga.41.gmail; Fri, 07 Feb 2014 13:50:36 -0800 (PST) X-Received: by 10.52.170.3 with SMTP id ai3mr6477108vdc.35.1391809836959; Fri, 07 Feb 2014 13:50:36 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id n15si1790257vcy.102.2014.02.07.13.50.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 13:50:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so3222149veb.21 for ; Fri, 07 Feb 2014 13:50:36 -0800 (PST) X-Received: by 10.58.211.130 with SMTP id nc2mr11937418vec.7.1391809836851; Fri, 07 Feb 2014 13:50:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp137857vcz; Fri, 7 Feb 2014 13:50:36 -0800 (PST) X-Received: by 10.229.46.70 with SMTP id i6mr9205882qcf.10.1391809836403; Fri, 07 Feb 2014 13:50:36 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t101si4577407qge.151.2014.02.07.13.50.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 07 Feb 2014 13:50:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:43957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBtJk-0006wT-1J for patch@linaro.org; Fri, 07 Feb 2014 16:50:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBtIm-0005nQ-Bh for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBtIl-0004vD-9n for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:49:36 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:45625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBtIk-0004u7-VR for qemu-devel@nongnu.org; Fri, 07 Feb 2014 16:49:35 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WBtIZ-0002w4-TU; Fri, 07 Feb 2014 21:49:23 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 7 Feb 2014 21:49:17 +0000 Message-Id: <1391809763-11251-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391809763-11251-1-git-send-email-peter.maydell@linaro.org> References: <1391809763-11251-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Peter Crosthwaite , patches@linaro.org, Michael Matz , Alexander Graf , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, Christoffer Dall , Richard Henderson Subject: [Qemu-devel] [PATCH 2/8] target-arm: A64: Implement long vector x indexed insns 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Implement the 'long' operations in the vector x indexed element category. Signed-off-by: Peter Maydell --- target-arm/translate-a64.c | 144 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 5 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index b7f1ecf..64b8c86 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -7906,11 +7906,6 @@ static void disas_simd_indexed_vector(DisasContext *s, uint32_t insn) } } - if (is_long) { - unsupported_encoding(s, insn); - return; - } - if (is_fp) { fpst = get_fpstatus_ptr(); } else { @@ -8052,6 +8047,145 @@ static void disas_simd_indexed_vector(DisasContext *s, uint32_t insn) } } else { /* long ops: 16x16->32 or 32x32->64 */ + TCGv_i64 tcg_res[2]; + int pass; + bool satop = extract32(opcode, 0, 1); + TCGMemOp memop = MO_32; + + if (satop || !u) { + memop |= MO_SIGN; + } + + if (size == 2) { + TCGv_i64 tcg_idx = tcg_temp_new_i64(); + + read_vec_element(s, tcg_idx, rm, index, memop); + + for (pass = 0; pass < 2; pass++) { + TCGv_i64 tcg_op = tcg_temp_new_i64(); + TCGv_i64 tcg_passres; + + read_vec_element(s, tcg_op, rn, pass + (is_q * 2), memop); + + tcg_res[pass] = tcg_temp_new_i64(); + + if (opcode == 0xa || opcode == 0xb) { + /* Non-accumulating ops */ + tcg_passres = tcg_res[pass]; + } else { + tcg_passres = tcg_temp_new_i64(); + } + + tcg_gen_mul_i64(tcg_passres, tcg_op, tcg_idx); + tcg_temp_free_i64(tcg_op); + + if (satop) { + /* saturating, doubling */ + gen_helper_neon_addl_saturate_s64(tcg_passres, cpu_env, + tcg_passres, tcg_passres); + } + + if (opcode == 0xa || opcode == 0xb) { + continue; + } + + /* Accumulating op: handle accumulate step */ + read_vec_element(s, tcg_res[pass], rd, pass, MO_64); + + switch (opcode) { + case 0x2: /* SMLAL, SMLAL2, UMLAL, UMLAL2 */ + tcg_gen_add_i64(tcg_res[pass], tcg_res[pass], tcg_passres); + break; + case 0x6: /* SMLSL, SMLSL2, UMLSL, UMLSL2 */ + tcg_gen_sub_i64(tcg_res[pass], tcg_res[pass], tcg_passres); + break; + case 0x7: /* SQDMLSL, SQDMLSL2 */ + tcg_gen_neg_i64(tcg_passres, tcg_passres); + /* fall through */ + case 0x3: /* SQDMLAL, SQDMLAL2 */ + gen_helper_neon_addl_saturate_s64(tcg_res[pass], cpu_env, + tcg_res[pass], + tcg_passres); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_i64(tcg_passres); + } + tcg_temp_free_i64(tcg_idx); + } else { + TCGv_i32 tcg_idx = tcg_temp_new_i32(); + + assert(size == 1); + read_vec_element_i32(s, tcg_idx, rm, index, size); + + /* The simplest way to handle the 16x16 indexed ops is to duplicate + * the index into both halves of the 32 bit tcg_idx and then use + * the usual Neon helpers. + */ + tcg_gen_deposit_i32(tcg_idx, tcg_idx, tcg_idx, 16, 16); + + for (pass = 0; pass < 2; pass++) { + TCGv_i32 tcg_op = tcg_temp_new_i32(); + TCGv_i64 tcg_passres; + + read_vec_element_i32(s, tcg_op, rn, pass + (is_q * 2), MO_32); + tcg_res[pass] = tcg_temp_new_i64(); + + if (opcode == 0xa || opcode == 0xb) { + /* Non-accumulating ops */ + tcg_passres = tcg_res[pass]; + } else { + tcg_passres = tcg_temp_new_i64(); + } + + if (memop & MO_SIGN) { + gen_helper_neon_mull_s16(tcg_passres, tcg_op, tcg_idx); + } else { + gen_helper_neon_mull_u16(tcg_passres, tcg_op, tcg_idx); + } + if (satop) { + gen_helper_neon_addl_saturate_s32(tcg_passres, cpu_env, + tcg_passres, tcg_passres); + } + tcg_temp_free_i32(tcg_op); + + if (opcode == 0xa || opcode == 0xb) { + continue; + } + + /* Accumulating op: handle accumulate step */ + read_vec_element(s, tcg_res[pass], rd, pass, MO_64); + + switch (opcode) { + case 0x2: /* SMLAL, SMLAL2, UMLAL, UMLAL2 */ + gen_helper_neon_addl_u32(tcg_res[pass], tcg_res[pass], + tcg_passres); + break; + case 0x6: /* SMLSL, SMLSL2, UMLSL, UMLSL2 */ + gen_helper_neon_subl_u32(tcg_res[pass], tcg_res[pass], + tcg_passres); + break; + case 0x7: /* SQDMLSL, SQDMLSL2 */ + gen_helper_neon_negl_u32(tcg_passres, tcg_passres); + /* fall through */ + case 0x3: /* SQDMLAL, SQDMLAL2 */ + gen_helper_neon_addl_saturate_s32(tcg_res[pass], cpu_env, + tcg_res[pass], + tcg_passres); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_i64(tcg_passres); + } + tcg_temp_free_i32(tcg_idx); + } + + for (pass = 0; pass < 2; pass++) { + write_vec_element(s, tcg_res[pass], rd, pass, MO_64); + tcg_temp_free_i64(tcg_res[pass]); + } } if (!TCGV_IS_UNUSED_PTR(fpst)) {