From patchwork Fri Jun 4 20:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 454162 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp726917jae; Fri, 4 Jun 2021 13:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz59s6XNPKLY0yIGCehTLY3MT82pfqy1WjECTeq1i9MSvA9HvysK3qhpjABCpR0OF4/Dz6m X-Received: by 2002:a92:dc10:: with SMTP id t16mr5081542iln.75.1622837733793; Fri, 04 Jun 2021 13:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622837733; cv=none; d=google.com; s=arc-20160816; b=Xazhndp8ztu2bkBN0kzZLyayXszlawVIvfzKE6j6T9BD3YDPa8eBzeAvd4+UHeh8Jy TlfHQM8h9IiDKM0JMwcvwDljkVyqkGlQH85HwBiqkly8omOMNbP13I4aUJMURJXn6qCR 2ToqHHJwVzB9QvcKK8wp2Myp37SkK5I9LayF39mY0b+swnU+JdE/wF0VO+7xOlV70Rcs 603x69zDU6fNAu5Z2sq7C2yHanoHiHqJwP7qE+U4d2jmpA/JBRZX7o/wx89Q6gOB1D8i uQivMRmTkYSYB75YBsHHSx3/8erIb3S1FAkmu3QyWE82LyAubB4O0eUjfEK9v4sQ4d40 J/uQ== 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=R9nwVKNOQ71e/mfsdQAKgcoJg5Q6skMHW8VAyFqbJYY=; b=USff9YW6cZm01gHcUKTsMRk+AnOypYfgL3k1H0ZTnuKbLo7mlmM7Qv7RrSLp3+5kqk IeH5X4ynbP6vM/CwvAhhi94C+FVg8EnZtgZmdFkjwjyTPDNiuY+8uUlM4GR0ih7Zn87I IQNkTOmuwaI+nCyvblBHldx8FnRaDr6BNIx78wvAVshRsRiqw9T+yw9hHG1y5pNZ1Bvv U3tAaw60d46HUyjN4ovq5cJ5w3BxVW6PVbMH3kLFtj5QUNPBGGIZjtI+g5Aap26ksXPd +cxoID+kqY4ejrVN/di2tJ+/LOGQKQ6LGSUdw9PJqyKrlTsNA3W4oj3pMQHaVStyIU6Q cyHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x1vhqERh; 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=pass (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 b25si6862817ioh.80.2021.06.04.13.15.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jun 2021 13:15:33 -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=pass header.i=@linaro.org header.s=google header.b=x1vhqERh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpGE9-0002ws-6z for patch@linaro.org; Fri, 04 Jun 2021 16:15:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpGB0-0005i9-S9 for qemu-devel@nongnu.org; Fri, 04 Jun 2021 16:12:18 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:33712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpGAw-0005IX-Cn for qemu-devel@nongnu.org; Fri, 04 Jun 2021 16:12:18 -0400 Received: by mail-pj1-x1031.google.com with SMTP id k22-20020a17090aef16b0290163512accedso5708572pjz.0 for ; Fri, 04 Jun 2021 13:12:14 -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=R9nwVKNOQ71e/mfsdQAKgcoJg5Q6skMHW8VAyFqbJYY=; b=x1vhqERhq7PJubItn3B/7lTJktovQErHCSTNSSKlHKwvwLQMqZzhsQZ9fl+HbGOeOr D+XWdQoRQw0fNhgHl9Ddd+EwHm1h9Y1fy3ZoLINFvK67lVky/vnN50ylsMY4rm5jp9DJ 22OA+ZnJOi56SAQELdBT5DQ/JhpbY14QC0Io3K4raPxO5j83o16UQ9vF/IGbf9Homn6X NrLXtIEagmIYt2EGgrweZmoRsfXNvePJuuIH2LkxGU6RwQywmw+YAhOh3kZhKD7H5+IH OUKqzUknufLLaEfFX3PD6KZ99qS+1di1Ijlxay9c1OKXMAPPqRk4LHtKa6Bw6Ec+HBg0 i/LA== 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=R9nwVKNOQ71e/mfsdQAKgcoJg5Q6skMHW8VAyFqbJYY=; b=cpvyX21rfc3+LKHAxRA1uamxkFibRFIpoYqyUGP/1+BcN/Jb+ePXT2zZOjJvMPidz/ m1youncUT4NtH0DFY4TYg95ydfIVXFJ6FIF9dlPjewhhwI0bd3NTlkGuAF47S3xPO896 pLz+/lACgf84/wkBsqEUxzCZRfQSImAgrJYxzlSRFOlK7nuLwdhLJIZFEuKMG4JiQvKb cRYX47yvJeMGrecBhmnwVbkLRJgg8QaTja0KRX0csxud9DppmEArqksswRRN8laOGqOe omLGo0tgiJhoqVRFDpVrfnh+nsp33cQw9J9sWCBvalm10OBYUdlVrOaViowUggOX63OV HMZw== X-Gm-Message-State: AOAM531krEHGiiFf6TFMpwInApuANxY9vl1hl9HDJyUQv4XrqaQ5672T dcKu8xSweRyqMNYA1zYjm5FN5eUPIFDdjA== X-Received: by 2002:a17:90b:1991:: with SMTP id mv17mr706895pjb.109.1622837533281; Fri, 04 Jun 2021 13:12:13 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id a129sm2422599pfa.118.2021.06.04.13.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 13:12:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/15] tcg/arm: Implement tcg_out_mov for vector types Date: Fri, 4 Jun 2021 13:11:59 -0700 Message-Id: <20210604201210.920136-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210604201210.920136-1-richard.henderson@linaro.org> References: <20210604201210.920136-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 52 +++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index c6cfb83308..a802d4b585 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -173,6 +173,8 @@ typedef enum { /* Otherwise the assembler uses mov r0,r0 */ INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, + INSN_VORR = 0xf2200110, + INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ } ARMInsn; @@ -1106,6 +1108,25 @@ static uint32_t encode_vd(TCGReg rd) return (extract32(rd, 3, 1) << 22) | (extract32(rd, 0, 3) << 13); } +static uint32_t encode_vn(TCGReg rn) +{ + tcg_debug_assert(rn >= TCG_REG_Q0); + return (extract32(rn, 3, 1) << 7) | (extract32(rn, 0, 3) << 17); +} + +static uint32_t encode_vm(TCGReg rm) +{ + tcg_debug_assert(rm >= TCG_REG_Q0); + return (extract32(rm, 3, 1) << 5) | (extract32(rm, 0, 3) << 1); +} + +static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, + TCGReg d, TCGReg n, TCGReg m) +{ + tcg_out32(s, insn | (vece << 20) | (q << 6) | + encode_vd(d) | encode_vn(n) | encode_vm(m)); +} + static void tcg_out_vldst(TCGContext *s, ARMInsn insn, TCGReg rd, TCGReg rn, int offset) { @@ -2276,16 +2297,35 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, return false; } -static inline bool tcg_out_mov(TCGContext *s, TCGType type, - TCGReg ret, TCGReg arg) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { - tcg_out_mov_reg(s, COND_AL, ret, arg); - return true; + if (ret == arg) { + return true; + } + switch (type) { + case TCG_TYPE_I32: + if (ret < TCG_REG_Q0 && arg < TCG_REG_Q0) { + tcg_out_mov_reg(s, COND_AL, ret, arg); + return true; + } + return false; + + case TCG_TYPE_V64: + case TCG_TYPE_V128: + /* "VMOV D,N" is an alias for "VORR D,N,N". */ + tcg_out_vreg3(s, INSN_VORR, type - TCG_TYPE_V64, 0, ret, arg, arg); + return true; + + default: + g_assert_not_reached(); + } } -static inline void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long arg) +static void tcg_out_movi(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long arg) { + tcg_debug_assert(type == TCG_TYPE_I32); + tcg_debug_assert(ret < TCG_REG_Q0); tcg_out_movi32(s, COND_AL, ret, arg); }