From patchwork Wed Sep 9 00:16:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249417 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5018146ilg; Tue, 8 Sep 2020 17:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMnUqTsnOZXXTYtmfJbv2yMG2D6fcup5eblTMTvTSVs0ww9po2vbtd9CD6ZxtLiilw7O1v X-Received: by 2002:a25:d7c5:: with SMTP id o188mr2306693ybg.72.1599611298201; Tue, 08 Sep 2020 17:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599611298; cv=none; d=google.com; s=arc-20160816; b=SVXe1ed4JEkizC8hObME3f/Znyockvy7fgQV7l3oSpG6NW+L3nKizmid5K6cQXPvgE Mp/1C/D8ZABR0ohdNIW6KhktlI+HkLR+9YUIdXFkPJlXWQDbsCIHCY3VJeHqMl08HuGg f8pHkuEQD9FVbr41uKOadby2GgyThBJ9BxeNzAPq7dpDzF0N+we4xce0gBQYqtH1LETE q5fJGl6FoayzZTOmd0XCqEM0umETTrDi8Mc7akpCXf+C37A+0JmDTnsszH2l8mOO36pW g4OQkbvuLtnCG8FOHFpHtJVKGGalisqNw5XLGd3i24wehXsRIp/IwXct9p2BdC7uE4D4 VoCQ== 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=BMREvoHjj8f1EBfCvu7SAC5TIkS0aPkGQG5Rh07Q5oA=; b=UA4W5O8iuToFYqt4zfCi1qfzp3DjS2y/JYKb74H+I57kRlQUEuZOP9waNTJOwLEFoa 5gudTFZY7PyoQsY6GY5YTcBqsi8oEDcLCuBkqJQAv+PZ4Iu9es88+93mKhNjI7oL5TYJ 9LhUVmFgk+rsh1Hj6RoOcrT3Kh+N+7b+zPSx/IEoNOzO/t92dBSHDq7xVbYtZTrhsOWO doadYP+auGeoUZLR6c0QM6XBuidI8AOhwf9Osn/RufQ0LHqqjgZChfMnqLXy20GcNWT4 2Xjy5hJRZqmV94XldpIRdBjB9pajcqjfr+G9RMly1yu59PPtyf7n6KKCW5Q6Jf59F9ub pEIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZpxMCaG8; 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 e194si953168yba.368.2020.09.08.17.28.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Sep 2020 17:28:18 -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=ZpxMCaG8; 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]:58680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFnyD-0008JT-Ln for patch@linaro.org; Tue, 08 Sep 2020 20:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFnnp-0000X3-1k for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:33 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:33747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFnnn-0002Ja-8B for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:32 -0400 Received: by mail-pg1-x544.google.com with SMTP id e33so753711pgm.0 for ; Tue, 08 Sep 2020 17:17:30 -0700 (PDT) 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=BMREvoHjj8f1EBfCvu7SAC5TIkS0aPkGQG5Rh07Q5oA=; b=ZpxMCaG8wjJxmbdxj4VeD3QaUkzX+KW0qxu1LMlSbD2JcdGP+DSF76g4gMu6HQHRUd 8F9mL2HayGWWc5QoYvzjj03biCnPylKdX0byO+2lnORkqcEuBVGZozwtCR8CdEi5I3UR 5hsP6q+KDi/ducnvYgPQzLHt5cAbsccGFd3cMdg8IWhu832Ho9+KVpueHA8P+Q7AHQhn VCKc+P8QdGKINzs6uTjhgJzJ3+wswWioQOjOJ9HuaS2P6xBwjEfcPQkK20r2uVx3vHpU GQy8S5/uHkqxXWWwy+iY/8nJi7lwH6CHMfp3XKqBxSdt4yfQ3gfd9wCx81UIZsed2Shv FOKg== 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=BMREvoHjj8f1EBfCvu7SAC5TIkS0aPkGQG5Rh07Q5oA=; b=UFASN2Gir06Flbzr5IRyaw43hNdBKmjnGehOJIxXboo9iCbryc8xloOT3v256mCf/O 0O6PiMumt9cTw06k/FFlngdoBk80KpvJsoyZuRbgr7g4ovcHlbS00SbbWvzFplLIKK7j Zpc6vTwxufsmLB34XM/poKrwtv9lll8bWRiVGVdJ3S4EmxTmyUzwNf4M5Co/LfzZ2+Bo G2qx2ybgMqOmPqna4TUuD5GiD8iunSydSRADvLIKf/e7Nid60SxgwASYwLHzwrSbvCi3 AJ/C3hs96EqyG7bQ7Z9xmjtADGB5kVZ5h/biRx40uifdilrk0Dz8iCt99RDeQclpdCHa rwRQ== X-Gm-Message-State: AOAM532abnHYIjtxnH2JG7PlV3yzgL0g5xQW1mx/EVJS7DLFZrlVmErA lDBTSUSleeJOxkF9rN0y4Cj2+q3Pb5No4Q== X-Received: by 2002:a63:fe06:: with SMTP id p6mr926551pgh.337.1599610649495; Tue, 08 Sep 2020 17:17:29 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id 137sm505437pfu.149.2020.09.08.17.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:17:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 32/43] tcg/ppc: Use tcg_constant_vec with tcg vec expanders Date: Tue, 8 Sep 2020 17:16:36 -0700 Message-Id: <20200909001647.532249-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200909001647.532249-1-richard.henderson@linaro.org> References: <20200909001647.532249-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::544; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x544.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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" Improve expand_vec_shi to use sign-extraction for MO_32. This allows a single VSPLTISB instruction to load all of the valid shift constants. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 3d23a6b226..155c42ed24 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -3332,13 +3332,22 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, static void expand_vec_shi(TCGType type, unsigned vece, TCGv_vec v0, TCGv_vec v1, TCGArg imm, TCGOpcode opci) { - TCGv_vec t1 = tcg_temp_new_vec(type); + TCGv_vec t1; - /* Splat w/bytes for xxspltib. */ - tcg_gen_dupi_vec(MO_8, t1, imm & ((8 << vece) - 1)); + if (vece == MO_32) { + /* + * Only 5 bits are significant, and VSPLTISB can represent -16..15. + * So using negative numbers gets us the 4th bit easily. + */ + imm = sextract32(imm, 0, 5); + } else { + imm &= (8 << vece) - 1; + } + + /* Splat w/bytes for xxspltib when 2.07 allows MO_64. */ + t1 = tcg_constant_vec(type, MO_8, imm); vec_gen_3(opci, type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v1), tcgv_vec_arg(t1)); - tcg_temp_free_vec(t1); } static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0, @@ -3396,7 +3405,7 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, { TCGv_vec t1 = tcg_temp_new_vec(type); TCGv_vec t2 = tcg_temp_new_vec(type); - TCGv_vec t3, t4; + TCGv_vec c0, c16; switch (vece) { case MO_8: @@ -3415,21 +3424,22 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, case MO_32: tcg_debug_assert(!have_isa_2_07); - t3 = tcg_temp_new_vec(type); - t4 = tcg_temp_new_vec(type); - tcg_gen_dupi_vec(MO_8, t4, -16); + /* + * Only 5 bits are significant, and VSPLTISB can represent -16..15. + * So using -16 is a quick way to represent 16. + */ + c16 = tcg_constant_vec(type, MO_8, -16); + c0 = tcg_constant_vec(type, MO_8, 0); + vec_gen_3(INDEX_op_rotlv_vec, type, MO_32, tcgv_vec_arg(t1), - tcgv_vec_arg(v2), tcgv_vec_arg(t4)); + tcgv_vec_arg(v2), tcgv_vec_arg(c16)); vec_gen_3(INDEX_op_ppc_mulou_vec, type, MO_16, tcgv_vec_arg(t2), tcgv_vec_arg(v1), tcgv_vec_arg(v2)); - tcg_gen_dupi_vec(MO_8, t3, 0); - vec_gen_4(INDEX_op_ppc_msum_vec, type, MO_16, tcgv_vec_arg(t3), - tcgv_vec_arg(v1), tcgv_vec_arg(t1), tcgv_vec_arg(t3)); - vec_gen_3(INDEX_op_shlv_vec, type, MO_32, tcgv_vec_arg(t3), - tcgv_vec_arg(t3), tcgv_vec_arg(t4)); - tcg_gen_add_vec(MO_32, v0, t2, t3); - tcg_temp_free_vec(t3); - tcg_temp_free_vec(t4); + vec_gen_4(INDEX_op_ppc_msum_vec, type, MO_16, tcgv_vec_arg(t1), + tcgv_vec_arg(v1), tcgv_vec_arg(t1), tcgv_vec_arg(c0)); + vec_gen_3(INDEX_op_shlv_vec, type, MO_32, tcgv_vec_arg(t1), + tcgv_vec_arg(t1), tcgv_vec_arg(c16)); + tcg_gen_add_vec(MO_32, v0, t1, t2); break; default: