From patchwork Wed May 22 22:28:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164903 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1413110ili; Wed, 22 May 2019 15:31:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3oHn6MecA/0Obe+171sop5SMC2j/i0v2nUB3U6IthYlVQU9K3Mv1EH/rHsO2OfCda8lqQ X-Received: by 2002:a17:906:90d6:: with SMTP id v22mr62124564ejw.183.1558564281354; Wed, 22 May 2019 15:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558564281; cv=none; d=google.com; s=arc-20160816; b=PmvwcpKiTCRRYWuLWyhQPey7N2FJVDSRE5HTKnAtM+3TDgyGsSd+hhNKZb81Y2xFdA h7Gk2FWGnusT8VRdxyAiL85IDKV8xdjQLMw9RswiGCjN+NOa/AZe56nf4lU0QYe4ghJN tujTp+sNq5Q6wFFHVrr/b4P0y34wzud7AzOHQ9qnpMdBnit9yXpzjLzARvONRBXtl3Ke D1LaMbvqAz5FDVJ2xx5r9LMrlt+/4ETC+zMT/x6C1jaYZ7oaqm8RfQ0PzsaoYYtoLati yw/RSP7asGGeAk549GF18BxmST/qRuuFvxeHIhnkcWlmcch+bzgNRo8PALacFjTts9GI 0xmg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=oqAGJXCcrmzUdmSG3sZCijkOSbKbEdDFHwT2UnQhICM=; b=i4wYHgfC7xxAstH1o8mY4I/ya0bQwUUiIMNbS0UgRxX7kOl3y5ODlafKsfRYHHCIqT VwDIvFgp0MkJVSNLlSuGhcBeUOT4LomMP2eDYW5Z6fiYpjQtfNTEH6vmHc5DFXpl9LR1 8wCgPomC6D0n7JANsKWtl8LOe8ZtXGxCSIgYm9E+7tMSJAnE9HAAkyfz4MD5xSRMYbRA Lcn7rjs4YMYff+z+MkB5A9E+b3ZRnVgPGEwU+h8Qvq8hmqTlVioIlDxsbutvxoLqS8Ia ndnJN0tlnXvBc4pG1N0KggQc9cGK+tUzOxSnHQ/oPsFLMhhy9ckwpjruO5hebMb73aqZ BpiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LdTUrcB0; 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 j38si4512463eda.260.2019.05.22.15.31.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2019 15:31:21 -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=LdTUrcB0; 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 ([127.0.0.1]:52537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZlY-0005gq-81 for patch@linaro.org; Wed, 22 May 2019 18:31:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZin-0002vo-Pq for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTZil-0007Ik-UE for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:29 -0400 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]:38467) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTZil-0007I3-Pi for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:27 -0400 Received: by mail-yb1-xb2e.google.com with SMTP id x7so1498465ybg.5 for ; Wed, 22 May 2019 15:28:27 -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; bh=oqAGJXCcrmzUdmSG3sZCijkOSbKbEdDFHwT2UnQhICM=; b=LdTUrcB0dW7oQ5OSz+p27Rw/40IUzZ3kspAb9Bb6GZdmumh4WAMq8CbMTfus2JQ0xy tAbAaNlcRSpLTy9OpQFsl/uXOcrSsFDB+UCWUAyKyDQLrOVblP3ICU44EHQW+cx29nBq xNo5yzrVaqa7jMuuMA2adv6Sy9ejThl+A7eeGc4HD9nvdwE4+MWXd9q9XdCUGSbuP67v U589o1ETHPPYizq2ieyJMSXc/MmzRYPS1glL7n/bBTULF4a34CF6JCeAYQVOrPMma0vq HSl9N/4OAUTCQsKzeei0e5jc5J+l2QYzc52hQwfbinDI3CzWpJXsmHg0keLiZaRKao1N MNNw== 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; bh=oqAGJXCcrmzUdmSG3sZCijkOSbKbEdDFHwT2UnQhICM=; b=Mgkijv1uB7qI1XYhEB05JQADxx2Ck8NYlocaOSdbWMOnYflI8kwLQzWRIMFUG12sJM i5V2Kp+smcHzzNCymTGpqii2vHNqBXh0Es3FiPjKzhXN1HtJx8fkpa0GN1EJlobl03YA rOFajLnf8QJQrBydHGxDsK7OZkLlvn/DaEvhviQ2nTkVd6z3StKwPf/IpNjjA9O9WeWh h+5thi0jPE5XHwdKKpN+q5xY1oa6X4eP4JL7wkpLKbBhzkR18PICgfKD0M3qdsMTlMzS 1W47lJrocI2MlpO1squL4h7SsLPc5pWKjTksOO2ZnZhHZ6vG07RFqk4LIQ30gR2DEDvV Lm0Q== X-Gm-Message-State: APjAAAVS25y2MulzFUcPmtrsvLcyYras9kD9IYknTSHXiI/rb3/4hK3/ r03V8cB7REKeb99Snnn0p/28Cr7uAQo= X-Received: by 2002:a25:7711:: with SMTP id s17mr16169011ybc.327.1558564106446; Wed, 22 May 2019 15:28:26 -0700 (PDT) Received: from localhost.localdomain ([71.46.56.17]) by smtp.gmail.com with ESMTPSA id q11sm2276453ywg.7.2019.05.22.15.28.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 15:28:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 22 May 2019 18:28:07 -0400 Message-Id: <20190522222821.23850-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522222821.23850-1-richard.henderson@linaro.org> References: <20190522222821.23850-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b2e Subject: [Qemu-devel] [PULL 02/16] tcg: Fix missing checks and clears in tcg_gen_gvec_dup_mem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The paths through tcg_gen_dup_mem_vec and through MO_128 were missing the check_size_align. The path through MO_128 was also missing the expand_clr. This last was not visible because the only user is ARM SVE, which would set oprsz == maxsz, and not require the clear. Fix by adding the check_size_align and using do_dup directly instead of duplicating the check in tcg_gen_gvec_dup_{i32,i64}. Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 48 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 338ddd9d9e..bbf70e3cd9 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1446,36 +1446,35 @@ void tcg_gen_gvec_dup_i64(unsigned vece, uint32_t dofs, uint32_t oprsz, void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, uint32_t oprsz, uint32_t maxsz) { + check_size_align(oprsz, maxsz, dofs); if (vece <= MO_64) { - TCGType type = choose_vector_type(0, vece, oprsz, 0); + TCGType type = choose_vector_type(NULL, vece, oprsz, 0); if (type != 0) { TCGv_vec t_vec = tcg_temp_new_vec(type); tcg_gen_dup_mem_vec(vece, t_vec, cpu_env, aofs); do_dup_store(type, dofs, oprsz, maxsz, t_vec); tcg_temp_free_vec(t_vec); - return; + } else if (vece <= MO_32) { + TCGv_i32 in = tcg_temp_new_i32(); + switch (vece) { + case MO_8: + tcg_gen_ld8u_i32(in, cpu_env, aofs); + break; + case MO_16: + tcg_gen_ld16u_i32(in, cpu_env, aofs); + break; + default: + tcg_gen_ld_i32(in, cpu_env, aofs); + break; + } + do_dup(vece, dofs, oprsz, maxsz, in, NULL, 0); + tcg_temp_free_i32(in); + } else { + TCGv_i64 in = tcg_temp_new_i64(); + tcg_gen_ld_i64(in, cpu_env, aofs); + do_dup(vece, dofs, oprsz, maxsz, NULL, in, 0); + tcg_temp_free_i64(in); } - } - if (vece <= MO_32) { - TCGv_i32 in = tcg_temp_new_i32(); - switch (vece) { - case MO_8: - tcg_gen_ld8u_i32(in, cpu_env, aofs); - break; - case MO_16: - tcg_gen_ld16u_i32(in, cpu_env, aofs); - break; - case MO_32: - tcg_gen_ld_i32(in, cpu_env, aofs); - break; - } - tcg_gen_gvec_dup_i32(vece, dofs, oprsz, maxsz, in); - tcg_temp_free_i32(in); - } else if (vece == MO_64) { - TCGv_i64 in = tcg_temp_new_i64(); - tcg_gen_ld_i64(in, cpu_env, aofs); - tcg_gen_gvec_dup_i64(MO_64, dofs, oprsz, maxsz, in); - tcg_temp_free_i64(in); } else { /* 128-bit duplicate. */ /* ??? Dup to 256-bit vector. */ @@ -1504,6 +1503,9 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs, tcg_temp_free_i64(in0); tcg_temp_free_i64(in1); } + if (oprsz < maxsz) { + expand_clr(dofs + oprsz, maxsz - oprsz); + } } }