From patchwork Wed Apr 22 01:17:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185626 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp164682ilf; Tue, 21 Apr 2020 18:24:05 -0700 (PDT) X-Google-Smtp-Source: APiQypLhtF/lzUlLPNNol/OfTLkzrND+cnEfqGtnCPdRebSizck+gKBqBFJCzgTqIOra1LIO4sG7 X-Received: by 2002:a37:6e46:: with SMTP id j67mr23155995qkc.155.1587518645421; Tue, 21 Apr 2020 18:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518645; cv=none; d=google.com; s=arc-20160816; b=EpX845Lrl4zUMZQLm8QB0UDmN0U3eYw72Q1p5C5rdhr7YNklTJ4MEq8IqkqIhaNUMC kPvIowPAsZeYIFJrxZB2TfAcE7KZS1ClrlmiPGeL7muVGVjCy8YNVLul/5csXRjbxKsH P+Ternc3dn0vRm3mZURyHaJjgvZ6nUIMSyQAx+NfAyZQcJiqwGo0x6qZcxWsszWKJv+x WdOvMpNuexnAr/I45r5W4/5mEQGvQkSnAnQxaI5+EPVS+7JASinqBpAduhh2W4a9acrR mh+djXelUyAzTRPS+wg9+U09LjoIB8zZ0ymyQ+H1OPeaNPtN40UPGOIalasRJ59m822e pG9A== 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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=xhEL7RRGHZ7p+JcCSIwQwHkzRjRySubec5OJbAEU55TChoVm6mNdiRVu6Fd1KyjhiZ RbSLBUjuW7w9Qh9gOaBbYuaqu3xfgLA3AcvK9T2TbMIT/AyKO4g7Ugr+fs1NVjM6kyKF oDHOTfwQXZiZhnGDVhtU86nczNuyCowWYh02vD88pkwmS6kcJ5PeMzebmoY6LupZVqCj CD2n9M0HI0qTUYJgqqLYugjEULHxpnGA220XmGWEqDRrOv8iM4CDe+SmHZkII0FvbxUP HfWJPKzW/4NhXAFZl4FRBV04CZ3IndfYW/XKwXv/VLT2mceAXoeeaP3KHgqQSGybrik2 3k9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xzlDTfQH; 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=fail (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 y12si2284718qky.159.2020.04.21.18.24.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:24:05 -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=fail header.i=@linaro.org header.s=google header.b=xzlDTfQH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47Q-0004HI-UC for patch@linaro.org; Tue, 21 Apr 2020 21:24:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34912) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41K-0001ZV-Vi for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41I-0001ng-JL for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:46 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:35014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41I-0001lj-5p for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:44 -0400 Received: by mail-pj1-x1042.google.com with SMTP id ms17so163357pjb.0 for ; Tue, 21 Apr 2020 18:17:43 -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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=xzlDTfQHDWl9Yl7ipMplJS61jujecIZge+sbAyrqCY41SxvC17wz6gQpEyk3ZERa6A n361T43vn6yQVjP1aRlea0iHn6h8wcScNj1xE+4c+u+wFZMP1b2AWvSZkCUfrwakcO4i YtR2zOUWt5j8Bd4oXVNGBEH+uXRbTbHds6Qq34daqnGcCxN1fuo6bLTgFJXBbOVe6j6p KcK9g+OzUi6pS9PNZe/GF/zDB/0YEljmtb9fKMDkf5KR4RYsVI2cCKJIbm0gM1V8G5XT R/ZEuILsuZmc7FA6FK8J/SAW5J8e3/o4xsEpzqF8cs96XWWZERgr3ZrKmofvxmiezRTH Gm3g== 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=jnoGz1Jnxdfh+y+NorE/kRAs3qyr4Q4Rbpyv23cxSxY=; b=YXC+D9SYlQPcYGI/L/74+SjJSjcvloQ0voZQA7MhIvtq0H416BUg3sUBbZGKdcyxw5 ZLunb3z+HacLPEQZuDEEeHIS0Gi2q8KxGZasZ2FKvxKQd3ggCsFsNolz9MkuUvi/u2H4 CzUJm1p20jXCfmp/S6oCQy8Iz6Hi3Nq85uuikocE1U9LSxz66eCf66eiale2mrrUe/mc I6PJWgntO3nIzQTrkEXjstDlmud4XWfrXjR8LujirZfIKtguNpzRrBjo+GWmIc2DhhCk RUTETKT+LSVBc4KcT01Kfd89Y/rLrovr8CR1Z+smakHyQRjdYG/jKc2MLWwoOgEhqxri A+Kg== X-Gm-Message-State: AGi0PuZ+RscMzztc/CqOo/VkphXfeB6SsV6JJP6TEMAIfJEJ5R/P59qx 1K6Iz9vgJsThex90SDh7Ciwyucd0u8I= X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr22995354plb.139.1587518262405; Tue, 21 Apr 2020 18:17:42 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 14/36] tcg: Use tcg_constant_{i32, vec} with tcg vec expanders Date: Tue, 21 Apr 2020 18:17:00 -0700 Message-Id: <20200422011722.13287-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200422011722.13287-1-richard.henderson@linaro.org> References: <20200422011722.13287-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.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::1042 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: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/tcg-op-vec.c | 63 ++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 29 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index f3927089a7..655b3ae32d 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -233,25 +233,17 @@ void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) } } -#define MO_REG (TCG_TARGET_REG_BITS == 64 ? MO_64 : MO_32) - -static void do_dupi_vec(TCGv_vec r, unsigned vece, TCGArg a) -{ - TCGTemp *rt = tcgv_vec_temp(r); - vec_gen_2(INDEX_op_dupi_vec, rt->base_type, vece, temp_arg(rt), a); -} - TCGv_vec tcg_const_zeros_vec(TCGType type) { TCGv_vec ret = tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, 0); + tcg_gen_mov_vec(ret, tcg_constant_vec(type, MO_8, 0)); return ret; } TCGv_vec tcg_const_ones_vec(TCGType type) { TCGv_vec ret = tcg_temp_new_vec(type); - do_dupi_vec(ret, MO_REG, -1); + tcg_gen_mov_vec(ret, tcg_constant_vec(type, MO_8, -1)); return ret; } @@ -267,37 +259,50 @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) return tcg_const_ones_vec(t->base_type); } -void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) +void tcg_gen_dupi_vec(unsigned vece, TCGv_vec dest, uint64_t val) { - if (TCG_TARGET_REG_BITS == 32 && a == deposit64(a, 32, 32, a)) { - do_dupi_vec(r, MO_32, a); - } else if (TCG_TARGET_REG_BITS == 64 || a == (uint64_t)(int32_t)a) { - do_dupi_vec(r, MO_64, a); - } else { - TCGv_i64 c = tcg_const_i64(a); - tcg_gen_dup_i64_vec(MO_64, r, c); - tcg_temp_free_i64(c); + TCGType type = tcgv_vec_temp(dest)->base_type; + + /* + * For MO_64 constants that can't be represented in tcg_target_long, + * we must use INDEX_op_dup2_vec. + */ + if (TCG_TARGET_REG_BITS == 32) { + val = dup_const(vece, val); + if (val != deposit64(val, 32, 32, val) && + val != (uint64_t)(int32_t)val) { + uint32_t vl = extract64(val, 0, 32); + uint32_t vh = extract64(val, 32, 32); + TCGArg al = tcgv_i32_arg(tcg_constant_i32(vl)); + TCGArg ah = tcgv_i32_arg(tcg_constant_i32(vh)); + TCGArg di = tcgv_vec_arg(dest); + + vec_gen_3(INDEX_op_dup2_vec, type, MO_64, di, al, ah); + return; + } } + + tcg_gen_mov_vec(dest, tcg_constant_vec(type, vece, val)); } -void tcg_gen_dup32i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup64i_vec(TCGv_vec dest, uint64_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_32, a)); + tcg_gen_dupi_vec(MO_64, dest, val); } -void tcg_gen_dup16i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup32i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_16, a)); + tcg_gen_dupi_vec(MO_32, dest, val); } -void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) +void tcg_gen_dup16i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(MO_8, a)); + tcg_gen_dupi_vec(MO_16, dest, val); } -void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) +void tcg_gen_dup8i_vec(TCGv_vec dest, uint32_t val) { - do_dupi_vec(r, MO_REG, dup_const(vece, a)); + tcg_gen_dupi_vec(MO_8, dest, val); } void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) @@ -502,8 +507,8 @@ void tcg_gen_abs_vec(unsigned vece, TCGv_vec r, TCGv_vec a) if (tcg_can_emit_vec_op(INDEX_op_sari_vec, type, vece) > 0) { tcg_gen_sari_vec(vece, t, a, (8 << vece) - 1); } else { - do_dupi_vec(t, MO_REG, 0); - tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, t); + tcg_gen_cmp_vec(TCG_COND_LT, vece, t, a, + tcg_constant_vec(type, vece, 0)); } tcg_gen_xor_vec(vece, r, a, t); tcg_gen_sub_vec(vece, r, r, t);