From patchwork Thu Dec 24 22:45:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351930 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7330661jai; Thu, 24 Dec 2020 14:46:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8bJt6lj3/h+Ji/gYZsTAUIwW967YWTAZbDnNcM+NP+JiNimy98FqkaRUnNS4CO7s5S0Ap X-Received: by 2002:a25:74cc:: with SMTP id p195mr44442679ybc.325.1608849960543; Thu, 24 Dec 2020 14:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608849960; cv=none; d=google.com; s=arc-20160816; b=ZUjhOX/aQzkIbBSRyEVzZM9uOKVRgRJd5AUB8lR1EYEOcSqNEN9vRLk+Eong6N7nOg goIne0FxC2SKEnl+kFgfOtqwmAUngt+3FJVHFd17RVAbrbsEuJcMJ8BEgyOWs/DoL8um K8EkwMDdXnGYN4ODdC/oasu0j9pq6Od4eCIhwe+wM7bzIdiXFBJysFVU3vEAk/nBFzuh ThP8oJ3isG0y0+TPfo5o19oRvejDUGmSIvvfg+SNzBLYfMn8bebpw6xYUUnW2u95mJKf owNNdhrPoxZoaTYQixgZJHuBdhqdPGOfpHg9oEJEVBnAstjVaTvo1Ma5ApVl7ajWJHIW u9CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=OWsi1oZkXFkl2HSGRxhK8dZo5MLFFb2OcVQXedsQz9I=; b=lWnGehXcM66b0o1SDSNo7bSeqzlPKpCKjgifBOZgESozJPgTQWv/Cn1lAxO1MQ55rl ZvY+TpMYQt7phGIpaMBMiww0yA4uXhK65kLerK5EF2WJMB5w4UrbRS57yQrsASx83339 Rdr9ghrjYgkhsQ2BF1ANLSiAMNdZinzl7Hti3oyUj4yagQ6MkzPjcmO/ua3vFv/gBqjA POEYYnUADm04gxOpYSDvUSSXd5kS5kKjYaOuznefCNLEm4ZzWe3RoHJ6Flcxw0IZOrJp ADZPNqeImp1r2jJV5VCvYipVUT6bhcIQz06PHZh8G6vWpVgFltxH1JzLn7Javvj5zcsF 2kAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=okbSTOxa; 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 b12si22396470ybr.187.2020.12.24.14.46.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:46:00 -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=pass header.i=@linaro.org header.s=google header.b=okbSTOxa; 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]:55844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZMt-0001vM-VP for patch@linaro.org; Thu, 24 Dec 2020 17:45:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMH-0001po-V4 for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:22 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:46735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZME-0008HV-Nr for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:21 -0500 Received: by mail-pl1-x62c.google.com with SMTP id v3so1798794plz.13 for ; Thu, 24 Dec 2020 14:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OWsi1oZkXFkl2HSGRxhK8dZo5MLFFb2OcVQXedsQz9I=; b=okbSTOxa5ZmPk/G78i4BYxJ3s3vZXiwruRP+oFN6bhRyL0KLmO7D23b4rwUh57wauf Gkuvo039eIUmkHhtrzKz4wGrMdjaKQ9gvH+RD0E5y4B7tvRwnQaNa06wcQDoO83aBCaB iAmBQU0v3nKezGqjNbRHRwdLwSTNMkkY0TLbZ2f/bTb97jRBHcItn0m4W7OJFDAsRn9s yTCn+Sd0wGri+QmYplPOwTe9YnUt6l1OMmuqE8kj0Vouyk9kmIzJqPcnUqdRaYe16ElX srM6Sd832N1YoQiALaMEqwG48F/VhOa033+wM792EOY7Z30lX4UDxNcBBjKRW5hXpwnC inew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OWsi1oZkXFkl2HSGRxhK8dZo5MLFFb2OcVQXedsQz9I=; b=KcIAeO1vrv7c1m1J17dkP6H/PXN5emK6kgMxr6SK8zgqpEPoxsVnh1o+HNeFIZcDgv X2Sc9EFiqqh46yFSo/OdJjAns3C9cnI4b01UFqARy5Wsv/1Hk9q+ONFqVwcx/L86aJAB uO3FWuv0fcnrp/kJoTQ2vV7QZ0xgHDnH8uyP579TSr9tR2VbDpjVAj6JWxnkfMS59QUv xfhEqU6rN87d040Ua5pfEEDT/n6nPTlvbCPr/mN6Fc9EUAnJ+sEGLqhbxDFWb38mxPGY 9JyUG5G7kZgNsOM3ox68QRniiOoeM384fKmyFoIFMP5B9I5dfcBfWkmWo0tVj+6MFfSQ vOOg== X-Gm-Message-State: AOAM530oh7jybYfl7e+LKKUI6zuGNw/MPM7y+dovQ0ca2LPwqoloS0Xs JTpuz9kkBTdmT1nZL9SauxIXQA4AHqzR3Q== X-Received: by 2002:a17:902:b781:b029:db:e4ee:b8c7 with SMTP id e1-20020a170902b781b02900dbe4eeb8c7mr31091745pls.69.1608849916898; Thu, 24 Dec 2020 14:45:16 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/15] tcg/arm: Add host vector framework Date: Thu, 24 Dec 2020 14:45:00 -0800 Message-Id: <20201224224514.626561-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add registers and function stubs. The functionality is disabled via use_neon_instructions defined to 0. We must still include results for the mandatory opcodes in tcg_target_op_def, as all opcodes are checked during tcg init. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-conset.h | 4 ++ tcg/arm/tcg-target-constr.h | 1 + tcg/arm/tcg-target.h | 48 ++++++++++++-- tcg/arm/tcg-target.opc.h | 12 ++++ tcg/arm/tcg-target.c.inc | 121 +++++++++++++++++++++++++++++++----- 5 files changed, 163 insertions(+), 23 deletions(-) create mode 100644 tcg/arm/tcg-target.opc.h -- 2.25.1 diff --git a/tcg/arm/tcg-target-conset.h b/tcg/arm/tcg-target-conset.h index 7e972e70e0..dbcae51c4b 100644 --- a/tcg/arm/tcg-target-conset.h +++ b/tcg/arm/tcg-target-conset.h @@ -8,11 +8,14 @@ C_O0_I1(r) C_O0_I2(r, r) C_O0_I2(r, rIN) C_O0_I2(s, s) +C_O0_I2(w, r) C_O0_I3(s, s, s) C_O0_I4(r, r, rI, rI) C_O0_I4(s, s, s, s) C_O1_I1(r, l) C_O1_I1(r, r) +C_O1_I1(w, r) +C_O1_I1(w, wr) C_O1_I2(r, 0, rZ) C_O1_I2(r, l, l) C_O1_I2(r, r, r) @@ -21,6 +24,7 @@ C_O1_I2(r, r, rIK) C_O1_I2(r, r, rIN) C_O1_I2(r, r, ri) C_O1_I2(r, rZ, rZ) +C_O1_I2(w, w, w) C_O1_I4(r, r, r, rI, rI) C_O1_I4(r, r, rIN, rIK, 0) C_O2_I1(r, r, l) diff --git a/tcg/arm/tcg-target-constr.h b/tcg/arm/tcg-target-constr.h index 15c5e53406..5f2780decd 100644 --- a/tcg/arm/tcg-target-constr.h +++ b/tcg/arm/tcg-target-constr.h @@ -24,6 +24,7 @@ REGS('r', ALL_GENERAL_REGS) REGS('l', ALL_QLOAD_REGS) REGS('s', ALL_QSTORE_REGS) +REGS('w', 0xffff0000u) CONST('I', TCG_CT_CONST_ARM) CONST('K', TCG_CT_CONST_INV) diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 17e771374d..b40419971e 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -78,19 +78,38 @@ typedef enum { TCG_REG_R13, TCG_REG_R14, TCG_REG_PC, + + TCG_REG_Q0, + TCG_REG_Q1, + TCG_REG_Q2, + TCG_REG_Q3, + TCG_REG_Q4, + TCG_REG_Q5, + TCG_REG_Q6, + TCG_REG_Q7, + TCG_REG_Q8, + TCG_REG_Q9, + TCG_REG_Q10, + TCG_REG_Q11, + TCG_REG_Q12, + TCG_REG_Q13, + TCG_REG_Q14, + TCG_REG_Q15, + + TCG_AREG0 = TCG_REG_R6, + TCG_REG_CALL_STACK = TCG_REG_R13, } TCGReg; -#define TCG_TARGET_NB_REGS 16 +#define TCG_TARGET_NB_REGS 32 #ifdef __ARM_ARCH_EXT_IDIV__ #define use_idiv_instructions 1 #else extern bool use_idiv_instructions; #endif - +#define use_neon_instructions 0 /* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_R13 #define TCG_TARGET_STACK_ALIGN 8 #define TCG_TARGET_CALL_ALIGN_ARGS 1 #define TCG_TARGET_CALL_STACK_OFFSET 0 @@ -127,9 +146,26 @@ extern bool use_idiv_instructions; #define TCG_TARGET_HAS_goto_ptr 1 #define TCG_TARGET_HAS_direct_jump 0 -enum { - TCG_AREG0 = TCG_REG_R6, -}; +#define TCG_TARGET_HAS_v64 use_neon_instructions +#define TCG_TARGET_HAS_v128 use_neon_instructions +#define TCG_TARGET_HAS_v256 0 + +#define TCG_TARGET_HAS_andc_vec 0 +#define TCG_TARGET_HAS_orc_vec 0 +#define TCG_TARGET_HAS_not_vec 0 +#define TCG_TARGET_HAS_neg_vec 0 +#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_roti_vec 0 +#define TCG_TARGET_HAS_rots_vec 0 +#define TCG_TARGET_HAS_rotv_vec 0 +#define TCG_TARGET_HAS_shi_vec 0 +#define TCG_TARGET_HAS_shs_vec 0 +#define TCG_TARGET_HAS_shv_vec 0 +#define TCG_TARGET_HAS_mul_vec 0 +#define TCG_TARGET_HAS_sat_vec 0 +#define TCG_TARGET_HAS_minmax_vec 0 +#define TCG_TARGET_HAS_bitsel_vec 0 +#define TCG_TARGET_HAS_cmpsel_vec 0 #define TCG_TARGET_DEFAULT_MO (0) #define TCG_TARGET_HAS_MEMORY_BSWAP 1 diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h new file mode 100644 index 0000000000..7a4578e9b4 --- /dev/null +++ b/tcg/arm/tcg-target.opc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2019 Linaro + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. + * + * See the COPYING file in the top-level directory for details. + * + * Target-specific opcodes for host vector expansion. These will be + * emitted by tcg_expand_vec_op. For those familiar with GCC internals, + * consider these to be UNSPEC with names. + */ diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 28a31d5339..48966da12f 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -40,22 +40,10 @@ bool use_idiv_instructions; #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { - "%r0", - "%r1", - "%r2", - "%r3", - "%r4", - "%r5", - "%r6", - "%r7", - "%r8", - "%r9", - "%r10", - "%r11", - "%r12", - "%r13", - "%r14", - "%pc", + "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", + "%r8", "%r9", "%r10", "%r11", "%r12", "%sp", "%r14", "%pc", + "%q0", "%q1", "%q2", "%q3", "%q4", "%q5", "%q6", "%q7", + "%q8", "%q9", "%q10", "%q11", "%q12", "%q13", "%q14", "%q15", }; #endif @@ -75,6 +63,23 @@ static const int tcg_target_reg_alloc_order[] = { TCG_REG_R3, TCG_REG_R12, TCG_REG_R14, + + TCG_REG_Q0, + TCG_REG_Q1, + TCG_REG_Q2, + TCG_REG_Q3, + TCG_REG_Q4, + TCG_REG_Q5, + TCG_REG_Q6, + TCG_REG_Q7, + TCG_REG_Q8, + TCG_REG_Q9, + TCG_REG_Q10, + TCG_REG_Q11, + TCG_REG_Q12, + TCG_REG_Q13, + TCG_REG_Q14, + TCG_REG_Q15, }; static const int tcg_target_call_iarg_regs[4] = { @@ -85,6 +90,7 @@ static const int tcg_target_call_oarg_regs[2] = { }; #define TCG_REG_TMP TCG_REG_R12 +#define TCG_VEC_TMP TCG_REG_Q15 enum arm_cond_code_e { COND_EQ = 0x0, @@ -2095,6 +2101,22 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_qemu_st_i64: return TARGET_LONG_BITS == 32 ? C_O0_I3(s, s, s) : C_O0_I4(s, s, s, s); + case INDEX_op_st_vec: + return C_O0_I2(w, r); + case INDEX_op_ld_vec: + case INDEX_op_dupm_vec: + return C_O1_I1(w, r); + case INDEX_op_dup_vec: + return C_O1_I1(w, wr); + case INDEX_op_dup2_vec: + case INDEX_op_add_vec: + case INDEX_op_sub_vec: + case INDEX_op_xor_vec: + case INDEX_op_or_vec: + case INDEX_op_and_vec: + case INDEX_op_cmp_vec: + return C_O1_I2(w, w, w); + default: g_assert_not_reached(); } @@ -2104,12 +2126,18 @@ static void tcg_target_init(TCGContext *s) { /* Only probe for the platform and capabilities if we havn't already determined maximum values at compile time. */ -#ifndef use_idiv_instructions +#if !defined(use_idiv_instructions) || !defined(use_neon_instructions) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); +#ifndef use_idiv_instructions use_idiv_instructions = (hwcap & HWCAP_ARM_IDIVA) != 0; +#endif +#ifndef use_neon_instructions + use_neon_instructions = (hwcap & HWCAP_ARM_NEON) != 0; +#endif } #endif + if (__ARM_ARCH < 7) { const char *pl = (const char *)qemu_getauxval(AT_PLATFORM); if (pl != NULL && pl[0] == 'v' && pl[1] >= '4' && pl[1] <= '9') { @@ -2127,10 +2155,33 @@ static void tcg_target_init(TCGContext *s) tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R12); tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R14); + if (use_neon_instructions) { + tcg_target_available_regs[TCG_TYPE_V64] = 0xffff0000u; + tcg_target_available_regs[TCG_TYPE_V128] = 0xffff0000u; + + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q0); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q1); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q2); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q3); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q4); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q5); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q6); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q7); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q8); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q9); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q10); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q11); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q12); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q13); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q14); + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q15); + } + s->reserved_regs = 0; tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK); tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP); tcg_regset_set_reg(s->reserved_regs, TCG_REG_PC); + tcg_regset_set_reg(s->reserved_regs, TCG_VEC_TMP); } static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, @@ -2164,6 +2215,42 @@ static inline void tcg_out_movi(TCGContext *s, TCGType type, tcg_out_movi32(s, COND_AL, ret, arg); } +static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg rd, TCGReg rs) +{ + g_assert_not_reached(); +} + +static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg rd, TCGReg base, intptr_t offset) +{ + g_assert_not_reached(); +} + +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, + TCGReg rd, int64_t v64) +{ + g_assert_not_reached(); +} + +static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, + unsigned vecl, unsigned vece, + const TCGArg *args, const int *const_args) +{ + g_assert_not_reached(); +} + +int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) +{ + return 0; +} + +void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, + TCGArg a0, ...) +{ + g_assert_not_reached(); +} + static void tcg_out_nop_fill(tcg_insn_unit *p, int count) { int i; From patchwork Thu Dec 24 22:45:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351932 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7330831jai; Thu, 24 Dec 2020 14:46:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgsZlMDVx1p1upf28djxzJGXtIp7tAYg6zCCfmViW3hydtClVkcOYzWHthVhdSzILzWnpd X-Received: by 2002:a25:348b:: with SMTP id b133mr46400031yba.282.1608849984567; Thu, 24 Dec 2020 14:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608849984; cv=none; d=google.com; s=arc-20160816; b=wPwHRhdeXHGEqNDAeV6KphbStJGh6IJIMn3ljuVF2ufI6byDZ43iwqb00CLfi9GQp9 YgGOjYkGqDfEr9MregZoJsZa4mXEIdHjFCcAFO7BRZXyAZ1uNFH9T1GtJeQ6BjVF7B3t 0/uflbjbL14QEZXu5hOQaHtS8Em8RTKBUjBmUOlmE/ic7cjP5L+RQs6uutfDpN+wBJr5 IUV5y44h6TvVsGPje4gx/kPOVKIYcsEnfTsueFniMOGFgABOfKf5khelM/esEo4owvXS EV/bfNSm4CS5WQNCIQ8yvJEWrUkbCCm2cJxq9tMmLPcySO+BU8A4tCLFLDr/QoaP9YG/ 660A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=ZxnxrEch73n44hSgG+hf+ifeWy6oZuCkZecOY5agIjs=; b=hvd7BlXKRTC+eJMoqj5z097Hxjpn5mZuDn6kMiepnu5jfBdJyr9tk/jRW14eJfD7lt wEZElkTIxGaz+AZ0W+Hrn3gLcT8csWMjsFEJbWffjoNprt8fe66SBh21IqqOVPHfH23P TGdb6xyQnEPfMeEwHHmBNzLuoIYLjdDD0mpmNgaKssqaIDILgrG1uZfwHoHT2V5ZZ+LE ythn+Gu0zfHvdsn6u3EuKBThZ6CQ85dbKu+43BXHxpr5ivU7aeO4ElSoKrvGa1wTRzrx q6/XHcZ9AV+T6A2ngD5ikh0733agbVj0tei/ul2tpyEO9BN5Dlh61YNp26STRCEKvNJX KLxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sf+bICKG; 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 l13si25056828ybp.2.2020.12.24.14.46.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:46:24 -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=pass header.i=@linaro.org header.s=google header.b=Sf+bICKG; 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]:55774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZNI-0001sp-1O for patch@linaro.org; Thu, 24 Dec 2020 17:46:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMI-0001q2-VN for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:23 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:53819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMG-0008II-CZ for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:22 -0500 Received: by mail-pj1-x1035.google.com with SMTP id iq13so1689788pjb.3 for ; Thu, 24 Dec 2020 14:45:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZxnxrEch73n44hSgG+hf+ifeWy6oZuCkZecOY5agIjs=; b=Sf+bICKGInCgVFzj7eH6ia+j4xeF/NW8WkkJi1pDiVLBzhvp9Dn5qSWFFxlABWGEEi N08olB3yyJYZc0gxl1AwYyY+nSyYmvmUfH0MUcvWqxJuFZwyvhCXjzMOk5ykYIITC+d7 QShW72wlERp+HhQHeaP9IZXPmpbzoD/wTv9cGuzDS+BJ8LWwxnI7KfRgq9ftlVNfjqWw MCN6Saiirqgu0a6qkKROrzLvzrPHZpP7SYsaReskuHRUdTGZRpxfeh/zJx7KeuJMnzD1 M7lIw54n2sC5KZ+UloDrqapM2CYjDO5H2ydSFlcIfiVstYLwNpAmIbxDcSHu7lQpak+8 kIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZxnxrEch73n44hSgG+hf+ifeWy6oZuCkZecOY5agIjs=; b=aUQVaAzZu33YFpyamp7VSwLH7h4uxMlCz7vnsZkttyOAfncKYnZUfWQzW88iZIf21a n6e5lG9pa44ejOYbfEk1PnoonWVcR/rtJqjT2hSKpYPcYD6G2U0S5kDwNcCkCk+bGB0m yhbqXXIwOXvCdMLtGyOlU86xTrBn4vc20Rq8axahUPBm25Wbye+Mn/qj7NPaPTnjh+8s Tul2uZeiyZkeFfEyfIH9DX+s+l/oB+OQ3NtmqQVwWyOVwMy1kRNNM+F9Xtny+UYZ7JX1 3Wrl2Psz9acjiW/mxtqjxczuGbDRVV7uUCPYiVb4Yu50Rh2OX2JIzBx0K2B1cKYgtEXB o0eA== X-Gm-Message-State: AOAM530nzG+eHCTrNx34HZsW30tczRDloNWzMMlGF2YPj1JwTnsssNJY JQh0EqViybwNuXFGRd0H+SIVAP/U13g/GA== X-Received: by 2002:a17:90b:3687:: with SMTP id mj7mr6043376pjb.76.1608849918058; Thu, 24 Dec 2020 14:45:18 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/15] tcg/arm: Implement tcg_out_ld/st for vector types Date: Thu, 24 Dec 2020 14:45:01 -0800 Message-Id: <20201224224514.626561-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 48966da12f..7122d5f390 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -175,6 +175,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) @@ -1073,6 +1076,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" @@ -2184,16 +2214,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, From patchwork Thu Dec 24 22:45:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351936 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7331710jai; Thu, 24 Dec 2020 14:49:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkzBVHrzSeNQ49omMfyAhCVEMwy7Fe+Y7FRAO2LSSrsEL/7wGuc29SCJQxqqC8U92BIvN1 X-Received: by 2002:a25:748a:: with SMTP id p132mr42943507ybc.268.1608850148469; Thu, 24 Dec 2020 14:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850148; cv=none; d=google.com; s=arc-20160816; b=w+SpYC0mgqGTEvWGLETLLLT6P62wl2PVHs1lr0XYk9OCP07Panjsn52Ur/ICsCD5L6 AGQXIhY1M+wdwL/txL0b3F3+pDQN8iFV21U5FF2+lK0ifAgJU0f8ViVwakNMB8K4Hdlw GhMz8NNWFTh7m1YIHi3uLYXO3RSEoymEFUVC27pavjFB8faYjeXDBRlSZsbBBQtyxwWn d5K152IPAtVRhEKYJ4iYgKqKRcOtrU9sazwJ6Csh4/jiWzqIEw6poZxXQeRwJqH5hz+b PXZMukavXsUQH+XdajtWrI1ScEzcuf+Oiko8VQgmlVmJ5cQ5X6qbllc2wGxzPlVuKcWR d86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=/d+dt/50ZxvNyX2um8aZl9JJPUmMeM/hY33UH0tmi+Q=; b=yPJYIzRLWnKynI/rATZ20TeSgQycGFKfxykFr3XsZpazhCcC/uIsLa7pLAUBBN4hEC h6iGMDP4cr6Rw1dLMrXZRo2S90Bu6tPuQYaTl3mUCQQzGVTXuWhBjCnAEj4qlndLlxx/ /IHFk4qLB3ZJNE3wPZCkYS7q5NqcVmxcydm3d5R3EBSqjf2RtPZf2H+Rk2qI2dMegXp+ W0HF7LJRWWAopVK2XF/E7Vp8NozEj/zXY+YV6EviE5YHs/0Q9m67HptskA+v4JGwUdCW Oo7MTPDb0YVIg+HVSFw5GWAs7HjPF/uv5ln+XUbNgeMgWKBw1VwMCso2Bme9M2K2srD7 X2iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dhFVdoN5; 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 s22si26949485ybc.40.2020.12.24.14.49.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:49:08 -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=pass header.i=@linaro.org header.s=google header.b=dhFVdoN5; 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]:35754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZPv-0005K2-Ul for patch@linaro.org; Thu, 24 Dec 2020 17:49:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMI-0001pp-Fo for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:22 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:42377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMG-0008IQ-O0 for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:22 -0500 Received: by mail-pl1-x62c.google.com with SMTP id s15so1806633plr.9 for ; Thu, 24 Dec 2020 14:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/d+dt/50ZxvNyX2um8aZl9JJPUmMeM/hY33UH0tmi+Q=; b=dhFVdoN5FUen6e0urFQepm+9uj6g2GpTvvWCm7U9mfrsx8SU+SIMWcjf6Ykp6Fu8yI eCG/GHVRVuv4IbgiP7qXjaum0q1o2Us92NpWOHgu2SmOMIRDsdPWklu1vFLC125+9Bnf dwrlyQISlSH6iI5U2vNme+RwcWLMW0O3y5KfRu8YATMOl8SzHUQKMcUJgZ1DYTFAXa46 piNzhVgRF4Tx6YnBbvN/58dMxBZG4PjQ9YhZkwW4oQcHWxMT4sfInZ1gl1rMmdU2+OaQ BiBZdJ6FfGkwrBvGil0r99V7md5nYpa/J+xuXeaQ1pOP3/uidUC+XRbWbOZ/Ahcz/JHZ alMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/d+dt/50ZxvNyX2um8aZl9JJPUmMeM/hY33UH0tmi+Q=; b=luVAQ6M8803Nx0VrNHFrxOdfGIQxINqCYxrkPGMKUdRA9PnD7QR4oykoF2Ig6MCeiZ R7uyING3iJE63vVfPsUem2KK57EHC8fGz65BHTLZjYzgIvcVa81yxYoYZiFBOpmbjBax bYDLLC5q+N88UVsh/aXBnEwm0km01Sis9MJuM5twlTUzVrRN466KMqVJFL45dc2JuaXs kQ8ccR+88BgQ6e2ncxKgdlzfuF+B3JBrS7UYrQGGMBWmRQqh2cNZdNpDgBx5MP8oBoth jy91FQ8YJYqswwJy0KtNo1LQDwEwKJBaYvUkCv1lonNbIvveF/IPjfoRouLgq3DWpIOm pPjw== X-Gm-Message-State: AOAM533ho4ZCDM2/Xw7W+NnE9mhbI1FeSf8tfuU35qmLaAi1D2Tr4pwr XKi4xX1uC6hRtnyjUSMsM3HFmYJWvw1KXg== X-Received: by 2002:a17:90a:db4e:: with SMTP id u14mr6020202pjx.184.1608849919002; Thu, 24 Dec 2020 14:45:19 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/15] tcg/arm: Implement tcg_out_mov for vector types Date: Thu, 24 Dec 2020 14:45:02 -0800 Message-Id: <20201224224514.626561-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 50 +++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 7122d5f390..acc8f2c44a 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -178,6 +178,7 @@ typedef enum { INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ + INSN_VMOV = 0xf2200110, /* VMOV (register) */ } ARMInsn; #define INSN_NOP (use_armv7_instructions ? INSN_NOP_v6k : INSN_NOP_v4) @@ -1086,6 +1087,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) { @@ -2260,16 +2280,34 @@ 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: + tcg_out_vreg3(s, INSN_VMOV, 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); } From patchwork Thu Dec 24 22:45:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351935 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7331633jai; Thu, 24 Dec 2020 14:48:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN5It/K/vKb08/P5vcerKmjzL8f6ggGpTCMFoM9yszgPETGivBKyWbnQYBfOlF7BAfdQah X-Received: by 2002:a25:7909:: with SMTP id u9mr41866005ybc.333.1608850134735; Thu, 24 Dec 2020 14:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850134; cv=none; d=google.com; s=arc-20160816; b=WHlzwLS9MhMAhG37Z7EPsTtAywUTcZQEkHOb5jHqL+WXDVdkyleGu3od7FTIFfnFem CqJiW6SbeGZfI8NXfWkRnXpdTm0RtH95yhDogYPzvuFu4rQ5j58juW1yqqhzgi0FdEoy 3OdrVi1oCpn9gXILMiEuOU/MIw8NmpwLRAPCT7Z6lRvs+oOJi1WtfV0Dm7MDVNBdYIK2 Xu9QObqKPu27Cq/MmNWHbOC6IP+SQJ1bgQelgz5ELFDDWL+Qy+1NuN8UWPexJzJESRyT ELscEEfx/E9TY8+NTg0ga0oLpjFWZoGfSLt3j+2GgB0HEq0f3KeOQOMKRLtHKcDFZHer 0TWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=BO+FUmiWyN1+skP31sLxPh/eRwDAKGK3UywCSOeoCBw=; b=jZiyn9lbuDKap51xbcBEz3jCiJGO7tiAC0tPVM8D8wLm7Mu9x2d4/rO65utsS4vKM4 FzdUY+PKtteU/h3dP4S78XBuPSbRxskoirt0cClbd4tSZoacjFZ4AzlzTpqGxWFbQRw8 52IgkQyjY2ZagKoTix7alaANxYF7d5a01w6IXZgQ2enO1qfmbRssgPsCXHwJ/uLinF1W bBIDNMNAn74/0/MGdLPKDbQBJWVfMza2IjyMiNTsZevCXeAIdEOitpVZ68YGItHQM40y jbs20AsfQN4SXU5ICMdC4/K4e4p7kllkbnQSf7/voURVX17nBfLYJ4yN8ZU0WjXIAojC ztyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FOIPvTJK; 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 u9si18060179ybk.15.2020.12.24.14.48.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:48:54 -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=pass header.i=@linaro.org header.s=google header.b=FOIPvTJK; 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]:37268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZPi-0005xu-6d for patch@linaro.org; Thu, 24 Dec 2020 17:48:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMM-0001rU-DV for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:26 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:34823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMH-0008Id-Pz for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:26 -0500 Received: by mail-pj1-x1033.google.com with SMTP id b5so1806685pjl.0 for ; Thu, 24 Dec 2020 14:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BO+FUmiWyN1+skP31sLxPh/eRwDAKGK3UywCSOeoCBw=; b=FOIPvTJKIIiQ0mTLzcUnzFWCmbEgErSe5NUJ3Wx/yh1ikIFGKicBG4CPcCH5dZY2fA 0eFe2noZrD+DvVuiZUzGzwmYkZGcUwMWRj8K1DCFqDe1mNqD9wjy3j3vDdJMB1mMYY14 z+rQz6bQl7w/9HYLziryfCT5j+HviFiLDNAIrIoxiA6Tg/PbIVKOGEMUNWDjsYNpYJgC o94jB+rxUdb7B54yop/ZB253cffLxRt/zLE2eEMiKScpljKTVR3Y4COMpKUt+ZyDTn0K 349V6GmlV64EkvKjs8A4h41T0MQl9V6NxsdkTHb6DsFBZ23qaETSPDKQeWu6qPg4YHq3 Ggfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BO+FUmiWyN1+skP31sLxPh/eRwDAKGK3UywCSOeoCBw=; b=hFbKDFPraLDFM5tzW7QIoWFrkKE9PmvniCGdwNSzKtEPsSoSpwazHt5G3tUG/8qaN3 4lhspT895gymtmwNUSUKQlYkhYmriW8gj5W1a4d9Y0lhA0+TxfxGDhLjW+VVzlOnz1nD +EC79YEtmZNpsgsVDAmb+M2REC82KwvMhVIFBYZA0pjuVTyytbp5MoCeDrCFT8NrcRzs vKPVeBbyaZpZ99J7R7cbZwLSmq8Pw14dJAuxmXpQ4zrKMjlKgWOZgL3vyYz56tC3F4fz iJLWl55wWvvPKZmfSQraEVpNmHefRp20xXf/+1HlYQAZGS7Has6pNb/ncljeF0e4102I wtrw== X-Gm-Message-State: AOAM531f76koJ5uhPwXuxpYrcc0jn1ufPmWq8I+dk+MVcknTOEFifs0/ 1hkbXe4Z8VHn6ymwkJ4ETorYNL8qSej4MQ== X-Received: by 2002:a17:902:d716:b029:dc:24a1:77a2 with SMTP id w22-20020a170902d716b02900dc24a177a2mr4558274ply.64.1608849919971; Thu, 24 Dec 2020 14:45:19 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/15] tcg/arm: Implement tcg_out_dup*_vec Date: Thu, 24 Dec 2020 14:45:03 -0800 Message-Id: <20201224224514.626561-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Most of dupi is copied from tcg/aarch64, which has the same encoding for AdvSimdExpandImm. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 282 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 274 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index acc8f2c44a..6e9d72289a 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -176,9 +176,14 @@ typedef enum { /* Otherwise the assembler uses mov r0,r0 */ INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, + INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ + INSN_VDUP_S = 0xf3b00c00, /* VDUP (scalar) */ + INSN_VLDR_D = 0xed100b00, /* VLDR.64 */ INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ + INSN_VLD1R = 0xf4a00c00, /* VLD1 (single element to all lanes) */ INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ INSN_VMOV = 0xf2200110, /* VMOV (register) */ + INSN_VMOVI = 0xf2800010, /* VMOV (immediate) */ } ARMInsn; #define INSN_NOP (use_armv7_instructions ? INSN_NOP_v6k : INSN_NOP_v4) @@ -197,6 +202,14 @@ static const uint8_t tcg_cond_to_arm_cond[] = { [TCG_COND_GTU] = COND_HI, }; +static int encode_imm(uint32_t imm); + +/* TCG private relocation type: add with pc+imm8 */ +#define R_ARM_PC8 11 + +/* TCG private relocation type: vldr with imm8 << 2 */ +#define R_ARM_PC11 12 + static inline bool reloc_pc24(tcg_insn_unit *code_ptr, tcg_insn_unit *target) { ptrdiff_t offset = (tcg_ptr_byte_diff(target, code_ptr) - 8) >> 2; @@ -225,16 +238,51 @@ static inline bool reloc_pc13(tcg_insn_unit *code_ptr, tcg_insn_unit *target) return false; } +static bool reloc_pc11(tcg_insn_unit *code_ptr, tcg_insn_unit *target) +{ + ptrdiff_t offset = (tcg_ptr_byte_diff(target, code_ptr) - 8) / 4; + + if (offset >= -0xff && offset <= 0xff) { + tcg_insn_unit insn = *code_ptr; + bool u = (offset >= 0); + if (!u) { + offset = -offset; + } + insn = deposit32(insn, 23, 1, u); + insn = deposit32(insn, 0, 8, offset); + *code_ptr = insn; + return true; + } + return false; +} + +static bool reloc_pc8(tcg_insn_unit *code_ptr, tcg_insn_unit *target) +{ + ptrdiff_t offset = tcg_ptr_byte_diff(target, code_ptr) - 8; + int rot = encode_imm(offset); + + if (rot >= 0) { + *code_ptr = deposit32(*code_ptr, 0, 12, + rol32(offset, rot) | (rot << 7)); + return true; + } + return false; +} + static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_debug_assert(addend == 0); - - if (type == R_ARM_PC24) { + switch (type) { + case R_ARM_PC24: return reloc_pc24(code_ptr, (tcg_insn_unit *)value); - } else if (type == R_ARM_PC13) { + case R_ARM_PC13: return reloc_pc13(code_ptr, (tcg_insn_unit *)value); - } else { + case R_ARM_PC11: + return reloc_pc11(code_ptr, (tcg_insn_unit *)value); + case R_ARM_PC8: + return reloc_pc8(code_ptr, (tcg_insn_unit *)value); + default: g_assert_not_reached(); } } @@ -251,7 +299,7 @@ static inline uint32_t rotl(uint32_t val, int n) /* ARM immediates for ALU instructions are made of an unsigned 8-bit right-rotated by an even amount between 0 and 30. */ -static inline int encode_imm(uint32_t imm) +static int encode_imm(uint32_t imm) { int shift; @@ -278,6 +326,79 @@ static inline int check_fit_imm(uint32_t imm) return encode_imm(imm) >= 0; } +/* Return true if v16 is a valid 16-bit shifted immediate. */ +static bool is_shimm16(uint16_t v16, int *cmode, int *imm8) +{ + if (v16 == (v16 & 0xff)) { + *cmode = 0x8; + *imm8 = v16 & 0xff; + return true; + } else if (v16 == (v16 & 0xff00)) { + *cmode = 0xa; + *imm8 = v16 >> 8; + return true; + } + return false; +} + +/* Return true if v32 is a valid 32-bit shifted immediate. */ +static bool is_shimm32(uint32_t v32, int *cmode, int *imm8) +{ + if (v32 == (v32 & 0xff)) { + *cmode = 0x0; + *imm8 = v32 & 0xff; + return true; + } else if (v32 == (v32 & 0xff00)) { + *cmode = 0x2; + *imm8 = (v32 >> 8) & 0xff; + return true; + } else if (v32 == (v32 & 0xff0000)) { + *cmode = 0x4; + *imm8 = (v32 >> 16) & 0xff; + return true; + } else if (v32 == (v32 & 0xff000000)) { + *cmode = 0x6; + *imm8 = v32 >> 24; + return true; + } + return false; +} + +/* Return true if v32 is a valid 32-bit shifting ones immediate. */ +static bool is_soimm32(uint32_t v32, int *cmode, int *imm8) +{ + if ((v32 & 0xffff00ff) == 0xff) { + *cmode = 0xc; + *imm8 = (v32 >> 8) & 0xff; + return true; + } else if ((v32 & 0xff00ffff) == 0xffff) { + *cmode = 0xd; + *imm8 = (v32 >> 16) & 0xff; + return true; + } + return false; +} + +/* + * Return non-zero if v32 can be formed by MOVI+ORR. + * Place the parameters for MOVI in (cmode, imm8). + * Return the cmode for ORR; the imm8 can be had via extraction from v32. + */ +static int is_shimm32_pair(uint32_t v32, int *cmode, int *imm8) +{ + int i; + + for (i = 6; i > 0; i -= 2) { + /* Mask out one byte we can add with ORR. */ + uint32_t tmp = v32 & ~(0xffu << (i * 4)); + if (is_shimm32(tmp, cmode, imm8) || + is_soimm32(tmp, cmode, imm8)) { + break; + } + } + return i; +} + /* Test if a constant matches the constraint. * TODO: define constraints for: * @@ -1106,6 +1227,15 @@ static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, encode_vd(d) | encode_vn(n) | encode_vm(m)); } +static void tcg_out_vmovi(TCGContext *s, TCGReg rd, + int q, int op, int cmode, uint8_t imm8) +{ + tcg_out32(s, INSN_VMOVI | encode_vd(rd) | (q << 6) | (op << 5) + | (cmode << 8) | extract32(imm8, 0, 4) + | (extract32(imm8, 4, 3) << 16) + | (extract32(imm8, 7, 1) << 24)); +} + static void tcg_out_vldst(TCGContext *s, ARMInsn insn, TCGReg rd, TCGReg rn, int offset) { @@ -2311,22 +2441,158 @@ static void tcg_out_movi(TCGContext *s, TCGType type, tcg_out_movi32(s, COND_AL, ret, arg); } +/* Type is always V128, with I64 elements. */ +static void tcg_out_dup2_vec(TCGContext *s, TCGReg rd, TCGReg rl, TCGReg rh) +{ + /* Move high element into place first. */ + /* VMOV Dd+1, Ds */ + tcg_out_vreg3(s, INSN_VMOV | (1 << 12), 0, 0, rd, rh, rh); + /* Move low element into place; tcg_out_mov will check for nop. */ + tcg_out_mov(s, TCG_TYPE_V64, rd, rl); +} + static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg rd, TCGReg rs) { - g_assert_not_reached(); + int q = type - TCG_TYPE_V64; + + if (vece == MO_64) { + if (type == TCG_TYPE_V128) { + tcg_out_dup2_vec(s, rd, rs, rs); + } else { + tcg_out_mov(s, TCG_TYPE_V64, rd, rs); + } + } else if (rs < TCG_REG_Q0) { + int b = (vece == MO_8); + int e = (vece == MO_16); + tcg_out32(s, INSN_VDUP_G | (b << 22) | (q << 21) | (e << 5) | + encode_vn(rd) | (rs << 12)); + } else { + int imm4 = 1 << vece; + tcg_out32(s, INSN_VDUP_S | (imm4 << 16) | (q << 6) | + encode_vd(rd) | encode_vm(rs)); + } + return true; } static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg rd, TCGReg base, intptr_t offset) { - g_assert_not_reached(); + if (vece == MO_64) { + tcg_out_ld(s, TCG_TYPE_V64, rd, base, offset); + if (type == TCG_TYPE_V128) { + tcg_out_dup2_vec(s, rd, rd, rd); + } + } else { + int q = type - TCG_TYPE_V64; + tcg_out_vldst(s, INSN_VLD1R | (vece << 6) | (q << 5), + rd, base, offset); + } + return true; } static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg rd, int64_t v64) { - g_assert_not_reached(); + int q = type - TCG_TYPE_V64; + int cmode, imm8, i; + + /* Test all bytes equal first. */ + if (vece == MO_8) { + tcg_out_vmovi(s, rd, q, 0, 0xe, v64); + return; + } + + /* + * Test all bytes 0x00 or 0xff second. This can match cases that + * might otherwise take 2 or 3 insns for MO_16 or MO_32 below. + */ + for (i = imm8 = 0; i < 8; i++) { + uint8_t byte = v64 >> (i * 8); + if (byte == 0xff) { + imm8 |= 1 << i; + } else if (byte != 0) { + goto fail_bytes; + } + } + tcg_out_vmovi(s, rd, q, 1, 0xe, imm8); + return; + fail_bytes: + + /* + * Tests for various replications. For each element width, if we + * cannot find an expansion there's no point checking a larger + * width because we already know by replication it cannot match. + */ + if (vece == MO_16) { + uint16_t v16 = v64; + + if (is_shimm16(v16, &cmode, &imm8)) { + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); + return; + } + if (is_shimm16(~v16, &cmode, &imm8)) { + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); + return; + } + + /* + * Otherwise, all remaining constants can be loaded in two insns: + * rd = v16 & 0xff, rd |= v16 & 0xff00. + */ + tcg_out_vmovi(s, rd, q, 0, 0x8, v16 & 0xff); + tcg_out_vmovi(s, rd, q, 0, 0xb, v16 >> 8); /* VORR */ + return; + } + + if (vece == MO_32) { + uint32_t v32 = v64; + + if (is_shimm32(v32, &cmode, &imm8) || + is_soimm32(v32, &cmode, &imm8)) { + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); + return; + } + if (is_shimm32(~v32, &cmode, &imm8) || + is_soimm32(~v32, &cmode, &imm8)) { + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); + return; + } + + /* + * Restrict the set of constants to those we can load with + * two instructions. Others we load from the pool. + */ + i = is_shimm32_pair(v32, &cmode, &imm8); + if (i) { + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); + tcg_out_vmovi(s, rd, q, 0, i, extract32(v32, i * 4, 8)); + return; + } + i = is_shimm32_pair(~v32, &cmode, &imm8); + if (i) { + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); + tcg_out_vmovi(s, rd, q, 1, i, extract32(~v32, i * 4, 8)); + return; + } + } + + /* + * As a last resort, load from the constant pool. + */ + if (!q || vece == MO_64) { + new_pool_l2(s, R_ARM_PC11, s->code_ptr, 0, v64, v64 >> 32); + /* VLDR Dd, [pc + offset] */ + tcg_out32(s, INSN_VLDR_D | encode_vd(rd) | (0xf << 16)); + if (q) { + tcg_out_dup2_vec(s, rd, rd, rd); + } + } else { + new_pool_label(s, (uint32_t)v64, R_ARM_PC8, s->code_ptr, 0); + /* add tmp, pc, offset */ + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_TMP, TCG_REG_PC, 0); + tcg_out_dupm_vec(s, type, MO_32, rd, TCG_REG_TMP, 0); + } } static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, From patchwork Thu Dec 24 22:45:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351933 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7330838jai; Thu, 24 Dec 2020 14:46:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsjy3d5ShqIH+tE3M2qBZnJ8DxIECWPNRSfDAnvdWxNcJtKdl/4mIBb/3i0Dh9LypH4MZc X-Received: by 2002:a25:6f86:: with SMTP id k128mr29451210ybc.313.1608849986630; Thu, 24 Dec 2020 14:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608849986; cv=none; d=google.com; s=arc-20160816; b=fzLR0kvufUy+Nnw5Pd7PRJE6pr31uZz4piYDpcXxnWya1eOhGGezMPr1DgUyHr7G9w cr739dhQf8+5seayB0h54cb/s8t2K+YhYZ9nQk7nIm34nKkhn0QsceS6f5dx+R76gBGL euyYKvd99o6nhX0knw6I9OkYMIOUYSlQkG1arhko0TUOOjxWPJh6hhDmcYx784DE1GJ3 8oasNktPPPV7YHg5gDypOdVPJRDHX7ODmpjB5mLJd0Orl3sD2+yC5x9ojjtvCNMXBdqF KcdQWtPGLPZ28YEbwg4nD03Rq9bQUNHHudjz27vpc/lk3ERk2Dkt5YvpM3bYVP3Jjc99 98zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=jFRhkBWqut/6G0Q0sKpZiaviQgGi/m1iS3y3mM/4i90=; b=Q6k0I3FGTVokG//Hr+Fzq2/2+WPqJ0ZOMt7OOLSRTNVZJ9kRGmBadIF6B9UvqfiDoD 3TaHck3e2+VWPJbfBGqznKmN9KrA3idcVdaufiPbkbGN3HPNd+vDCI7RZBrBdW0AFIBe hOAyVBZE8CWARDnq7JJuo5uaFlp7Ry6Cp2pUBGA13VRh1ikxmO1qfnRaOkJrH64r/s1R GibQB35ucG5w0LMFPyD5Dz43/XOIAgjELuIPanPGfbUx6ABE0P7ly6dPuOP2W6fjUdhe HipV/fC5vYHw9sy7/G5K6uA3st03t1nU6b2HasoJCyRq/g99WOLCcqhlRfvyP4g2NAGx fOrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ag+qiTxT; 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 f8si21700485ybp.195.2020.12.24.14.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:46:26 -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=pass header.i=@linaro.org header.s=google header.b=ag+qiTxT; 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]:55848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZNK-0001vO-2o for patch@linaro.org; Thu, 24 Dec 2020 17:46:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMK-0001qi-UB for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:26 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:37448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMI-0008Im-Ne for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:24 -0500 Received: by mail-pl1-x634.google.com with SMTP id be12so1825762plb.4 for ; Thu, 24 Dec 2020 14:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jFRhkBWqut/6G0Q0sKpZiaviQgGi/m1iS3y3mM/4i90=; b=ag+qiTxTPYURL2BLvUBnSOy999VXNy//Mh6qfewizCAYeOg/ibHMOQk2OzgmMaD50Q OVjnyBUtYmgFiRZcyWd0wgYC302nT79+RayXOknC8bOQUzG5enshO6CnM26c885QuNr7 7CLGPn3biJQwfHXelhWz4w3Y28Jp8MiTXoBM2jqz9T4TmKTDm12qpb2EUqu1HailicJU YhFrFtm/Xgd72Cbe5bV9BpMAzxwL0J974/ecAaP/U/YB+hbMVehMicAD9U/jU0Ywt0qI 3WkiHVPEBHBbL+/WqytryOQPJ7MwiswO6XRVL35zfEpa50rHA+SMj8bRTt+UKcN128xW L9zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jFRhkBWqut/6G0Q0sKpZiaviQgGi/m1iS3y3mM/4i90=; b=Qq9Bk0esSBVy8bjYs7+EWPGdkSW+u8Ht7jfiC8VO286q3y2pcY/zl6BLStdD5jDGJH Th+TNsy5FbxkqK2tG+1pObVuJh/lrHbO8aqxEsXBYiPobo3r/VZuzarhTw6njjUWC04x JUWWN6ubbuATIu4SNZw/z5vj3/3gM9l3D0a7ozwKsKlz1bibIta8hCdHyVrNf1JThVxL XMWKHPzmFe2KkQkgTjj9oxnNLm/jzeVMdkD0fnuZ5hDlRbykSj6YClFzMqflG6IFUbCg ONVo4H+ipj5e9TTvbX2gG1+iHDX+5EKXRd+f54j1G6MREOwkmYRwKsLcFH1Xd3Ae8zuu RQ0w== X-Gm-Message-State: AOAM530xNHj4fpgkataF87olPBf+NsNbIhghpGbg2uxHbf9JuC9tkn7C 1cbiKMyVczwSETB+UKoAWdcJO0iJSD3qPg== X-Received: by 2002:a17:902:d351:b029:db:d63d:d0e with SMTP id l17-20020a170902d351b02900dbd63d0d0emr12656287plk.75.1608849921157; Thu, 24 Dec 2020 14:45:21 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/15] tcg: Change parameters for tcg_target_const_match Date: Thu, 24 Dec 2020 14:45:04 -0800 Message-Id: <20201224224514.626561-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Change the return value to bool, because that's what is should have been from the start. Pass the ct mask instead of the whole TCGArgConstraint, as that's the only part that's relevant. Change the value argument to int64_t. We will need the extra width for 32-bit hosts wanting to match vector constants. Signed-off-by: Richard Henderson --- tcg/tcg.c | 5 ++--- tcg/aarch64/tcg-target.c.inc | 5 +---- tcg/arm/tcg-target.c.inc | 5 +---- tcg/i386/tcg-target.c.inc | 4 +--- tcg/mips/tcg-target.c.inc | 5 +---- tcg/ppc/tcg-target.c.inc | 4 +--- tcg/riscv/tcg-target.c.inc | 4 +--- tcg/s390/tcg-target.c.inc | 5 +---- tcg/sparc/tcg-target.c.inc | 5 +---- tcg/tci/tcg-target.c.inc | 6 ++---- 10 files changed, 12 insertions(+), 36 deletions(-) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 3c0e494a08..73d22ecb26 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -147,8 +147,7 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, TCGReg base, intptr_t ofs); static void tcg_out_call(TCGContext *s, tcg_insn_unit *target); -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct); +static bool tcg_target_const_match(int64_t val, TCGType type, int ct); #ifdef TCG_TARGET_NEED_LDST_LABELS static int tcg_out_ldst_finalize(TCGContext *s); #endif @@ -4000,7 +3999,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) ts = arg_temp(arg); if (ts->val_type == TEMP_VAL_CONST - && tcg_target_const_match(ts->val, ts->type, arg_ct)) { + && tcg_target_const_match(ts->val, ts->type, arg_ct->ct)) { /* constant is OK for instruction */ const_args[i] = 1; new_args[i] = ts->val; diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index e52db4a881..84971a285f 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -262,11 +262,8 @@ static bool is_shimm1632(uint32_t v32, int *cmode, int *imm8) } } -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; - if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 6e9d72289a..3eb4456dce 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -407,11 +407,8 @@ static int is_shimm32_pair(uint32_t v32, int *cmode, int *imm8) * mov operand2: values represented with x << (2 * y), x < 0x100 * add, sub, eor...: ditto */ -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct; - ct = arg_ct->ct; if (ct & TCG_CT_CONST) { return 1; } else if ((ct & TCG_CT_CONST_ARM) && check_fit_imm(val)) { diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 9c16c5cc70..96a296d92e 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -206,10 +206,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, #endif /* test if a constant matches the constraint */ -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 3542fce752..8fb2d4f422 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -190,11 +190,8 @@ static inline bool is_p2m1(tcg_target_long val) } /* test if a constant matches the constraint */ -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct; - ct = arg_ct->ct; if (ct & TCG_CT_CONST) { return 1; } else if ((ct & TCG_CT_CONST_ZERO) && val == 0) { diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 238743f135..aded09315d 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -219,10 +219,8 @@ static bool reloc_pc14(tcg_insn_unit *pc, tcg_insn_unit *target) } /* test if a constant matches the constraint */ -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 3bc0d1f1b4..3b4a3a7dcf 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -132,10 +132,8 @@ static inline tcg_target_long sextreg(tcg_target_long val, int pos, int len) } /* test if a constant matches the constraint */ -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc index 087b4a2f5c..8edb35030a 100644 --- a/tcg/s390/tcg-target.c.inc +++ b/tcg/s390/tcg-target.c.inc @@ -403,11 +403,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, } /* Test if a constant matches the constraint. */ -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; - if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 85fb6c344c..e44eb9aa4b 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -320,11 +320,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, } /* test if a constant matches the constraint */ -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - int ct = arg_ct->ct; - if (ct & TCG_CT_CONST) { return 1; } diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index d28133ccb1..4e2f25bbba 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -742,11 +742,9 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, } /* Test if a constant matches the constraint. */ -static int tcg_target_const_match(tcg_target_long val, TCGType type, - const TCGArgConstraint *arg_ct) +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { - /* No need to return 0 or 1, 0 or != 0 is good enough. */ - return arg_ct->ct & TCG_CT_CONST; + return ct & TCG_CT_CONST; } static void tcg_target_init(TCGContext *s) From patchwork Thu Dec 24 22:45:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351937 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7331740jai; Thu, 24 Dec 2020 14:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwn6WiUdBGAc/odTGzrbO6V8bjxB9pk+JvTRTwOj0xuWbW+tC8xZlhkPky1lyaX3ji56dNu X-Received: by 2002:a5b:f03:: with SMTP id x3mr24183723ybr.289.1608850151921; Thu, 24 Dec 2020 14:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850151; cv=none; d=google.com; s=arc-20160816; b=r9roIhWwN9A9fzoJyg9GO95nvvE/RW2Wuxy9ZU4JvzYdSZPgS8fWfHc2E6KlBDCjZ4 n4HGfl047J4C95yno1QDQtGXsUXl0+aFsF1soGi3L9EnOTjtiqWJK0jRV0upJz0SCsnp jyftbqYOd07wyaNQwLBY10wtfLipyeTwHW9j/qXg9OGzOEHtGNIj4izF8sCJH4hG7rab 7BsUvhhAwhep3VSurfpQAmUK5KQuZbBbIXLiGjwWOtLHHK0VvO5J/eErnEX+3cpaZtkk S1uXczTKGX0AEUgnGUxa7fu3rXh0hopU3941sMtV8QFVdhS4t2i/lVu6UXUeetxuvUUB uFPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=Uiox93NiZ3CFL/uyXB2GLaumTiAy80yWrJayXZWb7MQ=; b=BgZ6p+cbzNYSQmqVXL+dxU3eizXwPLjR5f+6l12HWZj4IryW8iUiM0bewimn8NoJtp lW0VdI8Edg7XJnd70/uZb4E/UPXbFb2EfZQUz1eCiw0QJj/vx/+OMrMAJmtamHuV6P+p lYMgmBmT/txAIR2tlPKrxqJ6GTay1VaYoist6WmrkrRRYMqN0V2PrbgaPI8QgXo0vxXs JMQNB2C2PT2aAiR9pe+MHnQDXi6mL3l4iIsXOMIUNfx8rn8TfcNipUavfa7OywA87q2W CKjtHc10C8fnGa1sY16OfH13/Y2z/bwFnNaVimxNXwADL4/uFFU1xDBVz9ppCQmTO3Va eOTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mDQQGVo5; 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 z18si23059669ybg.43.2020.12.24.14.49.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:49:11 -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=pass header.i=@linaro.org header.s=google header.b=mDQQGVo5; 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]:36020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZPz-0005Q7-Am for patch@linaro.org; Thu, 24 Dec 2020 17:49:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMM-0001si-Pm for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:26 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMK-0008J0-JO for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:26 -0500 Received: by mail-pj1-x102b.google.com with SMTP id v1so1692243pjr.2 for ; Thu, 24 Dec 2020 14:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Uiox93NiZ3CFL/uyXB2GLaumTiAy80yWrJayXZWb7MQ=; b=mDQQGVo5XBTjWvv1KUer9yEUtfwF5WG7efQZ5Wb2Mgrm4XVsR0hmERQnZcjDWizBn2 maynlsxl3IT1SlLBjFLvZJug3O/OniJvr36M3o8AVfFlZbUJfyoNcLNPGEBLcv3LkyyD nHBMk4EEjVqwhjhXIxpyiOBLsbhoxwQfGV8jg5h/3mK+M0/SEVMfKNUGwQk3+NIg9GXd PrVayafFkqkxoPHD0X6qE+ti/cTC84Yrnr7yrZZY4+syqnvzPG2sWMhdCeMF9+Af6yo9 y3actm56Q5acSmM9okAYnw3HKWF7rRrjLRj2wj0k3tNCJ6KX1OnOceAeA9bsOOxD81nw dq8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uiox93NiZ3CFL/uyXB2GLaumTiAy80yWrJayXZWb7MQ=; b=TpEjSzISWazvf1jQ9ZRunLat47WPzDNEx32kN9poFHRUDfeoW6cuRE8DLlW5VDjAJj ek1BV9w9DAV3IwnbGS0Mcs4TQTR553ygAuYMF/QFk4CZffRXLDyBX+Oz3xVYaKSOzrr0 WJp92OKACJGzdLw47lo0gIxsckWS4EZ+05jPE8AYEj1qQKjc3J2xN6QYsnWrVIsgkLKZ Ko44xuU/u1KQ+M00AMdph6l+VjYOHuAnl0lrwEJa/tcEmj8gOsZi+gioqh0+BGCqeUBH 4kBdOLV2o9hhVL2wFirkKsRyq+KX5cerqQXgw3r2/DBdovQCCtfA1Dg4O1+RxUotjTR5 SASQ== X-Gm-Message-State: AOAM533ns0uLFSMIR7tIWpuDyg78c0DYQcBtOAKYb47Af4BSB5M3B7pY Oxa8/g9lgb6Oxijvh8qmKcQm0y5p35YDIA== X-Received: by 2002:a17:902:d34a:b029:da:861e:ecd8 with SMTP id l10-20020a170902d34ab02900da861eecd8mr24770946plk.45.1608849922613; Thu, 24 Dec 2020 14:45:22 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/15] tcg/arm: Implement minimal vector operations Date: Thu, 24 Dec 2020 14:45:05 -0800 Message-Id: <20201224224514.626561-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implementing dup2, add, sub, and, or, xor as the minimal set. This allows us to actually enable neon in the header file. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-conset.h | 3 + tcg/arm/tcg-target-constr.h | 2 + tcg/arm/tcg-target.h | 6 +- tcg/arm/tcg-target.c.inc | 203 ++++++++++++++++++++++++++++++++++-- 4 files changed, 206 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target-conset.h b/tcg/arm/tcg-target-conset.h index dbcae51c4b..ffcac7c6aa 100644 --- a/tcg/arm/tcg-target-conset.h +++ b/tcg/arm/tcg-target-conset.h @@ -25,6 +25,9 @@ C_O1_I2(r, r, rIN) C_O1_I2(r, r, ri) C_O1_I2(r, rZ, rZ) C_O1_I2(w, w, w) +C_O1_I2(w, w, wO) +C_O1_I2(w, w, wV) +C_O1_I2(w, w, wZ) C_O1_I4(r, r, r, rI, rI) C_O1_I4(r, r, rIN, rIK, 0) C_O2_I1(r, r, l) diff --git a/tcg/arm/tcg-target-constr.h b/tcg/arm/tcg-target-constr.h index 5f2780decd..f2c8f3dfce 100644 --- a/tcg/arm/tcg-target-constr.h +++ b/tcg/arm/tcg-target-constr.h @@ -29,4 +29,6 @@ REGS('w', 0xffff0000u) CONST('I', TCG_CT_CONST_ARM) CONST('K', TCG_CT_CONST_INV) CONST('N', TCG_CT_CONST_NEG) +CONST('O', TCG_CT_CONST_ORRI) +CONST('V', TCG_CT_CONST_ANDI) CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index b40419971e..d87493364f 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -107,7 +107,11 @@ typedef enum { #else extern bool use_idiv_instructions; #endif -#define use_neon_instructions 0 +#ifdef __ARM_NEON__ +#define use_neon_instructions 1 +#else +extern bool use_neon_instructions; +#endif /* used for function call generation */ #define TCG_TARGET_STACK_ALIGN 8 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 3eb4456dce..91243b641c 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -30,6 +30,9 @@ int arm_arch = __ARM_ARCH; #ifndef use_idiv_instructions bool use_idiv_instructions; #endif +#ifndef use_neon_instructions +bool use_neon_instructions; +#endif /* ??? Ought to think about changing CONFIG_SOFTMMU to always defined. */ #ifdef CONFIG_SOFTMMU @@ -176,6 +179,28 @@ typedef enum { /* Otherwise the assembler uses mov r0,r0 */ INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, + INSN_VADD = 0xf2000800, + INSN_VAND = 0xf2000110, + INSN_VEOR = 0xf3000110, + INSN_VORR = 0xf2200110, + INSN_VSUB = 0xf3000800, + + INSN_VMVN = 0xf3b00580, + + INSN_VCEQ0 = 0xf3b10100, + INSN_VCGT0 = 0xf3b10000, + INSN_VCGE0 = 0xf3b10080, + INSN_VCLE0 = 0xf3b10180, + INSN_VCLT0 = 0xf3b10200, + + INSN_VCEQ = 0xf3000810, + INSN_VCGE = 0xf2000310, + INSN_VCGT = 0xf2000300, + INSN_VCGE_U = 0xf3000310, + INSN_VCGT_U = 0xf3000300, + + INSN_VTST = 0xf2000810, + INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ INSN_VDUP_S = 0xf3b00c00, /* VDUP (scalar) */ INSN_VLDR_D = 0xed100b00, /* VLDR.64 */ @@ -291,6 +316,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, #define TCG_CT_CONST_INV 0x200 #define TCG_CT_CONST_NEG 0x400 #define TCG_CT_CONST_ZERO 0x800 +#define TCG_CT_CONST_ORRI 0x1000 +#define TCG_CT_CONST_ANDI 0x2000 static inline uint32_t rotl(uint32_t val, int n) { @@ -399,6 +426,16 @@ static int is_shimm32_pair(uint32_t v32, int *cmode, int *imm8) return i; } +/* Return true if V is a valid 16-bit or 32-bit shifted immediate. */ +static bool is_shimm1632(uint32_t v32, int *cmode, int *imm8) +{ + if (v32 == deposit32(v32, 16, 16, v32)) { + return is_shimm16(v32, cmode, imm8); + } else { + return is_shimm32(v32, cmode, imm8); + } +} + /* Test if a constant matches the constraint. * TODO: define constraints for: * @@ -419,9 +456,26 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return 1; } else if ((ct & TCG_CT_CONST_ZERO) && val == 0) { return 1; - } else { - return 0; } + + switch (ct & (TCG_CT_CONST_ORRI | TCG_CT_CONST_ANDI)) { + case 0: + break; + case TCG_CT_CONST_ANDI: + val = ~val; + /* fallthru */ + case TCG_CT_CONST_ORRI: + if (val == deposit64(val, 32, 32, val)) { + int cmode, imm8; + return is_shimm1632(val, &cmode, &imm8); + } + break; + default: + /* Both bits should not be set for the same insn. */ + g_assert_not_reached(); + } + + return 0; } static inline void tcg_out_b(TCGContext *s, int cond, int32_t offset) @@ -1217,6 +1271,13 @@ static uint32_t encode_vm(TCGReg rm) return (extract32(rm, 3, 1) << 5) | (extract32(rm, 0, 3) << 1); } +static void tcg_out_vreg2(TCGContext *s, ARMInsn insn, int q, int vece, + TCGReg d, TCGReg m) +{ + tcg_out32(s, insn | (vece << 18) | (q << 6) | + encode_vd(d) | encode_vm(m)); +} + static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, TCGReg d, TCGReg n, TCGReg m) { @@ -2289,10 +2350,13 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_add_vec: case INDEX_op_sub_vec: case INDEX_op_xor_vec: - case INDEX_op_or_vec: - case INDEX_op_and_vec: - case INDEX_op_cmp_vec: return C_O1_I2(w, w, w); + case INDEX_op_or_vec: + return C_O1_I2(w, w, wO); + case INDEX_op_and_vec: + return C_O1_I2(w, w, wV); + case INDEX_op_cmp_vec: + return C_O1_I2(w, w, wZ); default: g_assert_not_reached(); @@ -2592,16 +2656,141 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, } } +static const ARMInsn vec_cmp_insn[16] = { + [TCG_COND_EQ] = INSN_VCEQ, + [TCG_COND_GT] = INSN_VCGT, + [TCG_COND_GE] = INSN_VCGE, + [TCG_COND_GTU] = INSN_VCGT_U, + [TCG_COND_GEU] = INSN_VCGE_U, +}; + +static const ARMInsn vec_cmp0_insn[16] = { + [TCG_COND_EQ] = INSN_VCEQ0, + [TCG_COND_GT] = INSN_VCGT0, + [TCG_COND_GE] = INSN_VCGE0, + [TCG_COND_LT] = INSN_VCLT0, + [TCG_COND_LE] = INSN_VCLE0, +}; + static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, unsigned vecl, unsigned vece, const TCGArg *args, const int *const_args) { - g_assert_not_reached(); + TCGType type = vecl + TCG_TYPE_V64; + unsigned q = vecl; + TCGArg a0, a1, a2; + int cmode, imm8; + + a0 = args[0]; + a1 = args[1]; + a2 = args[2]; + + switch (opc) { + case INDEX_op_ld_vec: + tcg_out_ld(s, type, a0, a1, a2); + return; + case INDEX_op_st_vec: + tcg_out_st(s, type, a0, a1, a2); + return; + case INDEX_op_dupm_vec: + tcg_out_dupm_vec(s, type, vece, a0, a1, a2); + return; + case INDEX_op_dup2_vec: + tcg_out_dup2_vec(s, a0, a1, a2); + return; + case INDEX_op_add_vec: + tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); + return; + case INDEX_op_sub_vec: + tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); + return; + case INDEX_op_xor_vec: + tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); + return; + + case INDEX_op_and_vec: + if (const_args[2]) { + is_shimm1632(~a2, &cmode, &imm8); + if (a0 == a1) { + tcg_out_vmovi(s, a0, q, 1, cmode | 1, imm8); /* VBICI */ + return; + } + tcg_out_vmovi(s, a0, q, 1, cmode, imm8); /* VMVNI */ + a2 = a0; + } + tcg_out_vreg3(s, INSN_VAND, q, 0, a0, a1, a2); + return; + + case INDEX_op_or_vec: + if (const_args[2]) { + is_shimm1632(a2, &cmode, &imm8); + if (a0 == a1) { + tcg_out_vmovi(s, a0, q, 0, cmode | 1, imm8); /* VORI */ + return; + } + tcg_out_vmovi(s, a0, q, 0, cmode, imm8); /* VMOVI */ + a2 = a0; + } + tcg_out_vreg3(s, INSN_VORR, q, 0, a0, a1, a2); + return; + + case INDEX_op_cmp_vec: + { + TCGCond cond = args[3]; + + if (cond == TCG_COND_NE) { + if (const_args[2]) { + tcg_out_vreg3(s, INSN_VTST, q, vece, a0, a1, a1); + } else { + tcg_out_vreg3(s, INSN_VCEQ, q, vece, a0, a1, a2); + tcg_out_vreg2(s, INSN_VMVN, q, 0, a0, a0); + } + } else { + ARMInsn insn; + + if (const_args[2]) { + insn = vec_cmp0_insn[cond]; + if (insn) { + tcg_out_vreg2(s, insn, q, vece, a0, a1); + return; + } + tcg_out_dupi_vec(s, type, MO_8, TCG_VEC_TMP, 0); + a2 = TCG_VEC_TMP; + } + insn = vec_cmp_insn[cond]; + if (insn == 0) { + TCGArg t; + t = a1, a1 = a2, a2 = t; + cond = tcg_swap_cond(cond); + insn = vec_cmp_insn[cond]; + tcg_debug_assert(insn != 0); + } + tcg_out_vreg3(s, insn, q, vece, a0, a1, a2); + } + } + return; + + case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ + case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ + default: + g_assert_not_reached(); + } } int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) { - return 0; + switch (opc) { + case INDEX_op_add_vec: + case INDEX_op_sub_vec: + case INDEX_op_and_vec: + case INDEX_op_or_vec: + case INDEX_op_xor_vec: + return 1; + case INDEX_op_cmp_vec: + return vece < MO_64; + default: + return 0; + } } void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, From patchwork Thu Dec 24 22:45:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351934 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7331530jai; Thu, 24 Dec 2020 14:48:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJymaMsoE6SVCABVEoulZVJJgoJPxKskg2C/dXNK9tcC6uWeiK9JtKRog2+VCheSpaCrQJ+Z X-Received: by 2002:a25:383:: with SMTP id 125mr43827915ybd.120.1608850117748; Thu, 24 Dec 2020 14:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850117; cv=none; d=google.com; s=arc-20160816; b=yeSsYr+g9K2JOqivlFVp2+OaEvXome5ajrJ7pO2ONH+JbcpXhzlIeE/58kFgyTmL23 KkKb+K4T4D5Kg5V1PTA2eQ7tbc0Tf42QwYe3XTnWugSIuOVEZFeH+SYaDPrUQRbPco2U 8g53QDunTK5n9F7biyJ7Nc1bpcFBol0nxp3YKLQzhs0vSs68mBIGoz5tFGISwEzEXMGC U8LySohxNovJQfG94Gmcxzjc4qwih2fZAU3ZPey/2aohagRbH8lcGV7qHXpzgpQZYybT KOL0cmZEMdTFQURHuKZjhfNTZ/tZ2QnQJZsMXVFnyucEx/v1TzoVkRshyxjyBcNz8UC9 sTmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=hlUyyb+iuSTwDeQLaZh4hJz10IpDMn5XBpPh3/4SFGQ=; b=hg2dc7oqqFLVl9ZZw3lODbE4kk6zoaJrGNUJ3WUfBroy4Y/YhdB5iZgnZ6Cs8GBZma 3CPF+BsxVxiZVlmN8C+rO0dEfSK71h3rI2lG4W82IoRzZ1pJ3FSqUP9oG/EyRlNkEBcb 9XENyoFLVpJkJTKpMxyqo4c+W6KFyX1y6JncHFPNCOHvcmfxXkyiNxeL0+2AgR4JURtf bGDhKAnG3A0VZn2f6648czyd0/hu6mCWxSRzLxNOnD9M98xDMAE1PWhw8yKFgo7aG1N4 +R1K6QBBmwntknqsQd/yDRfiVsw4R7BspRzLjUzEsZ492gxbeG25EVlwK0n7IK9vM7dx djGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SHBae6Df; 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 f24si30209678ybj.452.2020.12.24.14.48.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:48:37 -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=pass header.i=@linaro.org header.s=google header.b=SHBae6Df; 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]:36310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZPR-0005Zi-5B for patch@linaro.org; Thu, 24 Dec 2020 17:48:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMN-0001u1-DI for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:27 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:34294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZML-0008Jw-Ju for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:27 -0500 Received: by mail-pg1-x535.google.com with SMTP id i5so2286436pgo.1 for ; Thu, 24 Dec 2020 14:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hlUyyb+iuSTwDeQLaZh4hJz10IpDMn5XBpPh3/4SFGQ=; b=SHBae6DfyY2SiapAOqzBnITMDcHoEJlxn3lfOnyZegqZQjop/Q4mEC4YM9gm3FYBlm HYDWCIbMRF1YyeYpilT4xI17XythRNxeFnq0w3P1CloSF0yUgmulkPQNrjBWi6ttSL8K GPn8+i83Ub1D9HNMQVIlTqo8Lnxgbp35E23EUwqGslb8BaFflxwGoQWlbHEOa6rL9bl7 ypw2sSS598GIfP0iEYDRZGPWogMbarlZg9GDmsOqCZ9qmDA6ASEPo29gf2bM1NKfu1HZ BOwwJ/LxlCspeWsCFnNAbBe8uTvHTxVJnxE68DOVTfIHXpI5FNbX2jt7jZQdmU7KNHWr k9Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hlUyyb+iuSTwDeQLaZh4hJz10IpDMn5XBpPh3/4SFGQ=; b=jWSR0RR3zmAZMX2k86EDH//5+Z7WXpZ9RWpaitQQN+Wnms9Kue/DQTwPtgh75lV4Vt dLgzeeODp1Pn0ia6682DQBuk3e4IrQN0kBf5lQAmMvLU/Vju82KA2lXDT1aucSBHdGEt LE7buf5kFxUoXNLOiV/hZdjVPhAvWgw5ZSSAwwv+0zNZ/6B04w7cxTZxHZ853lVuFSKJ fJ8BR1s3scqPlRVa9XM6k0g1nf46YTEHNnfgA7PR9XgnKuX2IntVgU3xYK42zqnFsvqf yAKMF1soYgSJ6EyU/vNhkfG6h1+uRCERV3mPuknF0TxYZOOysZpr1mc9jNtZ6SbaLHrN CDpQ== X-Gm-Message-State: AOAM531TVm4k2J/GQccDPaQx4txSqQ1tDo7Evf6ljI6vJqis5B0U7R9J 2KBRqAhZqGJ4uznV9+kTmaoZYwItuuacgA== X-Received: by 2002:a63:2242:: with SMTP id t2mr30032712pgm.428.1608849923832; Thu, 24 Dec 2020 14:45:23 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/15] tcg/arm: Implement andc, orc, abs, neg, not vector operations Date: Thu, 24 Dec 2020 14:45:06 -0800 Message-Id: <20201224224514.626561-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These logical and arithmetic operations are optional, but are trivial to accomplish with the existing infrastructure. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-conset.h | 1 + tcg/arm/tcg-target.h | 10 +++++----- tcg/arm/tcg-target.c.inc | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target-conset.h b/tcg/arm/tcg-target-conset.h index ffcac7c6aa..f32bf44f8b 100644 --- a/tcg/arm/tcg-target-conset.h +++ b/tcg/arm/tcg-target-conset.h @@ -15,6 +15,7 @@ C_O0_I4(s, s, s, s) C_O1_I1(r, l) C_O1_I1(r, r) C_O1_I1(w, r) +C_O1_I1(w, w) C_O1_I1(w, wr) C_O1_I2(r, 0, rZ) C_O1_I2(r, l, l) diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index d87493364f..bb9302c616 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -154,11 +154,11 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_v128 use_neon_instructions #define TCG_TARGET_HAS_v256 0 -#define TCG_TARGET_HAS_andc_vec 0 -#define TCG_TARGET_HAS_orc_vec 0 -#define TCG_TARGET_HAS_not_vec 0 -#define TCG_TARGET_HAS_neg_vec 0 -#define TCG_TARGET_HAS_abs_vec 0 +#define TCG_TARGET_HAS_andc_vec 1 +#define TCG_TARGET_HAS_orc_vec 1 +#define TCG_TARGET_HAS_not_vec 1 +#define TCG_TARGET_HAS_neg_vec 1 +#define TCG_TARGET_HAS_abs_vec 1 #define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 91243b641c..88814c6836 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -181,11 +181,15 @@ typedef enum { INSN_VADD = 0xf2000800, INSN_VAND = 0xf2000110, + INSN_VBIC = 0xf2100110, INSN_VEOR = 0xf3000110, + INSN_VORN = 0xf2300110, INSN_VORR = 0xf2200110, INSN_VSUB = 0xf3000800, + INSN_VABS = 0xf3b10300, INSN_VMVN = 0xf3b00580, + INSN_VNEG = 0xf3b10380, INSN_VCEQ0 = 0xf3b10100, INSN_VCGT0 = 0xf3b10000, @@ -2346,14 +2350,20 @@ static int tcg_target_op_def(TCGOpcode op) return C_O1_I1(w, r); case INDEX_op_dup_vec: return C_O1_I1(w, wr); + case INDEX_op_abs_vec: + case INDEX_op_neg_vec: + case INDEX_op_not_vec: + return C_O1_I1(w, w); case INDEX_op_dup2_vec: case INDEX_op_add_vec: case INDEX_op_sub_vec: case INDEX_op_xor_vec: return C_O1_I2(w, w, w); case INDEX_op_or_vec: + case INDEX_op_andc_vec: return C_O1_I2(w, w, wO); case INDEX_op_and_vec: + case INDEX_op_orc_vec: return C_O1_I2(w, w, wV); case INDEX_op_cmp_vec: return C_O1_I2(w, w, wZ); @@ -2698,6 +2708,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_dup2_vec: tcg_out_dup2_vec(s, a0, a1, a2); return; + case INDEX_op_abs_vec: + tcg_out_vreg2(s, INSN_VABS, q, vece, a0, a1); + return; + case INDEX_op_neg_vec: + tcg_out_vreg2(s, INSN_VNEG, q, vece, a0, a1); + return; + case INDEX_op_not_vec: + tcg_out_vreg2(s, INSN_VMVN, q, 0, a0, a1); + return; case INDEX_op_add_vec: tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); return; @@ -2708,6 +2727,13 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); return; + case INDEX_op_andc_vec: + if (!const_args[2]) { + tcg_out_vreg3(s, INSN_VBIC, q, 0, a0, a1, a2); + return; + } + a2 = ~a2; + /* fall through */ case INDEX_op_and_vec: if (const_args[2]) { is_shimm1632(~a2, &cmode, &imm8); @@ -2721,6 +2747,13 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_vreg3(s, INSN_VAND, q, 0, a0, a1, a2); return; + case INDEX_op_orc_vec: + if (!const_args[2]) { + tcg_out_vreg3(s, INSN_VORN, q, 0, a0, a1, a2); + return; + } + a2 = ~a2; + /* fall through */ case INDEX_op_or_vec: if (const_args[2]) { is_shimm1632(a2, &cmode, &imm8); @@ -2783,10 +2816,15 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_add_vec: case INDEX_op_sub_vec: case INDEX_op_and_vec: + case INDEX_op_andc_vec: case INDEX_op_or_vec: + case INDEX_op_orc_vec: case INDEX_op_xor_vec: + case INDEX_op_not_vec: return 1; + case INDEX_op_abs_vec: case INDEX_op_cmp_vec: + case INDEX_op_neg_vec: return vece < MO_64; default: return 0; From patchwork Thu Dec 24 22:45:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351940 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7332984jai; Thu, 24 Dec 2020 14:51:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdGTtb3YkmATfjnNfmz6dFrYMP1822bsnb8XDihS6GBkx8bZJxWByLKztqYa667Evmr+XC X-Received: by 2002:a25:6c8a:: with SMTP id h132mr43893249ybc.263.1608850309331; Thu, 24 Dec 2020 14:51:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850309; cv=none; d=google.com; s=arc-20160816; b=H5bJs3D4xKIbbD0oulMT7ACbwNZ5ZkNR8fQGBv5MUXJHPkoOyG55tu3AeWfeQcU501 JoSS04B+TsApvBDjtYR8WUAi2Hndwo3I1DY570PtjGNqXBgnCRk1qnNVxrlSeNRedOAN M8O14NBTpWoyf8WtEH4e1njlGMOljI2s3qWkK1h+1yK8aJYkgm7FtTfCSSTS0uPcc86h kcpHFmlo3WFzuaQhs6u8tjcCNHVvWqbYWcemZ+MrBEZhovbaFmmz0S3uD3OmeCek/G6t DF4XU5YwqR5MPhU2fmJv/WtBAhInm6SM+XJFbgj08OmBSYCIn6oPEY6G/LSCzmNk/fBM RaCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=UyOkiHtHg6XwqoRof2ZS3dpBuJLGq7jCLO0tGEoKGoU=; b=QAYhhgDPZnXXsGW6OjV3r1bNe+PCDDhfiXoSe+V+qg76fXHn08S275vIsTKwI/wMRX u+hUEIFZZ8B9qRO4gVlmGq4WxR5nuPD3vtudyJqBSiT+uy5qn3gHgJus/GAlRu/5HQeF tWtnMyNpbQL5pXuMB57sgKRYsXFsOk9rSL/gZTUq67NT0m3kL1cFw1pLG40lgyc6ruFS 4o0anJVma7GohLo3X1eFV8Hb7XpxtoQHVpckxMVLGQ92X1uhvPRH8WDsra+erHRzkL/D ZmqSkfEB4Da8yBhJVn51SyLvkUvzJrNVtMrCKwfC/0ShjUKB3QdDx2HFp4ZmyAae2pPM vCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bdhB+Cez; 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 h204si25182883ybh.420.2020.12.24.14.51.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:51:49 -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=pass header.i=@linaro.org header.s=google header.b=bdhB+Cez; 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]:44176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZSW-0000KR-PY for patch@linaro.org; Thu, 24 Dec 2020 17:51:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMO-0001vU-53 for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:28 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:42973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMM-0008K8-H5 for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:27 -0500 Received: by mail-pf1-x42f.google.com with SMTP id h10so858560pfo.9 for ; Thu, 24 Dec 2020 14:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UyOkiHtHg6XwqoRof2ZS3dpBuJLGq7jCLO0tGEoKGoU=; b=bdhB+Cezh/ouRlR3Ktqh+ACtC2Z88rx7yzht+nTTlSXpKYxFrY7YqQ2fcK6gHFEmsT HjFzPSwXhvcMprXjYr9zhc7Tl6zkaa3Rjd5A3vP1grEfYe//9CyZYYovrqpEeEr23fa3 qpDS3l0C+e4ORypsqNAByUOkTIc8CwgLPzkQVrSZ7JqJWBDd7uuDjczWFvHGKYGvaHXT 066OZY2h4xJVu1mHl+U3CeEIFm5x8Oa0SN3NT84FMjMiu5kxHhmFzyq0NryrKyxHY6gD GzbxlyPnxqX484ldEBauIS/IMYNvr/XAOHAHsDC5bPy0nH2rR7o/ukHWHCFu0IZ3R++0 sRMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UyOkiHtHg6XwqoRof2ZS3dpBuJLGq7jCLO0tGEoKGoU=; b=FS4PfHokvuKBBUamjPEmwFqLKypjbsBMIDj6z9jBw27FmOt5z5BcHYh0FhiSnweVPS xtk///Wz8QQTTNR61nfxtTZWQys3qTIt3or0aY093iu2O/5g/9ywAO443yQA96h+KOW3 XIAYFKY77UyArUkhCIIXAu6lbbNeFxx0Xh3e9BdRqWGDDdYruBPvQB3Dp7LhyLlh/65G 4YPmRQyj5mvjxu2xwU8GY6X3edKNcKupjmBPTWlQG7xJwVuY7o5FplPFq+r4vZnbv9aV eBb5Gxk9U6umyulkjxZFbiQSvqHWeWVwskxaJaY0oMe/gLs0vkh8VjTTBjhQWnOYZqra 4MNg== X-Gm-Message-State: AOAM533QtFA0qMOzriw/ne3w1VWg0/4ZIOzD3p2OWJ/D/qRCU+wKyEbr cAorpV9vWIEZJnMGxFB9J8ADaEQoB2jcCw== X-Received: by 2002:a63:1d22:: with SMTP id d34mr29767332pgd.335.1608849924879; Thu, 24 Dec 2020 14:45:24 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/15] tcg/arm: Implement TCG_TARGET_HAS_shi_vec Date: Thu, 24 Dec 2020 14:45:07 -0800 Message-Id: <20201224224514.626561-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This consists of the three immediate shifts: shli, shri, sari. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index bb9302c616..344b0d3199 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -162,7 +162,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_roti_vec 0 #define TCG_TARGET_HAS_rots_vec 0 #define TCG_TARGET_HAS_rotv_vec 0 -#define TCG_TARGET_HAS_shi_vec 0 +#define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 #define TCG_TARGET_HAS_mul_vec 0 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 88814c6836..f5d10e262a 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -203,6 +203,10 @@ typedef enum { INSN_VCGE_U = 0xf3000310, INSN_VCGT_U = 0xf3000300, + INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ + INSN_VSARI = 0xf2800010, /* VSHR.S */ + INSN_VSHRI = 0xf3800010, /* VSHR.U */ + INSN_VTST = 0xf2000810, INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ @@ -1298,6 +1302,14 @@ static void tcg_out_vmovi(TCGContext *s, TCGReg rd, | (extract32(imm8, 7, 1) << 24)); } +static void tcg_out_vshifti(TCGContext *s, ARMInsn insn, int q, + TCGReg rd, TCGReg rm, int l_imm6) +{ + tcg_out32(s, insn | (q << 6) | encode_vd(rd) | encode_vm(rm) | + (extract32(l_imm6, 6, 1) << 7) | + (extract32(l_imm6, 0, 6) << 16)); +} + static void tcg_out_vldst(TCGContext *s, ARMInsn insn, TCGReg rd, TCGReg rn, int offset) { @@ -2353,6 +2365,9 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_abs_vec: case INDEX_op_neg_vec: case INDEX_op_not_vec: + case INDEX_op_shli_vec: + case INDEX_op_shri_vec: + case INDEX_op_sari_vec: return C_O1_I1(w, w); case INDEX_op_dup2_vec: case INDEX_op_add_vec: @@ -2726,6 +2741,15 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_xor_vec: tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); return; + case INDEX_op_shli_vec: + tcg_out_vshifti(s, INSN_VSHLI, q, a0, a1, a2 + (8 << vece)); + return; + case INDEX_op_shri_vec: + tcg_out_vshifti(s, INSN_VSHRI, q, a0, a1, (16 << vece) - a2); + return; + case INDEX_op_sari_vec: + tcg_out_vshifti(s, INSN_VSARI, q, a0, a1, (16 << vece) - a2); + return; case INDEX_op_andc_vec: if (!const_args[2]) { @@ -2821,6 +2845,9 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_orc_vec: case INDEX_op_xor_vec: case INDEX_op_not_vec: + case INDEX_op_shli_vec: + case INDEX_op_shri_vec: + case INDEX_op_sari_vec: return 1; case INDEX_op_abs_vec: case INDEX_op_cmp_vec: From patchwork Thu Dec 24 22:45:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351938 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7332571jai; Thu, 24 Dec 2020 14:50:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj6/4KaXbIXTOtVgpLEeAdvurZP1nXuTdkfdszwukxzSG+3MPbUG/rQ4QbhBCQRsaiucJs X-Received: by 2002:a25:2517:: with SMTP id l23mr48155044ybl.55.1608850259214; Thu, 24 Dec 2020 14:50:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850259; cv=none; d=google.com; s=arc-20160816; b=DJgj2HQsxet0tI8ZlxoX3cd27tbfpp3iecLb6IzEn9If3AOIu1iox+hMZtM8fH4PZy p5o1apl0QhBcQf7ABYQ8KPBaadJMj8tejU0cXHs6ZHdy7bW2OchceZH0LoSSgoZSiM/A yR9n0BtCUfCkdaw0sppyRgL7EpzA/lLWahtx/l5pCJ+9PiD3LJM4Z2wDJZG2K63xG0Ou Fa/vlGXngndETazyYkjszJ/PraYB4XHmPRx9VlYZIDleOulCgS/SHqyE5Vqhnqf13rH2 i20QmOvMvMXSs+swNl+9s07iPm0/3xsOi1mlEGZsHV/GxI7LD4oHLtadbGyKzaMQF+8b yZRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=0tkUfCciBAcZfDt5l7o3GW8+5Ehz0EGG5um2EBC7lJ8=; b=0ZCuREf4OIYP3IFYAcSha98HvFFEI6jXBhxlG37yseJLIki0/nwh7o+neWd5nZ0YES msVcw0T5Kr6tRPQh7YUERYy5VFLa1JClwSKTflWtSL9J2Ga/6nfpbl/mcn5kwOEjlSZL rMrI8Ptsfft7VxFWa25Rv+FmrDcdtPbgP0WXHbPMBLuzdoTRlw9pGC8ClQtwPgNVOwKx yDxe1rW4CSutd+pVSV0vbdhSLlmISLhFB2mkM/V+OwCXZWk/N4fWWQmOo8m1OxHId/XT P3WxY5m1wxXmFQd5CPdNKWzWIMRtGavo77dC5ELaYL7ud+OkyxUYOO9YGDe7X845iFLY hoOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IoykNiaX; 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 s4si8209524ybm.126.2020.12.24.14.50.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:50:59 -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=pass header.i=@linaro.org header.s=google header.b=IoykNiaX; 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]:44746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZRi-0000ZI-MT for patch@linaro.org; Thu, 24 Dec 2020 17:50:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMP-0001y7-1s for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:29 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:41731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMN-0008KI-9p for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:28 -0500 Received: by mail-pl1-x635.google.com with SMTP id y8so1811538plp.8 for ; Thu, 24 Dec 2020 14:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0tkUfCciBAcZfDt5l7o3GW8+5Ehz0EGG5um2EBC7lJ8=; b=IoykNiaXskHcs8gIchNnP5agfgD3DC0rLPDfch+QYakEHswI1cr8mib1drFEN6naIe MQarN+Nansft38ZOvs+5Cwd93LPPVMwgEHQrbEkTG4rUxqUdxNisNwsWV/9cISogj7m7 SHicTBolOJCl7/QLtUcYJEKNCwu1fVMXO/GyZbW5fHAow3VaZC0NrIxZq2bte9qInnsm kBFfLhTjd670eAFUc76Db6pnM9brE2erc1tYhhr8hAFhjsSTT7vUHMTAKzB86P74ePXv 05LRUVKQTq1cpcS7yuvTHhEzm1coHfjPkEE30iKlgqoP6/PJR65wco4jNdrUJ3dIvgyI Ysdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0tkUfCciBAcZfDt5l7o3GW8+5Ehz0EGG5um2EBC7lJ8=; b=Oax6k4csXhQZ9VxvzkrDQmMd1I9LndRIlhPybrzWRSY8isVnq9tO1sil9sJRUsjZpt AXew89pRufmtT78wKjWo39OqKUyrJKt0X0kAotcl8mDyzzUL0RS7Pu9RyQ9Yf1W9ehsY y/iVr1HsFCPBtS59iUYhfc2jnN4w1FUe4H5VMXAu4xK/adX7X2KIiAOR4C1feba8/jsv g3wfMCNGCrCejluoWqkWTBJZQs6wxjLFjzwj3nNOuzIod/L5UmzXzb5KxKQqutaj+/Ze qaHxvc0WB1GBU17qNslEA1N+7K5r+WOWijVyHnI+/nDPAb0OzWgIXoXNOQD5XWsDDpI3 l0tQ== X-Gm-Message-State: AOAM530QzXm+o5ST1VEJnpGL35kGBN2GwFkan0f0479wdayUxxuJSlPI KOdtnY+fXnZINMkGMaoFkniA5UlAyMLB8g== X-Received: by 2002:a17:902:bb8c:b029:dc:2e5e:2b2 with SMTP id m12-20020a170902bb8cb02900dc2e5e02b2mr30613516pls.10.1608849925724; Thu, 24 Dec 2020 14:45:25 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/15] tcg/arm: Implement TCG_TARGET_HAS_mul_vec Date: Thu, 24 Dec 2020 14:45:08 -0800 Message-Id: <20201224224514.626561-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 344b0d3199..8e5b304a5a 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -165,7 +165,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_shi_vec 1 #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 -#define TCG_TARGET_HAS_mul_vec 0 +#define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 0 #define TCG_TARGET_HAS_minmax_vec 0 #define TCG_TARGET_HAS_bitsel_vec 0 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index f5d10e262a..d11efc553a 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -186,6 +186,7 @@ typedef enum { INSN_VORN = 0xf2300110, INSN_VORR = 0xf2200110, INSN_VSUB = 0xf3000800, + INSN_VMUL = 0xf2000910, INSN_VABS = 0xf3b10300, INSN_VMVN = 0xf3b00580, @@ -2371,6 +2372,7 @@ static int tcg_target_op_def(TCGOpcode op) return C_O1_I1(w, w); case INDEX_op_dup2_vec: case INDEX_op_add_vec: + case INDEX_op_mul_vec: case INDEX_op_sub_vec: case INDEX_op_xor_vec: return C_O1_I2(w, w, w); @@ -2735,6 +2737,9 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_add_vec: tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); return; + case INDEX_op_mul_vec: + tcg_out_vreg3(s, INSN_VMUL, q, vece, a0, a1, a2); + return; case INDEX_op_sub_vec: tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); return; @@ -2851,6 +2856,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) return 1; case INDEX_op_abs_vec: case INDEX_op_cmp_vec: + case INDEX_op_mul_vec: case INDEX_op_neg_vec: return vece < MO_64; default: From patchwork Thu Dec 24 22:45:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351939 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7332841jai; Thu, 24 Dec 2020 14:51:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2gYwT6VGSUPbT87NlK32eGSD4YwzQdH+I+1LcFso0mjMd4/zc1rz1GPBLwYkscqVeK09W X-Received: by 2002:a25:938a:: with SMTP id a10mr42253336ybm.49.1608850287728; Thu, 24 Dec 2020 14:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850287; cv=none; d=google.com; s=arc-20160816; b=BoKHhIBDL+U6STXa3BH0x1j/39Glac9qdov5sUd3j+3Jr3ns9kdBeRu7WZZTsyNCsw K46nsrq12X5PELoZ11dluQM8qlowGwtQZUprB4WsCklN19DfKD5/2lxeoj4SXwJsAT1W Ra0U7q+9GDjAsUw6Vc3hyjdC4BRbuFB8jL3kpsvuuO14+/IrVAm+7rh12jB+ussWiIU/ 6XgTg5RLLowuKS1zIuYkOsNiaGewAsv5/GlnkplEdvTmEUW20XS0i1qzClzRXgZ6Dvq0 WF85vCId4jQGCT/l9/1hB1opmfj9h1vEFDGaAn8aSmC7YQdC0iDOIHpRiKWkekxHYwTC P7GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=YY0z8RV2Q/d+lnHmoU8+JYxwxSAxRbYGWKYKV5OQat4=; b=wT+vWeB63OQ72N6JUKZIp7eymB8sGmZTQT8geeoUyULap+Iz7VENdC/thJPyAyhpCc OGbPdKpXlWmw4/yF7BVWOoXQtil4qbQnXFpdyAzeIWdRFG7jUvmZsoMuSVLYA2gwAXzi PLGUlVGLDZaWl4L6iPCoSJpI2crOSUzr6n9ApDTvDbhgKmo+MJCMq8v/a7p3PPV1wWvb KwE8vId0tQ9afZwdtqUQHC8YhrHAFH3eGP1x58oYIJo+AeF4B0G3XhoNyUwWLrtFs5L7 xnYpAcLPRrVeZW2zJMwh2azfBCwGRwYZLAIfKFYtE0pGWheYw647Hp24424n9JwFHGoj vVaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m1J5i4zM; 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 66si23519992ybl.209.2020.12.24.14.51.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:51:27 -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=pass header.i=@linaro.org header.s=google header.b=m1J5i4zM; 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]:45650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZSB-0000zw-58 for patch@linaro.org; Thu, 24 Dec 2020 17:51:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMQ-0001zu-Oy for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:30 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:43039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMO-0008KZ-FS for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:30 -0500 Received: by mail-pl1-x62a.google.com with SMTP id x12so1806083plr.10 for ; Thu, 24 Dec 2020 14:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YY0z8RV2Q/d+lnHmoU8+JYxwxSAxRbYGWKYKV5OQat4=; b=m1J5i4zMi7o/NMX1f7J99TPc4xMAoyFlgNKnELX0+N/2/xxaoLEy+nFRJ1xstgKvPC vNA7Y8MUwpKKq6IOj6Hcq9ptJJhDq/vAPFdrBbk/QFDtga1Lxi9UlgqiYe8Le3plwfjX 54APulUCj5UP4i8MipaOAJZmxx2OBlj5AAM45QqF0LFpPUn7SNGSC9qtWCfh8/0g5rj9 89qzMajAP+9zgvoUFJEfXFVce1sJkv0Rsx5V9MLHXDOFOHwfFgD4H9O9x55t5ikvUw0f RPQbEbcEbc1yyeO17TO4vKM7g9dGod0BsCSAEKG2fQPFJffDXieYYJ5lRYu7wLPQB/Xl XwIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YY0z8RV2Q/d+lnHmoU8+JYxwxSAxRbYGWKYKV5OQat4=; b=EEXEXze5fTbx07Pbr1s1s7neTiOn7jgaqO93SsFiBMrJOqWK2djUYvyNFutI0BxpNU 916AzfSfc1Jkb88Vuz6yrpIdK3WfeorBDu6/hB/jYdOH6GwEw1dJFaVzBhXYsMmnOIjl XBiCuhNDTwLaF58LwqKf8KjOcE99BY8i2BCE3WTZWdRmBn5M7SToKU+bxPasiC5jXDt3 ivOuHP6vgYgV3H18bizJ2QJmkOMkzaw3NR9QodBaACQN3UgfjYv7xZmSY4r660vuO0lF A5hCgEVOVZnbTSRBBM4R7kg9qvpDE2//09XeXL0bTvpKwNS+iH4a6OUToJHwfxj7iptl Pzjw== X-Gm-Message-State: AOAM532bbJkuN8P7oT51SBaM08tbYfcfYnbEkNOuG3szCF6uqbZWLvq+ mmouRwIEk5n+2lw/Byrdqsi3Sq9QjhytAw== X-Received: by 2002:a17:902:694c:b029:db:d939:1061 with SMTP id k12-20020a170902694cb02900dbd9391061mr31369975plt.80.1608849926850; Thu, 24 Dec 2020 14:45:26 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/15] tcg/arm: Implement TCG_TARGET_HAS_sat_vec Date: Thu, 24 Dec 2020 14:45:09 -0800 Message-Id: <20201224224514.626561-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is saturating add and subtract, signed and unsigned. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 8e5b304a5a..c41dea2b03 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -166,7 +166,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_shs_vec 0 #define TCG_TARGET_HAS_shv_vec 0 #define TCG_TARGET_HAS_mul_vec 1 -#define TCG_TARGET_HAS_sat_vec 0 +#define TCG_TARGET_HAS_sat_vec 1 #define TCG_TARGET_HAS_minmax_vec 0 #define TCG_TARGET_HAS_bitsel_vec 0 #define TCG_TARGET_HAS_cmpsel_vec 0 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index d11efc553a..a6d9ee929b 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -187,6 +187,10 @@ typedef enum { INSN_VORR = 0xf2200110, INSN_VSUB = 0xf3000800, INSN_VMUL = 0xf2000910, + INSN_VQADD = 0xf2000010, + INSN_VQADD_U = 0xf3000010, + INSN_VQSUB = 0xf2000210, + INSN_VQSUB_U = 0xf3000210, INSN_VABS = 0xf3b10300, INSN_VMVN = 0xf3b00580, @@ -2373,7 +2377,11 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_dup2_vec: case INDEX_op_add_vec: case INDEX_op_mul_vec: + case INDEX_op_ssadd_vec: + case INDEX_op_sssub_vec: case INDEX_op_sub_vec: + case INDEX_op_usadd_vec: + case INDEX_op_ussub_vec: case INDEX_op_xor_vec: return C_O1_I2(w, w, w); case INDEX_op_or_vec: @@ -2743,6 +2751,18 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sub_vec: tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); return; + case INDEX_op_ssadd_vec: + tcg_out_vreg3(s, INSN_VQADD, q, vece, a0, a1, a2); + return; + case INDEX_op_sssub_vec: + tcg_out_vreg3(s, INSN_VQSUB, q, vece, a0, a1, a2); + return; + case INDEX_op_usadd_vec: + tcg_out_vreg3(s, INSN_VQADD_U, q, vece, a0, a1, a2); + return; + case INDEX_op_ussub_vec: + tcg_out_vreg3(s, INSN_VQSUB_U, q, vece, a0, a1, a2); + return; case INDEX_op_xor_vec: tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); return; @@ -2853,6 +2873,10 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shli_vec: case INDEX_op_shri_vec: case INDEX_op_sari_vec: + case INDEX_op_ssadd_vec: + case INDEX_op_sssub_vec: + case INDEX_op_usadd_vec: + case INDEX_op_ussub_vec: return 1; case INDEX_op_abs_vec: case INDEX_op_cmp_vec: From patchwork Thu Dec 24 22:45:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351941 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7333830jai; Thu, 24 Dec 2020 14:54:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrRS+hIe/xb6vt/dnQRdJgBPjhCsm8J9tIGMk8EJJEFSz1Lp+jCeuGnQmeWRZCRQf+xskA X-Received: by 2002:a05:6902:6b1:: with SMTP id j17mr48547022ybt.438.1608850452895; Thu, 24 Dec 2020 14:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850452; cv=none; d=google.com; s=arc-20160816; b=on7Gdl3KAWK3g/hr+5YuET7zWnPN7TmxISCbS2TAeMuYQySgU3RA1VDssw4LNP/TFK hymUNJRdjUFeyAG1jE6nDoirhSzkSOqnFhtbK9YWV4hzkav9NtXRgVeHdGLMo93DSGxH IyBeqCSnVqozBK6GBiyid3gazbAVn0dhumYMW7v4y4Zs4n7+6w7OiBo1yEP/8vM4vV0J 1TK5rynN8JgR/gxsjvUHZ+DEn+iL+RInM1PxezTS4/0TRwqzibIUrDIBNh5ke1L1vYz2 OCBZ1O3ppaml1ZdKgm5yey8H76HUhNOSDSoCL8rqc7P4YIgQiKaTI893sHx+sCMYNGJW qoiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=IZbCguoR0lCTKpaO3TpyZzkmWXelNo5E8yAqSlIyuXI=; b=h8QqnRsS2UeNPs3RaXGc1ueQd8dvn/m7qE+tV5AlZelz6FZ4TGEuJQDWbP/7pe299E ebcxGGIHrZ1Fduqklbxh/Xnc+vH3a556JkzcN729Bq+5L64NOxSLtx9TIbgqat+EJDWP u6a1TF8iqrSBoGfIjpGEooC1IXYiyiQ6C14VTFKZcPieRQmEv2045jNwLqeABqXT3L5W lVlQjj5xQ8xJbxSPr/K+jumACWQ917zb08nn8v5EMPWaYFLtaIVO7xyeJyYFN0AD2bV3 5YPDx5/4dVCSwPNkavmg62LoAhLP3NdnF8xKWvrEPg5eqPeZVR0necjH/UhFVTAJWeh4 JE6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="eBU/3SXL"; 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 j203si25603591ybj.425.2020.12.24.14.54.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:54:12 -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=pass header.i=@linaro.org header.s=google header.b="eBU/3SXL"; 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]:50736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZUq-000372-C3 for patch@linaro.org; Thu, 24 Dec 2020 17:54:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMR-00020V-5k for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:32 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:35614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMP-0008LV-BL for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:30 -0500 Received: by mail-pl1-x635.google.com with SMTP id g3so1829995plp.2 for ; Thu, 24 Dec 2020 14:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IZbCguoR0lCTKpaO3TpyZzkmWXelNo5E8yAqSlIyuXI=; b=eBU/3SXLc30HBuVQ/e/A5masB6AVmsWaMTxLWzSVWHWiEOVqn9c8wQPKVNIy84nS8N t0eSzZbJSH2hnS9N4tYjA3skm7b3JjYAqJf+obzqn4bFGpcs1Bl2+beN+B+iihBXWICD RPlSCGmf67TQf1Xbr+pmoKYIw5rtxLTkJFobBsDtj/OLuiCEOSW3fsMwQNg3IrCgZqH1 jaxQal5hhomMsnTwxGVuFEJFF3FkGDVGTaq1hQiw8/62p4lUM2VKPMnia22W6EusD1xr DhG4Q3ZMKYGgfhu/+/hZLl9c+QyKa456b3uGZaRiuMEHQb92dmmKlMFXKJdpafuZy3+y Dywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IZbCguoR0lCTKpaO3TpyZzkmWXelNo5E8yAqSlIyuXI=; b=G+lNxNnml/LsPA+01xD0KPVCY20rFCEzlXdhg+D7j/dEHqlzt1XX4iU96xUGaG9Phl Wbd8+pr/rHVe9xDEKB3VAxy6S0RMYUqPwtqYODiKVVJNH7olxw/44PdPSWQi6Ly6nmej HwmDCqx3oHcjRTrTw8wnCh0RnBmkF+DEVjISHOiMUeq8lWBONPNxCbxhGKjwiD6ujJBb ngtegnOkyGcaxB+KObTYp3z4Mjw2z/6jd/KfbSA7iFTEFnYkmyYCUSA9X4b+WdxlJ4w1 LrBuoOU1xD90ElRpV+pPwIV0RRJXjHkKVkK2QyI+pqe0G54+VdtydywzmMPQW5yNelPS iDyQ== X-Gm-Message-State: AOAM533CRSCV/uVAB/JdXNB8/MIQ2slR5vKulmuiKWe+k9Al4KjBezac +uofWljKv5t+PvsPXJebzFbV9e54cPeYsQ== X-Received: by 2002:a17:90b:e0d:: with SMTP id ge13mr5975739pjb.111.1608849927875; Thu, 24 Dec 2020 14:45:27 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/15] tcg/arm: Implement TCG_TARGET_HAS_minmax_vec Date: Thu, 24 Dec 2020 14:45:10 -0800 Message-Id: <20201224224514.626561-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is minimum and maximu, signed and unsigned. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index c41dea2b03..e3c533f00f 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -167,7 +167,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_shv_vec 0 #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 1 -#define TCG_TARGET_HAS_minmax_vec 0 +#define TCG_TARGET_HAS_minmax_vec 1 #define TCG_TARGET_HAS_bitsel_vec 0 #define TCG_TARGET_HAS_cmpsel_vec 0 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index a6d9ee929b..6e17082df2 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -191,6 +191,10 @@ typedef enum { INSN_VQADD_U = 0xf3000010, INSN_VQSUB = 0xf2000210, INSN_VQSUB_U = 0xf3000210, + INSN_VMAX = 0xf2000600, + INSN_VMAX_U = 0xf3000600, + INSN_VMIN = 0xf2000610, + INSN_VMIN_U = 0xf3000610, INSN_VABS = 0xf3b10300, INSN_VMVN = 0xf3b00580, @@ -2377,9 +2381,13 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_dup2_vec: case INDEX_op_add_vec: case INDEX_op_mul_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: case INDEX_op_ssadd_vec: case INDEX_op_sssub_vec: case INDEX_op_sub_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: case INDEX_op_usadd_vec: case INDEX_op_ussub_vec: case INDEX_op_xor_vec: @@ -2748,6 +2756,12 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_mul_vec: tcg_out_vreg3(s, INSN_VMUL, q, vece, a0, a1, a2); return; + case INDEX_op_smax_vec: + tcg_out_vreg3(s, INSN_VMAX, q, vece, a0, a1, a2); + return; + case INDEX_op_smin_vec: + tcg_out_vreg3(s, INSN_VMIN, q, vece, a0, a1, a2); + return; case INDEX_op_sub_vec: tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); return; @@ -2757,6 +2771,12 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sssub_vec: tcg_out_vreg3(s, INSN_VQSUB, q, vece, a0, a1, a2); return; + case INDEX_op_umax_vec: + tcg_out_vreg3(s, INSN_VMAX_U, q, vece, a0, a1, a2); + return; + case INDEX_op_umin_vec: + tcg_out_vreg3(s, INSN_VMIN_U, q, vece, a0, a1, a2); + return; case INDEX_op_usadd_vec: tcg_out_vreg3(s, INSN_VQADD_U, q, vece, a0, a1, a2); return; @@ -2882,6 +2902,10 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_cmp_vec: case INDEX_op_mul_vec: case INDEX_op_neg_vec: + case INDEX_op_smax_vec: + case INDEX_op_smin_vec: + case INDEX_op_umax_vec: + case INDEX_op_umin_vec: return vece < MO_64; default: return 0; From patchwork Thu Dec 24 22:45:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351942 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7334070jai; Thu, 24 Dec 2020 14:55:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJKBdhQpeQArE0EMhxXoG5I6Fi+RZQ0+MGAD/PYUPICMxsMApNxWG8dxpt65xzoahZsjbf X-Received: by 2002:a25:234c:: with SMTP id j73mr44025403ybj.116.1608850500836; Thu, 24 Dec 2020 14:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850500; cv=none; d=google.com; s=arc-20160816; b=wKjsLDytvcGMroYK1mIspNU564nkmVtJdG4yDE7o7khclEthuWViHeU5dey7BwLlw0 RzD5Ep//lO3np1oz5zbwyv/h92f8ettE7mUL2OHqzUJaHyFhpYS1IewWm17d3aNmA4A5 MvaeYe1l/ozJ+PDM6+NdKSDI2Z0ffhbPO5rGlGGCdgrdux4Ql4wai34VpCdubIMhBygg YXwEGOm0FxL9+3iGnMW/gvdZTKi0xsC4rYgk6LECjyZ6XSmjN0qu/KFn7Gz3XgQAbdF4 5vIW48mlgLt8aviA0SMy6c2HicDsrBCQqxBV6Qhvz/Shne+dWigZqiVViuElDATf20ho jHmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=pjxg4XUKPRZdCgpcbVtNrmcfhuCNTQ4S7bGgZjeSe+o=; b=bIOtBv3iircl3VFjixCG1GgdO5pGxGMckdN72yjxnn9RMIbx6yJ6DKx9OdpgZShGfG +uElugcssaowczpkxY4sLqDQzm2EEhjK1FHj4DFUWs3iFd6g6TvYQ28Wi8SA/6v3qZnH +E9mlmm0TFfZrzBk5FZjweE3Q3cXAHmAW8efdvG674Pm2PH92WGdyU3U8e5UAfLZve1W vog7ba4fww725Bg91fY7YtSVXXg/z3SiOaDIyjIGCx49xaj+M+DAEkq1dyaJKiEfs4cp OjBfQoQAqhrbwb3/jshaDGBWHGRC2yXyJTawFiEKWxFO21rD7CUZwk1CsH+QRxScLmCl bs1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tO+OOCU1; 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 184si8561389ybz.73.2020.12.24.14.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:55:00 -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=pass header.i=@linaro.org header.s=google header.b=tO+OOCU1; 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]:51928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZVb-0003d7-Rt for patch@linaro.org; Thu, 24 Dec 2020 17:55:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMS-00021f-Op for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:36 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:44245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMQ-0008Li-HA for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:32 -0500 Received: by mail-pl1-x633.google.com with SMTP id r4so1804988pls.11 for ; Thu, 24 Dec 2020 14:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=pjxg4XUKPRZdCgpcbVtNrmcfhuCNTQ4S7bGgZjeSe+o=; b=tO+OOCU1NNkPUK1zaMw9R2Xr9iW+q2oSd23EP/5VYY+uMHPfSy7iPAyHri8HGvJ1VN AxjHxv2WbYVv7LBE+siECFaIqGa4lWCsGsOE/jhC2S7k+S/nQW0yyw7WmUXpk4tdUI16 JHINrTOnTo3YWDoUChTveTDN6SG1+UDqklUDLm6qxE/BWyeCo1Jc5c84KDZ5vzdbbb8K bD6UfumyekSRecij1NiwOYUp9uHHbkS48wHz3aza4Y+JzfdUnT1NAf42S/nbeqgsE4AW 416QcArfjLSqBJketueAXO4ogq/VqkTd8ledRmSfdFRaDv8SMc/kRfiOpY65/51YW7GD MgTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pjxg4XUKPRZdCgpcbVtNrmcfhuCNTQ4S7bGgZjeSe+o=; b=gIsTjE0+yO44k+Zs0kk0JlaHys/ES/kV/aobZPgv6/I5U+SRBt1biVBDz81hjOT6UJ HjrZoLu0qVjvCNGFZP8L/JXLcDh+UMhJXkfRJk0x4Gfl5ZKSxWYtH08QMpiBihbm3v5+ gJVdxFF703cs533wIll+6RowsCBvRRl+SN6tSUC2nlghHkxp8rz0EPO82ZoxX4v7C9u7 +yLc01QEarA6TQxGKqAX/GY/SpWLIgzQMv8Ncl0VBHohJwRd41na6Vak3cYWVBsF40oe 4Ae8mIUMAi8q2+et/FIhtOrjLNXTy1rLXDArkx4eqvW/0nISO4w1t2tMotxeYpR964st bVBA== X-Gm-Message-State: AOAM531f8nvqZvLUIC7bXADGcK33H4UNFsbGt/84ItyBBcmTBv2SbO55 VUIIVicTBtp2NlFRRxbUzSGE9qLgOgxHPg== X-Received: by 2002:a17:902:778e:b029:da:feef:8f2d with SMTP id o14-20020a170902778eb02900dafeef8f2dmr31365070pll.25.1608849928927; Thu, 24 Dec 2020 14:45:28 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/15] tcg/arm: Implement TCG_TARGET_HAS_bitsel_vec Date: Thu, 24 Dec 2020 14:45:11 -0800 Message-Id: <20201224224514.626561-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" NEON has 3 instructions implementing this 4 argument operation, with each insn overlapping a different logical input onto the destination register. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-conset.h | 1 + tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.c.inc | 22 ++++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target-conset.h b/tcg/arm/tcg-target-conset.h index f32bf44f8b..30a5953621 100644 --- a/tcg/arm/tcg-target-conset.h +++ b/tcg/arm/tcg-target-conset.h @@ -29,6 +29,7 @@ C_O1_I2(w, w, w) C_O1_I2(w, w, wO) C_O1_I2(w, w, wV) C_O1_I2(w, w, wZ) +C_O1_I3(w, w, w, w) C_O1_I4(r, r, r, rI, rI) C_O1_I4(r, r, rIN, rIK, 0) C_O2_I1(r, r, l) diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index e3c533f00f..7463be8f27 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -168,7 +168,7 @@ extern bool use_neon_instructions; #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_HAS_sat_vec 1 #define TCG_TARGET_HAS_minmax_vec 1 -#define TCG_TARGET_HAS_bitsel_vec 0 +#define TCG_TARGET_HAS_bitsel_vec 1 #define TCG_TARGET_HAS_cmpsel_vec 0 #define TCG_TARGET_DEFAULT_MO (0) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 6e17082df2..aea3d2cf8f 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -216,6 +216,10 @@ typedef enum { INSN_VSARI = 0xf2800010, /* VSHR.S */ INSN_VSHRI = 0xf3800010, /* VSHR.U */ + INSN_VBSL = 0xf3100110, + INSN_VBIT = 0xf3200110, + INSN_VBIF = 0xf3300110, + INSN_VTST = 0xf2000810, INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ @@ -2400,7 +2404,8 @@ static int tcg_target_op_def(TCGOpcode op) return C_O1_I2(w, w, wV); case INDEX_op_cmp_vec: return C_O1_I2(w, w, wZ); - + case INDEX_op_bitsel_vec: + return C_O1_I3(w, w, w, w); default: g_assert_not_reached(); } @@ -2721,7 +2726,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, { TCGType type = vecl + TCG_TYPE_V64; unsigned q = vecl; - TCGArg a0, a1, a2; + TCGArg a0, a1, a2, a3; int cmode, imm8; a0 = args[0]; @@ -2872,6 +2877,18 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, } return; + case INDEX_op_bitsel_vec: + a3 = args[3]; + if (a0 == a3) { + tcg_out_vreg3(s, INSN_VBIT, q, 0, a0, a2, a1); + } else if (a0 == a2) { + tcg_out_vreg3(s, INSN_VBIF, q, 0, a0, a3, a1); + } else { + tcg_out_mov(s, type, a0, a1); + tcg_out_vreg3(s, INSN_VBSL, q, 0, a0, a2, a3); + } + return; + case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ default: @@ -2897,6 +2914,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_sssub_vec: case INDEX_op_usadd_vec: case INDEX_op_ussub_vec: + case INDEX_op_bitsel_vec: return 1; case INDEX_op_abs_vec: case INDEX_op_cmp_vec: From patchwork Thu Dec 24 22:45:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351943 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7334404jai; Thu, 24 Dec 2020 14:55:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1DdhJ6cb+xp+OIuLK4lQGUM5bCL9BYmzi8xhuEAfZNLquPxNeM5zPr8hnCq5doee3v1/H X-Received: by 2002:a25:8283:: with SMTP id r3mr43680854ybk.66.1608850543539; Thu, 24 Dec 2020 14:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850543; cv=none; d=google.com; s=arc-20160816; b=HoDBAfLgfFIyY+ZVGdVSJO5U5+2GIENMdYlBTBT2udvsP1V2+y9qB/FmdEWKD4dGo6 bEvQwHzvNkhe47MSDrLyn85B/uH2HFTXEpIDHniulA0WzVV72mSFrSKn6ZbiJ2qitDEk qzc8sxOYmtLMY9LSBsOBkCHuir3WTaCmmaIjAM7buZLToKZgoL9t4D9tM2xXe2doiPKQ sNrmV5+2koCHbP9F98NkdddMn6HCLjCs3gbi1RstW1yKoIb647W9GPiy5qwuZjbjHJdD iLzid7ExZFJUE8WoRINjqgqf+J9KgRZjBfT9mDR62s5uS2x3ynm4Fszzmn71Snd+mjJB KROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=xYN1vd+q2L0rB3bPnM92+K/6b0rSonXaaEOXZn/c53Q=; b=bt+3Y3Tz5VNrLMvzeeSObO0jlW8imOxtDJUhUOmnmnaMjL6SYgFBwg0XDC/NdcRdkq Q7KKkO2cOEH9AQeKEqJ79H0devtUs+5ofN9e9vk5TBewMNZ805dtvEvFMxDjutqeRnsJ jo1Raqu4gW5y2fHw8ENfobQsN3wBt3VMP7mSzJI+kiLa4eoNS5lMBaKNgsQxyd9bdHmq ZNkix8KIAo7WFowiYbs65bofipZOQ3q8pvxVCj+t54tgHu222f18oyh6K5/aeKSPDA7e /a6ppYNlA8bQSmBuKpi9dMdTLFeDa0W/Lv86Vay46LctReridslP1O/NOKfFR+pql83x IPfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bZFtvTBW; 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 a9si23431969ybc.91.2020.12.24.14.55.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:55:43 -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=pass header.i=@linaro.org header.s=google header.b=bZFtvTBW; 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]:53450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZWI-0004GB-Vl for patch@linaro.org; Thu, 24 Dec 2020 17:55:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMV-000238-5f for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:37 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:40915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMR-0008Lq-JR for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:34 -0500 Received: by mail-pj1-x1033.google.com with SMTP id m5so1796330pjv.5 for ; Thu, 24 Dec 2020 14:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xYN1vd+q2L0rB3bPnM92+K/6b0rSonXaaEOXZn/c53Q=; b=bZFtvTBWwRM6fyqaGT5cWIeqc9jbm4yxrSAS8svPCU/SZ5wtZFwOeksPKARy9rlUE7 /peD96YUVDvh2hx6IR67jSxstOqFYH2ljS7OkVIztf9OeuBQh0q98lw8Ya3VnpfZXRs+ qQ/USQ35taAEnZyG3+39svdIGDNKoR7EHaKrAXOPKV0es/zcVVfpsCiEgek0GyWeEsp+ bzstBgZTK3NRdnz4kSVHw2Zzo3lKDX+iM1z/C8Gax0D8bpIEHHxr5VMqM0O8Y6lDBboz LggpWEqNYoRbhdSFPoG8nb8osNyNcLmze936FiKBDXGyONvptoiNiDoOZITHiJy5VGHd N6jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xYN1vd+q2L0rB3bPnM92+K/6b0rSonXaaEOXZn/c53Q=; b=HIsSblU2cSyYe7Q12bGRmKisQKKMJ1sNFoAzGyRz//ME2g3ZbuUT3H8g7dpO9A12V1 9aq7mWHvkr5hAAyb3odmquyisqLvjk3e/gD990fk7TScFQqWPh4Ggqaa1IGR3ej5fJSR mH4TQ275Dcj51mg2/EgnK26JY2w/ETYfShHFxwb5bCKOYjIiv9bSWhuHFkqRP8AJhtpv LL/1qFVu1zSeGWTlCDGN/xuUnK8befXZsgUzpnv5r5nd44mDvN8eokXJR5XhVhfdE1Wn TO4DlQSocTrvesH3MTLOiLms4iuapcln3yP7PAaMWs1MBdm3H6LmeRWuJCr++SFkNNyW XMhQ== X-Gm-Message-State: AOAM531uXI7AJ3oa/XrFseueecAc1HbHohKg6uDCxh1cChuuAutFTg5p PtsUzMqqE0LLyDWx8HmO2R6GrWe7wSmMzQ== X-Received: by 2002:a17:902:9f89:b029:dc:3032:e439 with SMTP id g9-20020a1709029f89b02900dc3032e439mr29132357plq.35.1608849930147; Thu, 24 Dec 2020 14:45:30 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/15] tcg/arm: Implement TCG_TARGET_HAS_shv_vec Date: Thu, 24 Dec 2020 14:45:12 -0800 Message-Id: <20201224224514.626561-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The three vector shift by vector operations are all implemented via expansion. Therefore do not actually set TCG_TARGET_HAS_shv_vec, as none of shlv_vec, shrv_vec, sarv_vec may actually appear in the instruction stream, and therefore also do not appear in tcg_target_op_def. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.opc.h | 3 ++ tcg/arm/tcg-target.c.inc | 60 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h index 7a4578e9b4..d19153dcb9 100644 --- a/tcg/arm/tcg-target.opc.h +++ b/tcg/arm/tcg-target.opc.h @@ -10,3 +10,6 @@ * emitted by tcg_expand_vec_op. For those familiar with GCC internals, * consider these to be UNSPEC with names. */ + +DEF(arm_sshl_vec, 1, 2, 0, IMPLVEC) +DEF(arm_ushl_vec, 1, 2, 0, IMPLVEC) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index aea3d2cf8f..2a664a750d 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -215,6 +215,8 @@ typedef enum { INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ INSN_VSARI = 0xf2800010, /* VSHR.S */ INSN_VSHRI = 0xf3800010, /* VSHR.U */ + INSN_VSHL_S = 0xf2000400, /* VSHL.S (register) */ + INSN_VSHL_U = 0xf3000400, /* VSHL.U (register) */ INSN_VBSL = 0xf3100110, INSN_VBIT = 0xf3200110, @@ -2395,6 +2397,8 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_usadd_vec: case INDEX_op_ussub_vec: case INDEX_op_xor_vec: + case INDEX_op_arm_sshl_vec: + case INDEX_op_arm_ushl_vec: return C_O1_I2(w, w, w); case INDEX_op_or_vec: case INDEX_op_andc_vec: @@ -2791,6 +2795,17 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_xor_vec: tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); return; + case INDEX_op_arm_sshl_vec: + /* + * Note that Vm is the data and Vn is the shift count, + * therefore the arguments appear reversed. + */ + tcg_out_vreg3(s, INSN_VSHL_S, q, vece, a0, a2, a1); + return; + case INDEX_op_arm_ushl_vec: + /* See above. */ + tcg_out_vreg3(s, INSN_VSHL_U, q, vece, a0, a2, a1); + return; case INDEX_op_shli_vec: tcg_out_vshifti(s, INSN_VSHLI, q, a0, a1, a2 + (8 << vece)); return; @@ -2925,6 +2940,10 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_umax_vec: case INDEX_op_umin_vec: return vece < MO_64; + case INDEX_op_shlv_vec: + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: + return -1; default: return 0; } @@ -2933,7 +2952,46 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { - g_assert_not_reached(); + va_list va; + TCGv_vec v0, v1, v2, t1; + TCGArg a2; + + va_start(va, a0); + v0 = temp_tcgv_vec(arg_temp(a0)); + v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); + a2 = va_arg(va, TCGArg); + v2 = temp_tcgv_vec(arg_temp(a2)); + + switch (opc) { + case INDEX_op_shlv_vec: + /* + * Merely propagate shlv_vec to arm_ushl_vec. + * In this way we don't set TCG_TARGET_HAS_shv_vec + * because everything is done via expansion. + */ + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(v0), + tcgv_vec_arg(v1), tcgv_vec_arg(v2)); + break; + + case INDEX_op_shrv_vec: + case INDEX_op_sarv_vec: + /* Right shifts are negative left shifts for NEON. */ + t1 = tcg_temp_new_vec(type); + tcg_gen_neg_vec(vece, t1, v2); + if (opc == INDEX_op_shrv_vec) { + opc = INDEX_op_arm_ushl_vec; + } else { + opc = INDEX_op_arm_sshl_vec; + } + vec_gen_3(opc, type, vece, tcgv_vec_arg(v0), + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); + tcg_temp_free_vec(t1); + break; + + default: + g_assert_not_reached(); + } + va_end(va); } static void tcg_out_nop_fill(tcg_insn_unit *p, int count) From patchwork Thu Dec 24 22:45:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351944 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7334884jai; Thu, 24 Dec 2020 14:57:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2zeZFG9gGBmEaIi0KYIIrN5grD/P5dsfhARTgyohRowDG+NaRcKulpxUx149EVrpEgHwE X-Received: by 2002:a25:3211:: with SMTP id y17mr44096597yby.301.1608850624866; Thu, 24 Dec 2020 14:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850624; cv=none; d=google.com; s=arc-20160816; b=T96VAf3IlJCe+uHpY5rWmOHbZn07wsho576UdVClTQ3ZIx1uu2/Kcy/zYHROOQHf0Y XpWea89taZGFN3wljvxJLyUZ2vWZq48JpsyqoROOhkwtzYl2MfnhjKAkZbuKyj86bPHK MM8HJhtufcFcqJcngfodrKebK/zyF0AbnazpI9yh1OyGlR5LGcpESPk+zJF7aIwh3Epk hqaVMjcTpE14cbtv2mVAoaJfANbBD8hnTRiFHrJh4ka7tmf+G1fifAPsp4t+EbroIxFB m8Lrtz2UMWXN2RCJ8AAX7U96u9OySHazwvxmGSRprN3Q954lTe3MX2C7CGYUxEzZkicS pVGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=2jOhZ0X824Ir2mPF0YPHElmLbLC0e95TM2Qi2fWD/3s=; b=cQfWcaMzP0jF44pY3W7ld/b4Dia76XzJz1+75NSxiAUDzUsnhkzUa6loMkb/O/FKwZ OlvAHuZLErPZKDHGb9rK2Sfd/lCI6x16ZFtuts2DrQqxM14UQIrl9AjRQA7AFl++Okdh Nydz7skqRDWsKzgA1Gd4ZIaMtnOqR6H8r7+tW+zXUyp26P/VvJQzQ91fQhtc/VA7SNUa xACYZ7bHMBdIn5azoGOF1aZgx0gBYihBbXc20zo81Rj2RkvgcHrozl57+T1VLFJL36X4 +CdUp/TeLMFVaeTuBHv/InneNRU+WR0FEFOQiuY6QLPi1uP/0cfIlHi7tT/uiOr8CvkD 8eZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kAPzwRYF; 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 a8si12412465ybl.89.2020.12.24.14.57.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:57:04 -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=pass header.i=@linaro.org header.s=google header.b=kAPzwRYF; 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]:57090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZXc-0005qL-DQ for patch@linaro.org; Thu, 24 Dec 2020 17:57:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMX-00023r-Dw for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:37 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:44857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMS-0008M1-M1 for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:36 -0500 Received: by mail-pf1-x433.google.com with SMTP id f9so1799464pfc.11 for ; Thu, 24 Dec 2020 14:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2jOhZ0X824Ir2mPF0YPHElmLbLC0e95TM2Qi2fWD/3s=; b=kAPzwRYFtO8AoWBfRuTWo3pWeR4shqvOeNVGy3EdUN0diK0dJ0NRkVJ0wgOrVmL/7O ORsPESZ2swovNv8Q3kpPISdRPdm+9x/NX1gBHVn303W0Y3lt6AvobA6b57PBoRDghK7R 7i8qJkGMk5wZK17bIxU5WbTWlhtPVVOxEMhfxDSKTQmkCTv5usljgS8OY6gB5iE6tdFY Rq/5lFv7Lj11URL4Oviwb9CuRoYgfh4MRaMYtQ7szHMr/XPTpnTrSWgeuZdc1RME2gHc EcKGTiB/9IiDNhJyqAlH3yPwnhXt0F2XHsd3dSqPZbWQ3sKRToBiOvLDWohIUXz8fIOt ezaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2jOhZ0X824Ir2mPF0YPHElmLbLC0e95TM2Qi2fWD/3s=; b=khMlgc1Nuxi35NN+3qpabVesBVqKbkIbldA9Sdn/l6OTxQUhcoP9vp6xozQH+5oADI RX3BWLQrdNCw+VBj7uhTjC8kN0KUCRmqRITli7Opgt+UyNluVObNHxsZ0m6xrYlONQAk Vaj3ZuzlioJ8t6Fx5O2Q/MeCtfmvGTpRj9IjU96roOrry6CHHdtfGHr6Oya+UAVR8oMJ fH+ixXwSdb0aHTIVXTKEfbrpjgjPvDj8gl2MY+xJZtgtrCWNkrAebSgDjryx3dpKSvCQ MTGLNmquQ059DgLXLpPQzT0M3ILFjz838qDct4lFczIq1LIbxv/DnlcOLIpRg9Gd/BaB edug== X-Gm-Message-State: AOAM530hJ9N9MxcnTdPwqYUeO0RODrTH1oYyAr2C9o/Rq2J+8sIzAQVk MXcvIWVJg4nFLBmWsfMMJR3gtgQrBx+wFg== X-Received: by 2002:a63:1115:: with SMTP id g21mr28182076pgl.210.1608849931170; Thu, 24 Dec 2020 14:45:31 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/15] tcg/arm: Implement TCG_TARGET_HAS_roti_vec Date: Thu, 24 Dec 2020 14:45:13 -0800 Message-Id: <20201224224514.626561-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement via expansion, so don't actually set TCG_TARGET_HAS_roti_vec. For NEON, this is shift-right followed by shift-left-and-insert. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target-conset.h | 1 + tcg/arm/tcg-target.opc.h | 1 + tcg/arm/tcg-target.c.inc | 15 +++++++++++++++ 3 files changed, 17 insertions(+) -- 2.25.1 diff --git a/tcg/arm/tcg-target-conset.h b/tcg/arm/tcg-target-conset.h index 30a5953621..efb63396de 100644 --- a/tcg/arm/tcg-target-conset.h +++ b/tcg/arm/tcg-target-conset.h @@ -25,6 +25,7 @@ C_O1_I2(r, r, rIK) C_O1_I2(r, r, rIN) C_O1_I2(r, r, ri) C_O1_I2(r, rZ, rZ) +C_O1_I2(w, 0, w) C_O1_I2(w, w, w) C_O1_I2(w, w, wO) C_O1_I2(w, w, wV) diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h index d19153dcb9..d38af9a808 100644 --- a/tcg/arm/tcg-target.opc.h +++ b/tcg/arm/tcg-target.opc.h @@ -11,5 +11,6 @@ * consider these to be UNSPEC with names. */ +DEF(arm_sli_vec, 1, 2, 1, IMPLVEC) DEF(arm_sshl_vec, 1, 2, 0, IMPLVEC) DEF(arm_ushl_vec, 1, 2, 0, IMPLVEC) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 2a664a750d..5cae6b2749 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -215,6 +215,7 @@ typedef enum { INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ INSN_VSARI = 0xf2800010, /* VSHR.S */ INSN_VSHRI = 0xf3800010, /* VSHR.U */ + INSN_VSLI = 0xf3800510, INSN_VSHL_S = 0xf2000400, /* VSHL.S (register) */ INSN_VSHL_U = 0xf3000400, /* VSHL.U (register) */ @@ -2400,6 +2401,8 @@ static int tcg_target_op_def(TCGOpcode op) case INDEX_op_arm_sshl_vec: case INDEX_op_arm_ushl_vec: return C_O1_I2(w, w, w); + case INDEX_op_arm_sli_vec: + return C_O1_I2(w, 0, w); case INDEX_op_or_vec: case INDEX_op_andc_vec: return C_O1_I2(w, w, wO); @@ -2815,6 +2818,9 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sari_vec: tcg_out_vshifti(s, INSN_VSARI, q, a0, a1, (16 << vece) - a2); return; + case INDEX_op_arm_sli_vec: + tcg_out_vshifti(s, INSN_VSLI, q, a0, a2, args[3] + (8 << vece)); + return; case INDEX_op_andc_vec: if (!const_args[2]) { @@ -2943,6 +2949,7 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shlv_vec: case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: + case INDEX_op_rotli_vec: return -1; default: return 0; @@ -2988,6 +2995,14 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, tcg_temp_free_vec(t1); break; + case INDEX_op_rotli_vec: + t1 = tcg_temp_new_vec(type); + tcg_gen_shri_vec(vece, t1, v1, -a2 & ((8 << vece) - 1)); + vec_gen_4(INDEX_op_arm_sli_vec, type, vece, + tcgv_vec_arg(v0), tcgv_vec_arg(t1), tcgv_vec_arg(v1), a2); + tcg_temp_free_vec(t1); + break; + default: g_assert_not_reached(); } From patchwork Thu Dec 24 22:45:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 351945 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7335534jai; Thu, 24 Dec 2020 14:58:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWCPRxLkHp2F0JwC1xdUvz9v035XnSfIAUhlviD4ODGyyNsBxhicYFzDRc1kNsTs9t2Mhm X-Received: by 2002:a25:6405:: with SMTP id y5mr47294721ybb.328.1608850733446; Thu, 24 Dec 2020 14:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608850733; cv=none; d=google.com; s=arc-20160816; b=f0+u03jmnfUD4oM4rpd5uyj0EZWU0Ki9RrIAI9j6IIMryFWnAa6UYyyE2x00jyMNsv GXY/rqVTZQvmFxfQsdiSPlg1zwkiwzD8aWIn48L7QRrrGKxRnjh1M8s2oNri+YONRFdY uobE+yjusmxs/voDxQZRl12JOb/6bAyya4lcJA5QJNDptf3gFyDpZ1ysPG2mI2WbCTl4 YBgUH/WIKvVOn0HHwJ2qleFmoLfpG1QlZ7le90PKUlqS1YXPK1RhfFQzC/10SDo7JRTn 3ldnKo8HNCfUwRXcuymTsb83qNyBraJitEC8FjbiO/rFesSJ1r46sekxWHk1kA0wz0Go u8wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=DlWfAj1V1HobWppM64IvoZnE5XLLBPkiFuCARKLkZeU=; b=mCzQzgEzNYYyFZ12xY2l/cw3KdFLZ9DuJgpledFlI976Ywf6Co7IvDGFDv3UWGhGII vtqbfooSr2GZhqsj8610U5FndF39+0ka9AByI+ZWG7VcrZ3fyhDCIbeKDFj0oM+W9KYi 2Bcj7La4rYKx1fFZHCAZZHzzKqt29kQ6gq2A83uy1va2P50WBMdxT3nkuQ7NmPRkHfet kKLOAmr6T2yvjBydQQoUFboBTw/f5OQKalgNb98zS8dz+ChJ2SNUoxWXTf7HCMXzAV8E PhpI/9dVUVAyphVrIsAq3iaWvPXMTWIeMkVxSnmxrFsIevdHDGwa1CzRQVuHy6P0JRlV xDZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rBL+J3Lf; 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 r144si27224405ybc.16.2020.12.24.14.58.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 14:58:53 -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=pass header.i=@linaro.org header.s=google header.b=rBL+J3Lf; 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]:34072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksZZM-00081r-Vv for patch@linaro.org; Thu, 24 Dec 2020 17:58:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksZMZ-00024f-VG for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:40 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:41810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksZMU-0008M9-Tl for qemu-devel@nongnu.org; Thu, 24 Dec 2020 17:45:38 -0500 Received: by mail-pg1-x533.google.com with SMTP id i7so2265221pgc.8 for ; Thu, 24 Dec 2020 14:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DlWfAj1V1HobWppM64IvoZnE5XLLBPkiFuCARKLkZeU=; b=rBL+J3LfRAKvMuW8p16dvFjIAKrRwx/CzBqTuHMhX+E+Q+rhs109W/iAjyZ8OzwOVy y74PAj1NYMZ3fuPNtu6r5fSooVnEfxM9ejpB38r/PZDkhPzioP9EGYHk1Tbj6ESGIYcc BRsj9pBt/zt4GEkH7sXzfzMti/sfdqq1hmqFyDK4xGd1iadKqBPHNekZcTPBUccr7Im0 Sf+/+UAM7uexy7I12XW/8nkA2tkA85AVQOeOeMacKTvb1MhSLlAyBBTxBz6SrRSE9X63 kSo7nsIBfw9l4j1tE9pFUf4d/2t13F+JKyhMtm1g0YPGGP7XUbJF/zM4qbQDC6A6sPh7 z+TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DlWfAj1V1HobWppM64IvoZnE5XLLBPkiFuCARKLkZeU=; b=g3kb3D3TA7e97W5+CU2z3L2IIFSwwj8nKWujt2DjPQ12vaK9lL5uQOEahjFj+PwSE5 fuSdyfiRQxeVTrRRAX1EW1qJwD/M9gsMA31+aaR6cIBPlsk73VVTpqD/Dt0c3oKnhxtj WkrdDv4SnKYuuNjAT8mf48MXdu8P08JQJWmgWb28E5ZhYs0vWr+ZWmhBZ9AYYhQ5jbFS nGtsKRi9ETYVRhcJViRRAfmg0WI8EL66MOIjfncAZ4Yw7nFJZ5yPWXFX3wA4XaUu+RIN FIuju8jUrixcreRozBwc3LY0ZivyGR8p5zidaiENEyMCQk8cZu5lyl+guQ4+/35MON3e Yxbw== X-Gm-Message-State: AOAM532ByU9kRRHO2BeYvNXrxun7yYkgOTj4kh2NdaqPpIlCs0OXjgjv SN6Vl9tHcP+1QN/3A0NRTsO/98VnorqYDA== X-Received: by 2002:a62:2cc3:0:b029:197:dda8:476a with SMTP id s186-20020a622cc30000b0290197dda8476amr7742078pfs.37.1608849932058; Thu, 24 Dec 2020 14:45:32 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id w11sm11844123pge.28.2020.12.24.14.45.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 14:45:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/15] tcg/arm: Implement TCG_TARGET_HAS_rotv_vec Date: Thu, 24 Dec 2020 14:45:14 -0800 Message-Id: <20201224224514.626561-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201224224514.626561-1-richard.henderson@linaro.org> References: <20201224224514.626561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement via expansion, so don't actually set TCG_TARGET_HAS_rotv_vec. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 5cae6b2749..f107478877 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -2950,6 +2950,8 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) case INDEX_op_shrv_vec: case INDEX_op_sarv_vec: case INDEX_op_rotli_vec: + case INDEX_op_rotlv_vec: + case INDEX_op_rotrv_vec: return -1; default: return 0; @@ -2960,7 +2962,7 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, TCGArg a0, ...) { va_list va; - TCGv_vec v0, v1, v2, t1; + TCGv_vec v0, v1, v2, t1, t2, t3; TCGArg a2; va_start(va, a0); @@ -3003,6 +3005,35 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, tcg_temp_free_vec(t1); break; + case INDEX_op_rotlv_vec: + t1 = tcg_temp_new_vec(type); + t2 = tcg_constant_vec(type, vece, 8 << vece); + tcg_gen_sub_vec(vece, t1, v2, t2); + /* Right shifts are negative left shifts for AArch64. */ + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t1), + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(v0), + tcgv_vec_arg(v1), tcgv_vec_arg(v2)); + tcg_gen_or_vec(vece, v0, v0, t1); + tcg_temp_free_vec(t1); + break; + + case INDEX_op_rotrv_vec: + t1 = tcg_temp_new_vec(type); + t2 = tcg_temp_new_vec(type); + t3 = tcg_constant_vec(type, vece, 8 << vece); + tcg_gen_neg_vec(vece, t1, v2); + tcg_gen_sub_vec(vece, t2, t3, v2); + /* Right shifts are negative left shifts for AArch64. */ + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t1), + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t2), + tcgv_vec_arg(v1), tcgv_vec_arg(t2)); + tcg_gen_or_vec(vece, v0, t1, t2); + tcg_temp_free_vec(t1); + tcg_temp_free_vec(t2); + break; + default: g_assert_not_reached(); }