From patchwork Mon Jan 13 14:13:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 23168 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA280202DA for ; Mon, 13 Jan 2014 14:13:34 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id u16sf881934iet.0 for ; Mon, 13 Jan 2014 06:13:33 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Xt0YXoE2GRLFSb1sd8VbBsy3IF+ULFWLJYBbylwKdlQ=; b=euQTgbmMEdmEJTLDNH8xWrvC+76qcsnaTlaGrbDvhnYgo8WZMwAu0m7H+tup/sIw5h XwtZCkpJ16BHCPoyNHE6mcOn2ZWLqR+09xPJe/N1GUGnkX237A04qd4FR77e5BDStL5k ftqaVLd8AiS/8+XHLUHMAzmwOu2nfx2U23MRnR+HwfrzXXvIOayruLkkKFGnYXq3shQn p2NqWwUvt2rC2S4gz+sIeZvPVWVuHXB6argQxykjk/pP/pTEvwCyKvte/ftE7kw8aGTM YF7Y9XjHDsB1/LlRXPdi1M8uiRyoEw8fALkvAvPpgWnTOLpQnUEmjbuzQW5Yb5iufDBr wNUw== X-Gm-Message-State: ALoCoQlMBtzKNI+oyDs8cWhyCwOWD/qnAZy2RaAmFMntg7t9hnbvOVi8GfDmQDCp3CFF6sUsEU8k X-Received: by 10.182.19.164 with SMTP id g4mr9233921obe.21.1389622413824; Mon, 13 Jan 2014 06:13:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.11.194 with SMTP id s2ls21157qeb.22.gmail; Mon, 13 Jan 2014 06:13:33 -0800 (PST) X-Received: by 10.52.187.232 with SMTP id fv8mr1191641vdc.60.1389622413732; Mon, 13 Jan 2014 06:13:33 -0800 (PST) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id ug9si526753vcb.107.2014.01.13.06.13.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 06:13:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.172 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.172; Received: by mail-ve0-f172.google.com with SMTP id jw12so5234615veb.31 for ; Mon, 13 Jan 2014 06:13:33 -0800 (PST) X-Received: by 10.58.146.5 with SMTP id sy5mr1658842veb.43.1389622413579; Mon, 13 Jan 2014 06:13:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp130962ved; Mon, 13 Jan 2014 06:13:32 -0800 (PST) X-Received: by 10.180.109.107 with SMTP id hr11mr15418434wib.56.1389622412507; Mon, 13 Jan 2014 06:13:32 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id eu11si9971843wjd.120.2014.01.13.06.13.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 13 Jan 2014 06:13:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1W2iGS-0008PX-Ss; Mon, 13 Jan 2014 14:13:16 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , Michael Matz , Claudio Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christoffer Dall , Will Newton Subject: [PATCH v2 06/10] target-arm: A64: Add SIMD ZIP/UZP/TRN Date: Mon, 13 Jan 2014 14:13:12 +0000 Message-Id: <1389622396-32282-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389622396-32282-1-git-send-email-peter.maydell@linaro.org> References: <1389622396-32282-1-git-send-email-peter.maydell@linaro.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.172 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Matz Add support for the SIMD ZIP/UZIP/TRN instruction group (C3.6.3). Signed-off-by: Michael Matz [PMM: use new do_vec_get/set etc functions and generally update to new codebase standards; refactor to pull per-element loop outside switch] Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target-arm/translate-a64.c | 76 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index 3eae175..1c28c0f 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -4807,7 +4807,81 @@ static void disas_simd_tb(DisasContext *s, uint32_t insn) */ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) { - unsupported_encoding(s, insn); + int rd = extract32(insn, 0, 5); + int rn = extract32(insn, 5, 5); + int rm = extract32(insn, 16, 5); + int size = extract32(insn, 22, 2); + /* opc field bits [1:0] indicate ZIP/UZP/TRN; + * bit 2 indicates 1 vs 2 variant of the insn. + */ + int opcode = extract32(insn, 12, 2); + bool part = extract32(insn, 14, 1); + bool is_q = extract32(insn, 30, 1); + int esize = 8 << size; + int i, ofs; + int datasize = is_q ? 128 : 64; + int elements = datasize / esize; + TCGv_i64 tcg_res, tcg_resl, tcg_resh; + + if (opcode == 0 || (size == 3 && !is_q)) { + unallocated_encoding(s); + return; + } + + tcg_resl = tcg_const_i64(0); + tcg_resh = tcg_const_i64(0); + tcg_res = tcg_temp_new_i64(); + + for (i = 0; i < elements; i++) { + switch (opcode) { + case 1: /* UZP1/2 */ + { + int midpoint = elements / 2; + if (i < midpoint) { + read_vec_element(s, tcg_res, rn, 2 * i + part, size); + } else { + read_vec_element(s, tcg_res, rm, + 2 * (i - midpoint) + part, size); + } + break; + } + case 2: /* TRN1/2 */ + if (i & 1) { + read_vec_element(s, tcg_res, rm, (i & ~1) + part, size); + } else { + read_vec_element(s, tcg_res, rn, (i & ~1) + part, size); + } + break; + case 3: /* ZIP1/2 */ + { + int base = part * elements / 2; + if (i & 1) { + read_vec_element(s, tcg_res, rm, base + (i >> 1), size); + } else { + read_vec_element(s, tcg_res, rn, base + (i >> 1), size); + } + break; + } + default: + g_assert_not_reached(); + } + + ofs = i * esize; + if (ofs < 64) { + tcg_gen_shli_i64(tcg_res, tcg_res, ofs); + tcg_gen_or_i64(tcg_resl, tcg_resl, tcg_res); + } else { + tcg_gen_shli_i64(tcg_res, tcg_res, ofs - 64); + tcg_gen_or_i64(tcg_resh, tcg_resh, tcg_res); + } + } + + tcg_temp_free_i64(tcg_res); + + write_vec_element(s, tcg_resl, rd, 0, MO_64); + tcg_temp_free_i64(tcg_resl); + write_vec_element(s, tcg_resh, rd, 1, MO_64); + tcg_temp_free_i64(tcg_resh); } /* C3.6.4 AdvSIMD across lanes