From patchwork Tue Mar 7 18:35:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 659828 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2540890wrb; Tue, 7 Mar 2023 10:36:52 -0800 (PST) X-Google-Smtp-Source: AK7set8hbWvUfcB0BSZWxiBuK1dVr48tHwCgTlYsBFd9Z6TX44Xawd4PbwoKtcjB5F9Oml8NpZCL X-Received: by 2002:a05:6214:1c09:b0:571:13c:6806 with SMTP id u9-20020a0562141c0900b00571013c6806mr30385045qvc.33.1678214211985; Tue, 07 Mar 2023 10:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678214211; cv=none; d=google.com; s=arc-20160816; b=qA4+Ln1p6mtPF8hHynvOW/j2tzizjbX4Lv9vytuL6A8ExRGkCjNN7NnWprhZl4eFmV X52ALmDBjcOr68X9pjdrKHgErVCN2X1HRC/fLCqfNzcynL0A5zVD7wQYlYd03qNCTpDf wYyQRMgRWGlaF4Tqb6Gr/6TZijLoGUSmqvpRyMxaAe5Ut9NdZ80i/A/kB+MaCMIHRfXJ zgzgY7DuQHJE6eYd16KdwzsRm8uGefWEyt8z6xBWd6ckyZZEuhSTiTy9kbvXycVWW5N+ +OWqFIyvSPwgAev3LBM1u9bb655Wm3fuCObXaTJBhu4POmQAp3GP7qaLph2ZAP3fyMkn 6DdQ== 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:cc:to :from:dkim-signature; bh=VjOIZ5EQv+mPJcXiKX0Fq4Q7ChwmAlVw5eKwrOnmib8=; b=PI3iaS9SKjEGAjdjcAZLd26gIrY9hX52qP7wMH+HbLhzSq5C26r1t2hdkrIfkwG3Mr 0wr9cQP9Ceob6TcpjXg2TD6rrUxEfGsjIAxPRc7LlPz1hnaPnhJLO+1KoszDABPbvgaC WsgJSmS1O8tUHeynVAek1XJiOAG0QPvcx4YSpBbfeWpL3kXKUrEWE4JXjyENLdQuTWdp DwIC8IcW3+kYvKWrqd3L8656VbGX1zvTC9C5SiVfIKD8nHNt2dK+Ntl6EHaaa8CkhKBA dyAfc4ahDwhBAAbKZ33iidXyH6qPQvv5T2mlwaA6oXHOYkKaD4H/tBduU4WApHr0D1tw jHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OS7WBG0c; 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 y6-20020a0ce046000000b0056d4e09a303si9638082qvk.327.2023.03.07.10.36.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 10:36:51 -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=OS7WBG0c; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZc9o-0003r9-KD; Tue, 07 Mar 2023 13:35:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZc9m-0003p4-LO for qemu-devel@nongnu.org; Tue, 07 Mar 2023 13:35:26 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZc9k-0007t6-OX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 13:35:26 -0500 Received: by mail-pj1-x102d.google.com with SMTP id y2so14129344pjg.3 for ; Tue, 07 Mar 2023 10:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678214123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VjOIZ5EQv+mPJcXiKX0Fq4Q7ChwmAlVw5eKwrOnmib8=; b=OS7WBG0c8TQ9K4UQDDJuqtfzys+33+GL1RxqUhBJH2sW/XbLnpl0ryedBAYuXnZg70 o3n1e/ePMy9dfwQRMzC+BKTJ3MB13b2qwkWTPTH7lEepkdoNK+5kpCLZBBgmxMZV6TGm pdMwm4fBcM/xR1em6iBn92J0KlcwI1cPGcW/WeRlZ7KOnCTEyHpTFFGjTIq58OE/1HZc pMQICVWvYCYoPGfv3Edl7Ik3xI5YBQugA7hSNRay8/E1UT0n7FItJmvfDbIMT3Ot6uy2 31gPHjrd+qpVj/J69s5Ld6cvWcj/ZEspHXx1SppSc19Cwdk5dtLVtFDIpcMwmM3wAaQ9 mo5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678214123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VjOIZ5EQv+mPJcXiKX0Fq4Q7ChwmAlVw5eKwrOnmib8=; b=RLe/M2i4RH8+DbszhJITYq54JPNt5hY3jfked82XMivlZhDhxSa+xNhQqf6XqSWnDh 2AnLtK23HFRq3B7rnA5TJWHyxdnB00uri4Vq2UDGxOip5s4FgK9YKE3/K5CEJHc/Wzdd krXn4mNg1+ZvFSs/7BbZxcyUwYmmg54d/oBGwS4I1utMLBR0g/exRA42TcSs2NSs79AB KTwhq1trQ6H2RmZbUub4qit8J/hz+pE42qrqzB8O31tsGz0mf9Bbw4ldnYFEsH+g9SxC VhF13G8Cv4GHNmqUnU4EbLnocQs0aDvxLkocYPx9q2ycL0xWb5HCOEqJLbEaENECntH7 OR6w== X-Gm-Message-State: AO0yUKWEZ6fvdozXIqcMrIIGqGihqRn3MQiACXThbXEcWpEJscupKy2m AxKNlZefJBsxL1DfAiHbDj+ULpdTaJeAEc/iOBA= X-Received: by 2002:a17:90b:1b0f:b0:233:ce0b:8655 with SMTP id nu15-20020a17090b1b0f00b00233ce0b8655mr16117964pjb.28.1678214123437; Tue, 07 Mar 2023 10:35:23 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:b1e0:bfd9:8b1a:efeb]) by smtp.gmail.com with ESMTPSA id q1-20020a17090a1b0100b0022c0a05229fsm7757940pjq.41.2023.03.07.10.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 10:35:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 24/25] tcg: Drop tcg_const_*_vec Date: Tue, 7 Mar 2023 10:35:02 -0800 Message-Id: <20230307183503.2512684-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307183503.2512684-1-richard.henderson@linaro.org> References: <20230307183503.2512684-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.29 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-bounces+patch=linaro.org@nongnu.org Replace with tcg_constant_vec*. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 4 ---- tcg/tcg-op-vec.c | 34 ++-------------------------------- tcg/i386/tcg-target.c.inc | 9 ++++----- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 00c4fbe613..d620012c48 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -999,10 +999,6 @@ void tcg_optimize(TCGContext *s); /* Allocate a new temporary and initialize it with a constant. */ TCGv_i32 tcg_const_i32(int32_t val); TCGv_i64 tcg_const_i64(int64_t val); -TCGv_vec tcg_const_zeros_vec(TCGType); -TCGv_vec tcg_const_ones_vec(TCGType); -TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec); -TCGv_vec tcg_const_ones_vec_matching(TCGv_vec); /* * Locate or create a read-only temporary that is a constant. diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 0f023f42c6..aeeb2435cb 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -229,32 +229,6 @@ void tcg_gen_mov_vec(TCGv_vec r, TCGv_vec a) } } -TCGv_vec tcg_const_zeros_vec(TCGType type) -{ - TCGv_vec ret = tcg_temp_new_vec(type); - tcg_gen_dupi_vec(MO_64, ret, 0); - return ret; -} - -TCGv_vec tcg_const_ones_vec(TCGType type) -{ - TCGv_vec ret = tcg_temp_new_vec(type); - tcg_gen_dupi_vec(MO_64, ret, -1); - return ret; -} - -TCGv_vec tcg_const_zeros_vec_matching(TCGv_vec m) -{ - TCGTemp *t = tcgv_vec_temp(m); - return tcg_const_zeros_vec(t->base_type); -} - -TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) -{ - TCGTemp *t = tcgv_vec_temp(m); - return tcg_const_ones_vec(t->base_type); -} - void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) { TCGTemp *rt = tcgv_vec_temp(r); @@ -431,9 +405,7 @@ void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { - TCGv_vec t = tcg_const_ones_vec_matching(r); - tcg_gen_xor_vec(0, r, a, t); - tcg_temp_free_vec(t); + tcg_gen_xor_vec(0, r, a, tcg_constant_vec_matching(r, 0, -1)); } tcg_swap_vecop_list(hold_list); } @@ -446,9 +418,7 @@ void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) hold_list = tcg_swap_vecop_list(NULL); if (!TCG_TARGET_HAS_neg_vec || !do_op2(vece, r, a, INDEX_op_neg_vec)) { - TCGv_vec t = tcg_const_zeros_vec_matching(r); - tcg_gen_sub_vec(vece, r, t, a); - tcg_temp_free_vec(t); + tcg_gen_sub_vec(vece, r, tcg_constant_vec_matching(r, vece, 0), a); } tcg_swap_vecop_list(hold_list); } diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 4060a35cf6..4444eb9234 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3651,6 +3651,7 @@ static void expand_vec_sari(TCGType type, unsigned vece, break; case MO_64: + t1 = tcg_temp_new_vec(type); if (imm <= 32) { /* * We can emulate a small sign extend by performing an arithmetic @@ -3659,24 +3660,22 @@ static void expand_vec_sari(TCGType type, unsigned vece, * does not, so we have to bound the smaller shift -- we get the * same result in the high half either way. */ - t1 = tcg_temp_new_vec(type); tcg_gen_sari_vec(MO_32, t1, v1, MIN(imm, 31)); tcg_gen_shri_vec(MO_64, v0, v1, imm); vec_gen_4(INDEX_op_x86_blend_vec, type, MO_32, tcgv_vec_arg(v0), tcgv_vec_arg(v0), tcgv_vec_arg(t1), 0xaa); - tcg_temp_free_vec(t1); } else { /* Otherwise we will need to use a compare vs 0 to produce * the sign-extend, shift and merge. */ - t1 = tcg_const_zeros_vec(type); - tcg_gen_cmp_vec(TCG_COND_GT, MO_64, t1, t1, v1); + tcg_gen_cmp_vec(TCG_COND_GT, MO_64, t1, + tcg_constant_vec(type, MO_64, 0), v1); tcg_gen_shri_vec(MO_64, v0, v1, imm); tcg_gen_shli_vec(MO_64, t1, t1, 64 - imm); tcg_gen_or_vec(MO_64, v0, v0, t1); - tcg_temp_free_vec(t1); } + tcg_temp_free_vec(t1); break; default: