From patchwork Tue Dec 8 18:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 339776 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3920419jai; Tue, 8 Dec 2020 10:20:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxvo7Oq2Ti5iQhx+m47SppLzrBxs+q71a58vT8A/bTKNEVjVWuTX4j/uhJI1Cn+yg55vcb X-Received: by 2002:a25:74d6:: with SMTP id p205mr31400660ybc.254.1607451615800; Tue, 08 Dec 2020 10:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607451615; cv=none; d=google.com; s=arc-20160816; b=YI3wUUHglEo/yRLt1EnKPkNFyZvkGTeuNHVYc57eexmLny72ECrlx/abNj8QmRgyZg MVU0DZ4WDgfV8O+vQ/PG5AtqDPRu2myyOKTKOVCCkPPb11iMxQJUhUWe+iD+48zlmh8M 1IPlD1omqd+ZihB8K2Hen826PrPvo83bm+MX6fv0+YH5yrjpCtfHfxG9Yt5NbZxx0H5V RqmMIZ46Z2QNennlWNC58KnhrnMkuT2gc8H2k/6EYecfcw2WGxJ56eR74tH1BeKEDxUl IsROWSjI+yeiLUvprUV3nhjv9XAp314KeD4ty9PcRbH5RnU8pA2lzE+rNIZ9TOaNa3Lx X2lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mHiA1C5Y7pkklfwKOXVU5WKjHSgV8PTwFN03Z8NX718=; b=wf64rcuq7POK9lZEhhR97/9aoyt3LjFBO80fc+Og6ZaKL1HzdoY1p/BuBARefctO1V 5YdoVTX7sPT9N5xR/mGXBZUXtv4HPNS1r8RqBZEWCMAozf6yC62T1gsumnVFQbdRek0g xsjErWpfCNbMJLF1wOlzibCdvdx9V/H8ZNtWqRcBDKtexMnBOF9yR7qeIg9LJy6KBCUd eHh6O/GngDmeZ3YehLKpOgwjpixuoHB+av5vhc9rnFwymLyr0tCoiMF71jPRiiI2WWNf eRuT/Y7tOiM5/2yRQGlbRIW/ZEUDYPh1cDr/EThiba3wJ4ek0TjCUb9/iiT2p2k4hrgz SpqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=W9L2BtUw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i9si1868055ybe.414.2020.12.08.10.20.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Dec 2020 10:20:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=W9L2BtUw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmhax-0007XG-9P for patch@linaro.org; Tue, 08 Dec 2020 13:20:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmhJK-0008D1-Rb for qemu-devel@nongnu.org; Tue, 08 Dec 2020 13:02:02 -0500 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:40901) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmhJI-0006Qa-LM for qemu-devel@nongnu.org; Tue, 08 Dec 2020 13:02:02 -0500 Received: by mail-ot1-x341.google.com with SMTP id j12so16590884ota.7 for ; Tue, 08 Dec 2020 10:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mHiA1C5Y7pkklfwKOXVU5WKjHSgV8PTwFN03Z8NX718=; b=W9L2BtUwbPBh+M7M4z9vPNjQJEHsvsMiTRbfMW6ZMCjt8z2gkA+NWuvWo99VScU7ZZ QBGFNfFZwnnclx2nxa/s8mUXb6xIwuVzWdWCuowozjWHBa4NGZ1VeVLR2htv/h2XzPCs E2EpEPSb5jxhMuhUhLcRmb8Hfqer+q6SmZI9yS5EJk2zu5mM87+3FfDLbpwuyqUehk16 VTR8rCnhtAxx5yod47lN96JNgfStlSRXuQ10GmJaR3faLccF1SFlYMVfjU7YN7x32scN IzGNoSF79oxpY+br5hLdd7EQhEhomMf20VLljvk9gmX8QeUeoqYNpw9tIqSEzdEvXt+l 2Ebg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mHiA1C5Y7pkklfwKOXVU5WKjHSgV8PTwFN03Z8NX718=; b=S2NeDHfbTydEroxfCh4seceM+uTUihI2SmSqNAg26Sbau3dGOnIrq0EOLodgPGl5pp cL8f1kx/X1fEethkB407ESvoWxYWocQsTjEuJAcOHBdO+9+DbV94UYZCrARpDoDuXgWY Uis58KnOmje/FxQS4Ub+oymgoJYNsPNX7mkfTmomMz8/Y7W9WVlEQ6JiXHAUGF1PX5zF 8trjmsRTPjch4jSqsZpjls7mDR/9n6thcyteIbnX4ltdD4MuX4AJkUoHjTkAgsMZlXEh ps9XpxPJ47XncBX595DESQtCAOW6ypFY9wZayFp3Kp1RkIn7K28ZPhpR6x/tXS26xAJ5 N8IA== X-Gm-Message-State: AOAM531IGdM9VnqWQVRLhF2nm0V0ZrHrp/A9Gh6fkGVcWFUkAYe6QmuQ y8OuhyBwNwCRHtNqN+uTrlIbGV70+0iZgnRP X-Received: by 2002:a05:6830:1610:: with SMTP id g16mr8739416otr.345.1607450519413; Tue, 08 Dec 2020 10:01:59 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id k20sm3886805oig.35.2020.12.08.10.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 10:01:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 21/24] target/arm: Enforce alignment for aa64 vector LDn/STn (multiple) Date: Tue, 8 Dec 2020 12:01:15 -0600 Message-Id: <20201208180118.157911-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201208180118.157911-1-richard.henderson@linaro.org> References: <20201208180118.157911-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::341; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x341.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4395721446..93065242cc 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -3606,7 +3606,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) bool is_postidx = extract32(insn, 23, 1); bool is_q = extract32(insn, 30, 1); TCGv_i64 clean_addr, tcg_rn, tcg_ebytes; - MemOp endian = s->be_data; + MemOp endian, align, mop; int total; /* total bytes */ int elements; /* elements per vector */ @@ -3674,6 +3674,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) } /* For our purposes, bytes are always little-endian. */ + endian = s->be_data; if (size == 0) { endian = MO_LE; } @@ -3692,11 +3693,17 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) * Consecutive little-endian elements from a single register * can be promoted to a larger little-endian operation. */ + align = MO_ALIGN; if (selem == 1 && endian == MO_LE) { + align = pow2_align(size); size = 3; } - elements = (is_q ? 16 : 8) >> size; + if (!s->align_mem) { + align = 0; + } + mop = endian | size | align; + elements = (is_q ? 16 : 8) >> size; tcg_ebytes = tcg_const_i64(1 << size); for (r = 0; r < rpt; r++) { int e; @@ -3705,9 +3712,9 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) for (xs = 0; xs < selem; xs++) { int tt = (rt + r + xs) % 32; if (is_store) { - do_vec_st(s, tt, e, clean_addr, size | endian); + do_vec_st(s, tt, e, clean_addr, mop); } else { - do_vec_ld(s, tt, e, clean_addr, size | endian); + do_vec_ld(s, tt, e, clean_addr, mop); } tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); }