From patchwork Mon Apr 19 20:22:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 424055 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp3058528jaf; Mon, 19 Apr 2021 14:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/rlYGkZpUrrrwJb5pS9KL7yOHzP+R84VkQgzgb9r8ARhCehuchUiOmpeqPawg9ur1cwHa X-Received: by 2002:a05:6e02:12e1:: with SMTP id l1mr19303841iln.262.1618866419825; Mon, 19 Apr 2021 14:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618866419; cv=none; d=google.com; s=arc-20160816; b=uBnfOUtWM/5gRNrei5JXh8QX/m+9C4TX5jtwxskHGV0j8lJotH0Z5rO/QsaphRZnjG 6x7q/45+D3gIu91KtxhEWKinQg33bsMbc5IbaH0zzVfp3jm1R3aRVwwFe3EK7J2omjwK byc8Nj2pJGbgc7SuFQB7e0tcWmt2R32nlguBWHMeADEsIJjeIIzgzSU1tLTE/GW2OysJ +z2jnHJ1EqnDTJm62difCG0ykaw6IwpzZDWNOIDuFdXfUwEjQtSG+zYAgNV0TKLR2FGf LWuNIwtzUIkYwdEhI3AKOzNt0WsZmNLWijOpeFlwhs7GBH5WWpfBc2sPdIwIfNbQpcNf 4cmg== 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=oROkq8j4qfMtXcJP6tdXRKN1rqEpL50c3TD7tut7lv8=; b=kZeSMexw4tPtYaQE2m8N297dSiwqTtmCCOdQPQ/nQ1Z9dSUBvmFKupS4/cHiZSk7jS 3FKZj9z9VxsiFBGn2mTsb1JrLoUa8HnD5N9IIySzrELJpFg/v1+jJE118FdfidlkhaDj xwSox21tOk2kngenr/DguUuTbwN5814A5AFORTmawl9UebxbWmrhe/ObgqSmG9FvvmR0 VNsO+TZgC24gez9KiVruhAb9R8sjJz41tQIJz/hkEZ/n8wz5dcAfl/DDecb9yOYBvJLE 3dwWBJB/zlgw4x3zYQes/YPr0H08D2ww7NoN8Qt6U1RAmzFrH8/rHh8C2wiVmKrB57x8 /VqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="iz+/xBzL"; 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 r21si8105128jab.74.2021.04.19.14.06.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Apr 2021 14:06:59 -0700 (PDT) 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="iz+/xBzL"; 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]:48284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYb6g-0002Gm-J2 for patch@linaro.org; Mon, 19 Apr 2021 17:06:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYaR0-00083l-E4 for qemu-devel@nongnu.org; Mon, 19 Apr 2021 16:23:54 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:36667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYaQy-0002om-ME for qemu-devel@nongnu.org; Mon, 19 Apr 2021 16:23:54 -0400 Received: by mail-qt1-x835.google.com with SMTP id h7so27138479qtx.3 for ; Mon, 19 Apr 2021 13:23:52 -0700 (PDT) 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=oROkq8j4qfMtXcJP6tdXRKN1rqEpL50c3TD7tut7lv8=; b=iz+/xBzL0gxiLMfctUdsKP/t7Di+m1KxYxoNLsNsqKsQZj5QopV9G2gVNzyiw5s/fO M6zGLTK9vchy872BXVyCcNWdhtMBcPbJYCx6HcQfQUvocNGonC1GwvijNbeFEdtJalX/ uoS5/ui/H0tB+B9NVRO+D6p7UiQ7k7ty9ZikymRHRlofQaveD25Rf54ju8ZTw+yCoAWX YdH7llB+Hnh3CnGB37+KoYOVChbs7k8Ru43C3s9F20/WzBeqjT1A34nNYRogSmuujIAm JDYIbeYV8ohilyCkfodi/NJaSRs9J+LRjVKFyDT3F3wTPs4AOFhSv3ikyoCD/3iemQae ywBA== 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=oROkq8j4qfMtXcJP6tdXRKN1rqEpL50c3TD7tut7lv8=; b=oXHmswD6FTqqjDTe++zH3FHRsO/3MkV0IWsGlxxpHIaQL+lMt40iMJHeYzmrSxZaBq n1/umZNZ/fesq9pj3JvUOZa8PaRjA7ux1jE5FD5sadrojQ60pU2v/o2F0gIlNVMZPDep 1J+eQrtVduRAgWKREhyBuChKgjHb5RFNbHzw8M0M9L3T6S0/lCGqtYSUXwdG+BfehYf9 Ym6ReN7BU+ZfkDw938xxMrFc5BD6lixJAX0YZs2D6mXGGj3s1xxBWocb65tbqEi/4+Vq r0dGg7pAfqexHaOnZknKR1zWf28UkATrU5A49v8PLkhCl5J7qj/xeAFMjWm83R5sRNS+ sfxA== X-Gm-Message-State: AOAM532d/fhjMxOfPD8eHKTF06iG5IxEo/cG56oXkX8iomJ2by/h4zZ+ YxR2GWTTKu4N3ThUI690sFdPxIoaguw0dNzj X-Received: by 2002:a05:622a:52:: with SMTP id y18mr13387646qtw.216.1618863831812; Mon, 19 Apr 2021 13:23:51 -0700 (PDT) Received: from localhost.localdomain ([2607:fb90:80c7:aba4:3594:91a:8889:c77a]) by smtp.gmail.com with ESMTPSA id c23sm10007835qtm.46.2021.04.19.13.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 13:23:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 29/31] target/arm: Enforce alignment for aa64 vector LDn/STn (multiple) Date: Mon, 19 Apr 2021 13:22:55 -0700 Message-Id: <20210419202257.161730-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210419202257.161730-1-richard.henderson@linaro.org> References: <20210419202257.161730-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x835.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=ham 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 , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d3bda16ecd..2a82dbbd6d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -3635,7 +3635,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 */ @@ -3703,6 +3703,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; } @@ -3721,11 +3722,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; @@ -3734,9 +3741,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); }