From patchwork Fri Jun 4 20:11:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 454156 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp725492jae; Fri, 4 Jun 2021 13:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDMwkoiO6eay209b/6ki5J32j0c8u85PM+WfCBbSuW3B8goDQYYC71dZv0oPfJfHq2udZI X-Received: by 2002:a05:6638:294:: with SMTP id c20mr5503101jaq.86.1622837568695; Fri, 04 Jun 2021 13:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622837568; cv=none; d=google.com; s=arc-20160816; b=RvOvj8lRNnL/CeiqelZCpBpfmM3cx6mmZbPStiuJjSTRwzEaa3qympvIZ2bBH5N4EF dKi9mG0Kmy02SSnYmvoiGFpPcGuFZxdtbyvP6jNr8z0EQ5UNSDzt65IZEqn61H9l62Ha 0a33/LQFyJgNny5zzjqAdcdxfOc3O6rn0tTEbBdUHFgeswsN8ayl+xHBBFw5GkbMbtQ+ SWfRbjvZTi/dmRS3Y8w5rPzO09VwPkli9B3/YpRhXUQcSK++FTOsrT28XMS0gLlTDsKa aFpvcA8ly51Wbs7f9ly7fnbHE/0ajVx+5Gc8WnDSWKCX0HQu6yDm5e1eQ9DJiL3AOa0D QOjQ== 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=7WBmKaaDBnqx8/b/uuVnTF9efjpwsBpvtLLAQjoYELA=; b=e5FJXEfhaA68pU+sCyfreZdCnaPkRCFX6IX+I2jlRjS+yc6riTZjV1cT+khC4X31l8 D0Ezb1nRAVYHVget0A/NgXurP9t6oNIYmre8LFQIwNTnpqPvRYDW/WmxcGqZ4ewZZ3lR ghGdqxhAwapHpuszTmUHWuRcOjVbHKscL4DTPENi1td6AhoNuHDjtySIRVzQVxTtL9z3 XCAHd9Lr27Oa/YAEv/9iry/yP8J/Q99rn7L4HtXQ+y/wysrdpRc0YxbAL0uo+CM9gjjQ e5Y7pKNnf8EmIjU8I6fLDdQp7HOLwBw3KcCOotQisAe8fslkMvZSTdEqCA+mqTZdyK4P k5ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XdEORA1R; 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 f16si6944218iox.100.2021.06.04.13.12.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jun 2021 13:12:48 -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=XdEORA1R; 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]:46184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpGBU-0005gQ-5n for patch@linaro.org; Fri, 04 Jun 2021 16:12:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpGAy-0005cn-Hf for qemu-devel@nongnu.org; Fri, 04 Jun 2021 16:12:16 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:43941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpGAv-0005IR-Vq for qemu-devel@nongnu.org; Fri, 04 Jun 2021 16:12:16 -0400 Received: by mail-pf1-x431.google.com with SMTP id t28so8234733pfg.10 for ; Fri, 04 Jun 2021 13:12:13 -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=7WBmKaaDBnqx8/b/uuVnTF9efjpwsBpvtLLAQjoYELA=; b=XdEORA1RyO62HcVC+8uicyaXd2SRLNJrFk/ZMpJcOJ6a32JoDtuQaX8/gljsb/CqMl DNZf/kv9vk0E4VVhNpZsdu2LTHets3gdRhfvfZSEG24mk88ZsJNXv0OkQRFd3ePazyGg Br0vcw94cMCDM2EtWyReNxgtfEcfCV6gBHaJJ+xapSpKOceCQb/fmAgkovdE6SeuJp2G ixgeSshRFPzQZzK1+xYROVrlooEPFCkeZ/TNTGXop7/nIHgxNDYSmJRNw9uqdfv9F4Y/ nsse8DNRODswdX2i0sWpqeTaa36RIev7pKtrJzBPFbzCx6Tb5QSrbV6cQC4trxkNEQ1E qvBQ== 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=7WBmKaaDBnqx8/b/uuVnTF9efjpwsBpvtLLAQjoYELA=; b=GVfqKeuaOtjoVhp8NLUvs7y6Y/Se0Uqxo2afs5rzcI9xyHnULEzKWTD5S3eQKgSdJx I9uk0i/0T25E1wlOyaRBvuMuQdDIv8LpbT8SDpGHCm2c3ITCf9wT8PJc6M99D0qG4pJp 1Aiy/N1fkb8C1OM5f8atP4ZyJWAfIpya5neHVC2KMoJHdgCQ5c66G+eWJJhj3RkjOcYf nesr7YBGGNltBWElCQsaLpHBvakNnex2bU2kJPd6sl1jl8Avx0xyyWSGzqIpgzaGhysh 2nsdvZ6o9FgGgm9q8Da0JSZQNPfOvt9PKJAr/Yb5isk4xL7sTecO8+IblkQ2ebWtspc5 oH+g== X-Gm-Message-State: AOAM533SHWniYZtOkGEdbM4hWLsoEAO4+D5wJw/2dlnr0AweBcPDLdge tDZa7VRyVqODZtKLQu7PHp/HoLyN3C9w0g== X-Received: by 2002:a65:6291:: with SMTP id f17mr6560512pgv.280.1622837532677; Fri, 04 Jun 2021 13:12:12 -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:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/15] tcg/arm: Implement tcg_out_ld/st for vector types Date: Fri, 4 Jun 2021 13:11:58 -0700 Message-Id: <20210604201210.920136-4-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::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 | 70 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 4770d0c537..c6cfb83308 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -172,6 +172,9 @@ typedef enum { INSN_NOP_v6k = 0xe320f000, /* Otherwise the assembler uses mov r0,r0 */ INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, + + INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ + INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ } ARMInsn; #define INSN_NOP (use_armv7_instructions ? INSN_NOP_v6k : INSN_NOP_v4) @@ -1093,6 +1096,33 @@ static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, } } +/* + * Note that TCGReg references Q-registers. + * Q-regno = 2 * D-regno, so shift left by 1 whlie inserting. + */ +static uint32_t encode_vd(TCGReg rd) +{ + tcg_debug_assert(rd >= TCG_REG_Q0); + return (extract32(rd, 3, 1) << 22) | (extract32(rd, 0, 3) << 13); +} + +static void tcg_out_vldst(TCGContext *s, ARMInsn insn, + TCGReg rd, TCGReg rn, int offset) +{ + if (offset != 0) { + if (check_fit_imm(offset) || check_fit_imm(-offset)) { + tcg_out_dat_rIN(s, COND_AL, ARITH_ADD, ARITH_SUB, + TCG_REG_TMP, rn, offset, true); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, offset); + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, + TCG_REG_TMP, TCG_REG_TMP, rn, 0); + } + rn = TCG_REG_TMP; + } + tcg_out32(s, insn | (rn << 16) | encode_vd(rd) | 0xf); +} + #ifdef CONFIG_SOFTMMU #include "../tcg-ldst.c.inc" @@ -2200,16 +2230,44 @@ static void tcg_target_init(TCGContext *s) tcg_regset_set_reg(s->reserved_regs, TCG_VEC_TMP); } -static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, - TCGReg arg1, intptr_t arg2) +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, + TCGReg arg1, intptr_t arg2) { - tcg_out_ld32u(s, COND_AL, arg, arg1, arg2); + switch (type) { + case TCG_TYPE_I32: + tcg_out_ld32u(s, COND_AL, arg, arg1, arg2); + return; + case TCG_TYPE_V64: + /* regs 1; size 8; align 8 */ + tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2); + return; + case TCG_TYPE_V128: + /* regs 2; size 8; align 16 */ + tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2); + return; + default: + g_assert_not_reached(); + } } -static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, - TCGReg arg1, intptr_t arg2) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, + TCGReg arg1, intptr_t arg2) { - tcg_out_st32(s, COND_AL, arg, arg1, arg2); + switch (type) { + case TCG_TYPE_I32: + tcg_out_st32(s, COND_AL, arg, arg1, arg2); + return; + case TCG_TYPE_V64: + /* regs 1; size 8; align 8 */ + tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2); + return; + case TCG_TYPE_V128: + /* regs 2; size 8; align 16 */ + tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2); + return; + default: + g_assert_not_reached(); + } } static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,