From patchwork Tue Jun 29 18:54:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468339 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5255291jao; Tue, 29 Jun 2021 12:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF8t7bRlUQjOuHshWWcIhFlOINAVnqhSc/E00Ufccqz33ktXzGT41EZA6dsdEfp9myPag2 X-Received: by 2002:a05:6122:6aa:: with SMTP id r10mr12903626vkq.24.1624995194251; Tue, 29 Jun 2021 12:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995194; cv=none; d=google.com; s=arc-20160816; b=K6goVv9mBE02ARoVjSbKpZt7DDktUdOh0hZle+aHh+ju/ApKvVqtJKaRaYypHzkvXh 1iLGJnJ0XjABvqMT0U6Wa3ERn3JXPmVzzk+ISzrCiAOQ8cFkWUNGr3HtPB0Tjm84YEgD QYEkZCYo18wkl5nXcXl2tgZwbKakJzl3oyqR6thfZxq0XeMmp8x8Eq66nQRRbNvHA378 0GimIB2wuHLbBdsXP5TGUNsFaLiavHtNc9kZMJdSaCe6jh2SR6PhdJw2md2TXplxLyFw UPc8PxsuemcFJHrRRAY6ke7uwlTG3v8KAXx4Ye7hW3DVp5XjcXyeYah6iqgGFUnp2iyX KoSw== 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=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=xWGOUjJKqUS+FXAsZPz/ySZ3wgLB+SfK70snx4MUL0HdLL/MX9njmrgjnJhTNgsyGk 0Ghz+EfA8dRNETjX1P7NlogLXsPQ0NDfpHEglSl2ownb8zxFS4ZJQA7e5W6M2s5mxwY0 0Sj1ZHS+G6vg9/aFT1dkvQuOfop8783YdrH+RfCIIvAuYIak9YkuVeczYSM0iXzIZQxV J044nKfuz/DeIWy/U7lZIxyIyzFal+F8ZXHI1EGPfA4A382cNr0x9gIfbsKsyd7eRSyL UakgCfwVZE87HJh4c1SqHfF5+zB6LlxwMjRkJYVwVx1qb3KTGJgkaZCiUVLbZOMaesWP 2YBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y7k6+5WA; 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 q2si6862396vkg.62.2021.06.29.12.33.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y7k6+5WA; 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]:59274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJTt-0007E9-KX for patch@linaro.org; Tue, 29 Jun 2021 15:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItE-00089f-Li for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyItA-0000uL-2A for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:20 -0400 Received: by mail-pg1-x531.google.com with SMTP id h4so19372828pgp.5 for ; Tue, 29 Jun 2021 11:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=y7k6+5WABYdLN4xRMZtCkO2/rWJsLPwGTf4liJL3rslzUVMJNzqbxRNEvStgim+TaJ ieuWlx3rdfRpOFoVeAMCJ+DuGrNBT/TfJAMj4fAOLH5preEK7pC3jNqyn/iCbQfjy/bx w8B5fiWJKnMBIDW5b8qkNMtUHw5dz5WR/Hhit8BJWaq+Jq2v9itMYCrNTboSWj+7TpaX GKGFsgIqi6Sd/3yX0bBSOZoCzm3XR3ADDWXJ4ZwT7L9Iz7YaxUmb6lYZvK1fNKYv9Qe0 QCf4Nv/L+mQ60TsMH6muyp4Zsapd2f7CUG7XLSCGVxbb+chqt3/Ixjt6QSnHeR8e88Hm Oz2g== 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=z6UwI1RxNTo4T8wHnycHVVtlEB9fHtDjgwur3ezSLaU=; b=PqWngVKcrKFA0VPXFJB9Tx5SNZTgfNdcUoAop+apmrR+viV01kMvqhtFiyTZuhMrbV rzZ1qedSTyyoFPydv9tIMkTTY0IFBPFkORUT5Agst6+BVOyQzXQqGBeXKs+ZeB8WIXU+ AeSw859W7K8pfLyL0kL02x62yaL+vy0CfSpFe6+LvFclKryI8WPVqQGY0qAo/u3Zs2Pl /e8jVywJdYkSUz3xkc8X+mMkGmramKvxrGqppi/wBtEozTeQtmEQvAUFldz9hZjihWvF Tzg3g2vZCFHhW1PLHLWS9MV4qo2AG/LPJNV/lt+hr9ptwg7hws7GW/xh/0uKEddBZ/4b FyHQ== X-Gm-Message-State: AOAM533RIU1av8QgfPiLL8sLK3qz/M3pQsJ/i5K41ZoiJ8EeB5oyHZfa JFrnJMIntUejgMcbf1Jl5j9vX+dAJE9n+w== X-Received: by 2002:a65:5c4a:: with SMTP id v10mr29482050pgr.142.1624992912902; Tue, 29 Jun 2021 11:55:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 29/63] tcg: Add tcg_gen_vec_add{sub}16_i32 Date: Tue, 29 Jun 2021 11:54:21 -0700 Message-Id: <20210629185455.3131172-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LIU Zhiwei Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Implement tcg_gen_vec_add{sub}16_tl by adding corresponding i32 OP. Signed-off-by: LIU Zhiwei Message-Id: <20210624105023.3852-2-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-gvec.h | 13 +++++++++++++ tcg/tcg-op-gvec.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h index c69a7de984..9b67822f54 100644 --- a/include/tcg/tcg-op-gvec.h +++ b/include/tcg/tcg-op-gvec.h @@ -401,4 +401,17 @@ void tcg_gen_vec_sar16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t); void tcg_gen_vec_rotl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c); void tcg_gen_vec_rotl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c); +/* 32-bit vector operations. */ +void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); + +void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b); + +#if TARGET_LONG_BITS == 64 +#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64 +#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64 +#else +#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32 +#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32 +#endif + #endif diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 515db120cc..7ddd56c0e6 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1742,6 +1742,20 @@ void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_addv_mask(d, a, b, m); } +void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t1, a, ~0xffff); + tcg_gen_add_i32(t2, a, b); + tcg_gen_add_i32(t1, t1, b); + tcg_gen_deposit_i32(d, t1, t2, 0, 16); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + void tcg_gen_vec_add32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 t1 = tcg_temp_new_i64(); @@ -1892,6 +1906,20 @@ void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) gen_subv_mask(d, a, b, m); } +void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) +{ + TCGv_i32 t1 = tcg_temp_new_i32(); + TCGv_i32 t2 = tcg_temp_new_i32(); + + tcg_gen_andi_i32(t1, b, ~0xffff); + tcg_gen_sub_i32(t2, a, b); + tcg_gen_sub_i32(t1, a, t1); + tcg_gen_deposit_i32(d, t1, t2, 0, 16); + + tcg_temp_free_i32(t1); + tcg_temp_free_i32(t2); +} + void tcg_gen_vec_sub32_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) { TCGv_i64 t1 = tcg_temp_new_i64();