From patchwork Sat May 2 22:44:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186066 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2285599ilf; Sat, 2 May 2020 15:48:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLkAMsVe8lceOcdFe2c5hZj+a+ZnIdqN57gfd9NZom99ryrjSxsKz9/gSr4xChuYDJm30Ha X-Received: by 2002:a37:3c2:: with SMTP id 185mr9423432qkd.123.1588459721062; Sat, 02 May 2020 15:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588459721; cv=none; d=google.com; s=arc-20160816; b=bCg3xMG8xMoVzs953M5BZxeZF3zxSEQILToUag7ooav4cJb3nvIH5Zjz/YHdfbaX5X 0lxjGNEmqzyRnAxOXZ5a18Mxz0vktjP5AeW/Y3o91k/+pkf1Mik2jfls0CFsw/fjFKDT yw/crzIeFfMGQl2YFJawFTVa3B0mX4fmksZjGvsIP3m9m8qz0K5oaqVMyIsAn1BM963J YTOaflg1QQTr3XL/EnabjhGZY0IJ8Om9E/IcrKj7Qcyj6rldGvXzT4HSJK0KOvKSxpYO sc74VyH4ZwFncuhmW3RYuGLXElsLzAMUD0rC1ZpbaVLk4TzdLnveMlTexhBUB88yLPAV IodQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SGz8AkTuw4m2K0/Y+X8G2iZzicXAVy+z9HaUzJVjiyw=; b=xdS3YPmFukWnSSZpdpUZyN67nmyj6OwdrPE37uiVr0QH1fxo2Bn4+c4pPg2tTilIbc gDgkGP5auSAZ8TrTcYhDA6Cf/Mvg4pubh81JPS2nJM4YZVFQ2yW/2UZed8bn8SLu38JV kcX0yn3n78J3kClasCnXqacl1us4tNwJCSahOSj6SP5mrgtdOUdDy0js6Wh5ftA+pCHg Vu42Y8JY/kOXMbaZlUm5D6zluifIy2w4WGAbCpWXNGv+RRXT3pKZl+xuM/Rb2hf37QbZ 0ET8DbfeQ1e3wQS5ci+q/fiSgN883e7GDHLV283T+xQ++qkBTlbBvJs6sycYvzXzBRG5 Amlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WG28M6n9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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. [2001:470:142::17]) by mx.google.com with ESMTPS id w50si4095785qtj.31.2020.05.02.15.48.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 May 2020 15:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WG28M6n9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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]:42548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jV0w4-0001GM-DA for patch@linaro.org; Sat, 02 May 2020 18:48:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jV0sn-0003ES-Mi for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jV0sm-0004i7-Pb for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:17 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:33986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jV0sm-0004eg-7v for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:16 -0400 Received: by mail-pl1-x643.google.com with SMTP id s10so5199599plr.1 for ; Sat, 02 May 2020 15:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SGz8AkTuw4m2K0/Y+X8G2iZzicXAVy+z9HaUzJVjiyw=; b=WG28M6n9jGMfmZK8eGrGKV06ifVIOSEuxewCJp/5bxAzk8ucgmF9rf53j1LSXLrR7R JzSW4fcibt9ULmZdtmnKuQpUTV1a9ZwexDl0xsNfVO/sX6RPaq5wZr9Y014gsuPdQm2s KOsXVMCi+b6/ziCiTSRgmRar7ZRr/XuhEDgPTPhc5BZih7abHnN2sOLZT6dfrFu6jegy 8xM9Ox6P7kWjl9wyrs9txOKke7J1VKU4Nrisky9rIGh0/K7fveqcYVDVqsnm6uza5f0N rOjP+J5kBUaf8B1UN0wqvuTU1aPOjbytgjb3GO9c4Rj20eccV8AZlnWSQCnMJbh+6J2s ZS+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SGz8AkTuw4m2K0/Y+X8G2iZzicXAVy+z9HaUzJVjiyw=; b=dMIV0F3F00nPTJdtK8X+ztvvBeEDrPKMavPhZ5KGYchZOfOdiiZ5VUsFeyFscNYWnd q/kqV2/WbWeiVUp+XQc3jn/rKvxiR0pdMEHH3/RuUvxs/4i2PvFmNQ70bZ0xonX3ff/p hxroDuBGElOEs/9Wo9SbuAX1oqquAmpYc7YOU+uipW6odZsEQwwikv4flCYwInVey5J8 93vwYa5JXv7R/OCmzoqjx78ts/vubspmjSVSLQQcBtkBndIgX4gqA4RxETeMSLfgdiIu goBTTHUOUUdcrkFg7zUcw7dvSxJxn9x/oDOEj8Vq/Ot75AoEDJRxG+7epQivetNU/lUa /q+w== X-Gm-Message-State: AGi0PuYsijIKe1HcKQJL0+fCeMEIwvUCvTPa+4+BKOlUW/7rjCmvzYJf 6LTjnm+lX0CzwqE9kBNlNJm7LiuVMBA= X-Received: by 2002:a17:902:a60a:: with SMTP id u10mr10666516plq.249.1588459514622; Sat, 02 May 2020 15:45:14 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id h5sm2956182pjv.4.2020.05.02.15.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 May 2020 15:45:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/15] target/arm: Wrap vector mla/mls GVecGen3 in GVecGen3Fn Date: Sat, 2 May 2020 15:44:55 -0700 Message-Id: <20200502224503.2282-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200502224503.2282-1-richard.henderson@linaro.org> References: <20200502224503.2282-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::643 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations. Signed-off-by: Richard Henderson --- target/arm/translate.h | 7 ++- target/arm/translate-a64.c | 4 +- target/arm/translate.c | 124 ++++++++++++++++++++----------------- 3 files changed, 74 insertions(+), 61 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.h b/target/arm/translate.h index 20ec9cedd7..4fbcdf1294 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -286,8 +286,11 @@ void gen_gvec_cle0(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, void gen_gvec_cge0(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); -extern const GVecGen3 mla_op[4]; -extern const GVecGen3 mls_op[4]; +void gen_gvec_mla(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_mls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); + extern const GVecGen3 cmtst_op[4]; extern const GVecGen3 sshl_op[4]; extern const GVecGen3 ushl_op[4]; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 8208651394..2b5ae4d43a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11243,9 +11243,9 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) return; case 0x12: /* MLA, MLS */ if (u) { - gen_gvec_op3(s, is_q, rd, rn, rm, &mls_op[size]); + gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_mls, size); } else { - gen_gvec_op3(s, is_q, rd, rn, rm, &mla_op[size]); + gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_mla, size); } return; case 0x11: diff --git a/target/arm/translate.c b/target/arm/translate.c index b08c4a2527..da807242ff 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4792,62 +4792,69 @@ static void gen_mls_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) /* Note that while NEON does not support VMLA and VMLS as 64-bit ops, * these tables are shared with AArch64 which does support them. */ +void gen_gvec_mla(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_mul_vec, INDEX_op_add_vec, 0 + }; + static const GVecGen3 ops[4] = { + { .fni4 = gen_mla8_i32, + .fniv = gen_mla_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_8 }, + { .fni4 = gen_mla16_i32, + .fniv = gen_mla_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fni4 = gen_mla32_i32, + .fniv = gen_mla_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fni8 = gen_mla64_i64, + .fniv = gen_mla_vec, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); +} -static const TCGOpcode vecop_list_mla[] = { - INDEX_op_mul_vec, INDEX_op_add_vec, 0 -}; - -static const TCGOpcode vecop_list_mls[] = { - INDEX_op_mul_vec, INDEX_op_sub_vec, 0 -}; - -const GVecGen3 mla_op[4] = { - { .fni4 = gen_mla8_i32, - .fniv = gen_mla_vec, - .load_dest = true, - .opt_opc = vecop_list_mla, - .vece = MO_8 }, - { .fni4 = gen_mla16_i32, - .fniv = gen_mla_vec, - .load_dest = true, - .opt_opc = vecop_list_mla, - .vece = MO_16 }, - { .fni4 = gen_mla32_i32, - .fniv = gen_mla_vec, - .load_dest = true, - .opt_opc = vecop_list_mla, - .vece = MO_32 }, - { .fni8 = gen_mla64_i64, - .fniv = gen_mla_vec, - .prefer_i64 = TCG_TARGET_REG_BITS == 64, - .load_dest = true, - .opt_opc = vecop_list_mla, - .vece = MO_64 }, -}; - -const GVecGen3 mls_op[4] = { - { .fni4 = gen_mls8_i32, - .fniv = gen_mls_vec, - .load_dest = true, - .opt_opc = vecop_list_mls, - .vece = MO_8 }, - { .fni4 = gen_mls16_i32, - .fniv = gen_mls_vec, - .load_dest = true, - .opt_opc = vecop_list_mls, - .vece = MO_16 }, - { .fni4 = gen_mls32_i32, - .fniv = gen_mls_vec, - .load_dest = true, - .opt_opc = vecop_list_mls, - .vece = MO_32 }, - { .fni8 = gen_mls64_i64, - .fniv = gen_mls_vec, - .prefer_i64 = TCG_TARGET_REG_BITS == 64, - .load_dest = true, - .opt_opc = vecop_list_mls, - .vece = MO_64 }, -}; +void gen_gvec_mls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) +{ + static const TCGOpcode vecop_list[] = { + INDEX_op_mul_vec, INDEX_op_sub_vec, 0 + }; + static const GVecGen3 ops[4] = { + { .fni4 = gen_mls8_i32, + .fniv = gen_mls_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_8 }, + { .fni4 = gen_mls16_i32, + .fniv = gen_mls_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_16 }, + { .fni4 = gen_mls32_i32, + .fniv = gen_mls_vec, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_32 }, + { .fni8 = gen_mls64_i64, + .fniv = gen_mls_vec, + .prefer_i64 = TCG_TARGET_REG_BITS == 64, + .load_dest = true, + .opt_opc = vecop_list, + .vece = MO_64 }, + }; + tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, opr_sz, max_sz, &ops[vece]); +} /* CMTST : test is "if (X & Y != 0)". */ static void gen_cmtst_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) @@ -5529,8 +5536,11 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) return 0; case NEON_3R_VML: /* VMLA, VMLS */ - tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size, - u ? &mls_op[size] : &mla_op[size]); + if (u) { + gen_gvec_mls(size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); + } else { + gen_gvec_mla(size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size); + } return 0; case NEON_3R_VTST_VCEQ: