From patchwork Wed Jun 19 20:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 805640 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp14261wrt; Wed, 19 Jun 2024 14:02:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWED3arGgedQYnLKWhnqKaT98cpjol3MdO72Gc2NBAlF+n39IDamcqJxM+eDkZl7w0K7SuLrDB6bNbXPTawfAfA X-Google-Smtp-Source: AGHT+IF5u3i9M356Inf4hGLGo5147sMcEdX8EYeWJ6+TUG3dX55CiErZcdIx0GwYe6WDqo+0pdeK X-Received: by 2002:a05:622a:44f:b0:43e:26ab:4fc1 with SMTP id d75a77b69052e-444a7a5e95dmr35416211cf.42.1718830931301; Wed, 19 Jun 2024 14:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718830931; cv=none; d=google.com; s=arc-20160816; b=VJ+YpYfNUb7AOyPvFFq7TOVyGT31zZ4tg4PG21jO8xL2W0ICYRCXIcY+m/0mXSRkra 9MTWRsWAqovifBvZUILH4zmLVshngAn98lr7ImxSVgsFpi2h69zPV9z3GKayOgXy3pfw 5zbZrzF6lYZfJlkzbc6JA72wg/C3YScHlijWJBv8DEl030V1Qfx4saYlau/R8HLsMOpX Mz5dNTQqVahIU7D+NjWEDPfkWI7nC/tt2o7u/+pH+//Grntp7839D/5eKrUSx8j+XGH6 xo4LMstjAKUQgUBViMBKXKx5LpDm6rhR085COpRaJ38YVZxZbCDJWVlqHzufSRnP1g1r TelQ== 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=QaWwTBCdRRXgMoR1CYWn0PFxysR4ccqinTVsqlx0hVw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=EVnLKWY90SjF18rnMdWeaE/tb6fbIOzmMloMuXaexCqtVTXfjLavTpy0CNnM5LcTSK 6f2IQNhXFOWppvzkkstRkqNRQrGvTs1MM6aMxGDwUwWZXwGoq8sQdedkqdL5gU1PLmZ5 BFrY2k9sBVeXPogO5EKWBmSzTzXUFNvepSiSgXA3T8pKiKSIxe0DtdSFY6jkW57pBWia tmHLRBjmgZH4P8gJVIa10a+bnWQWlXreu6i1h0ymIK8Q3cpevwhG3GWal38RZtv798F9 +wQ6xCdGVL51PrBTMU/FAdFgZFZnOjoA02CaY4M6JLZ7Vhsb1/3pXtArIUVXbiLjA2ao C9gg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d6nK09Vs; 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 d75a77b69052e-444aba43300si22566691cf.101.2024.06.19.14.02.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2024 14:02:11 -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=d6nK09Vs; 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 1sK2Pf-0002IX-5r; Wed, 19 Jun 2024 17:00:15 -0400 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 1sK2Pd-0002Gd-LA for qemu-devel@nongnu.org; Wed, 19 Jun 2024 17:00:13 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sK2Pa-0000bD-Cw for qemu-devel@nongnu.org; Wed, 19 Jun 2024 17:00:13 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-6e4dbca52f0so177575a12.0 for ; Wed, 19 Jun 2024 14:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718830808; x=1719435608; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QaWwTBCdRRXgMoR1CYWn0PFxysR4ccqinTVsqlx0hVw=; b=d6nK09VswNkxvHfRMkGC3tlhKGZxyNEo73nHhILruNeo2XyoKY8POQojy8mibc4ikb m/SWka26+B3iDYr/iPN5cMhfqM2y3dhPEacXhVLPyK9FrnUpAzBUWkv5Zix0xxSeKEEd ewXpiqtgXwXFMA8y6Ncmn1rgeQc9BOsiIgBfFQcGRTuT3AxbnpUKHw29LNHmIfou2E6K kGQVG718wwCPe9luqJ6o2Xrpp/2SsN5vcHMvM9DleXHNGXVFMJrxYCVoz45a4TBQtcTZ ygxxGHN4TUScP6/ZETbFmxbl3gxGEaEWd++qg7XPwHUnqNxeY+kDc8yWS7Otq2n5vmhq jvCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718830808; x=1719435608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QaWwTBCdRRXgMoR1CYWn0PFxysR4ccqinTVsqlx0hVw=; b=CvsxTn9i+fwJoSHUiZwE9+rEN6lY6XWsLf+IxFlFIAMfvJXAmCt5+tAljzRBv7DT3o xg3Zrq4uf3wNZky//j7Nc8SMIfL4OJ9tipNgTpwYGL7DSejETVwvW+hT8/VWozq+Biq8 sQgJBn9PdppvQrlKomPh4LJ1QTTieOdk8WB92hdYRCYjXR2QaUjaYbOHETMSEdIfMkcl rV8ZjkL7l+nrl6iz/2LkddfEsdxS3zCRy6aRJ0KewpHzBb6pP2ylxZSaUn7inyk9Kk41 oLvS4XgQmf7JbZQV9BdOV13CspF5lZKFz3/uam9YAfMf1Wf0IgDko5VozgMOKLHTKTP8 JCUg== X-Gm-Message-State: AOJu0YwDzpcMjD9RKTKfd3PksmAkRoZ4TzTQTtk61/JCl9jGuNYPQGrT UFnqVBNrVtE9WPd1WJb7ZbsXQCXx9FEegiA9hMfqiXbND2L+p11Jv9B+xKUSxtI1CEfDmvIyJ50 X X-Received: by 2002:a17:903:11ce:b0:1f4:b859:cb60 with SMTP id d9443c01a7336-1f9aa396f5amr39165055ad.10.1718830806656; Wed, 19 Jun 2024 14:00:06 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f98f8f8c42sm39183765ad.162.2024.06.19.14.00.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 14:00:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/24] tcg/loongarch64: Split out vdvjvk in tcg_out_vec_op Date: Wed, 19 Jun 2024 13:59:41 -0700 Message-Id: <20240619205952.235946-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619205952.235946-1-richard.henderson@linaro.org> References: <20240619205952.235946-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Signed-off-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 119 ++++++++++++++++--------------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 652aa261a3..8f5f38aa0a 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1900,49 +1900,55 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out_ld(s, type, a0, a1, a2); break; case INDEX_op_and_vec: - tcg_out_opc_vand_v(s, a0, a1, a2); - break; + insn = OPC_VAND_V; + goto vdvjvk; case INDEX_op_andc_vec: /* * vandn vd, vj, vk: vd = vk & ~vj * andc_vec vd, vj, vk: vd = vj & ~vk - * vk and vk are swapped + * vj and vk are swapped */ - tcg_out_opc_vandn_v(s, a0, a2, a1); - break; + a1 = a2; + a2 = args[1]; + insn = OPC_VANDN_V; + goto vdvjvk; case INDEX_op_or_vec: - tcg_out_opc_vor_v(s, a0, a1, a2); - break; + insn = OPC_VOR_V; + goto vdvjvk; case INDEX_op_orc_vec: - tcg_out_opc_vorn_v(s, a0, a1, a2); - break; + insn = OPC_VORN_V; + goto vdvjvk; case INDEX_op_xor_vec: - tcg_out_opc_vxor_v(s, a0, a1, a2); - break; - case INDEX_op_nor_vec: - tcg_out_opc_vnor_v(s, a0, a1, a2); - break; + insn = OPC_VXOR_V; + goto vdvjvk; case INDEX_op_not_vec: - tcg_out_opc_vnor_v(s, a0, a1, a1); - break; + a2 = a1; + /* fall through */ + case INDEX_op_nor_vec: + insn = OPC_VNOR_V; + goto vdvjvk; case INDEX_op_cmp_vec: { TCGCond cond = args[3]; + if (const_args[2]) { /* * cmp_vec dest, src, value * Try vseqi/vslei/vslti */ int64_t value = sextract64(a2, 0, 8 << vece); - if ((cond == TCG_COND_EQ || cond == TCG_COND_LE || \ - cond == TCG_COND_LT) && (-0x10 <= value && value <= 0x0f)) { - tcg_out32(s, encode_vdvjsk5_insn(cmp_vec_imm_insn[cond][vece], \ - a0, a1, value)); + if ((cond == TCG_COND_EQ || + cond == TCG_COND_LE || + cond == TCG_COND_LT) && + (-0x10 <= value && value <= 0x0f)) { + insn = cmp_vec_imm_insn[cond][vece]; + tcg_out32(s, encode_vdvjsk5_insn(insn, a0, a1, value)); break; - } else if ((cond == TCG_COND_LEU || cond == TCG_COND_LTU) && - (0x00 <= value && value <= 0x1f)) { - tcg_out32(s, encode_vdvjuk5_insn(cmp_vec_imm_insn[cond][vece], \ - a0, a1, value)); + } else if ((cond == TCG_COND_LEU || + cond == TCG_COND_LTU) && + (0x00 <= value && value <= 0x1f)) { + insn = cmp_vec_imm_insn[cond][vece]; + tcg_out32(s, encode_vdvjuk5_insn(insn, a0, a1, value)); break; } @@ -1963,9 +1969,8 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, insn = cmp_vec_insn[cond][vece]; tcg_debug_assert(insn != 0); } - tcg_out32(s, encode_vdvjvk_insn(insn, a0, a1, a2)); } - break; + goto vdvjvk; case INDEX_op_add_vec: tcg_out_addsub_vec(s, false, vece, a0, a1, a2, const_args[2], true); break; @@ -1976,41 +1981,41 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, tcg_out32(s, encode_vdvj_insn(neg_vec_insn[vece], a0, a1)); break; case INDEX_op_mul_vec: - tcg_out32(s, encode_vdvjvk_insn(mul_vec_insn[vece], a0, a1, a2)); - break; + insn = mul_vec_insn[vece]; + goto vdvjvk; case INDEX_op_smin_vec: - tcg_out32(s, encode_vdvjvk_insn(smin_vec_insn[vece], a0, a1, a2)); - break; + insn = smin_vec_insn[vece]; + goto vdvjvk; case INDEX_op_smax_vec: - tcg_out32(s, encode_vdvjvk_insn(smax_vec_insn[vece], a0, a1, a2)); - break; + insn = smax_vec_insn[vece]; + goto vdvjvk; case INDEX_op_umin_vec: - tcg_out32(s, encode_vdvjvk_insn(umin_vec_insn[vece], a0, a1, a2)); - break; + insn = umin_vec_insn[vece]; + goto vdvjvk; case INDEX_op_umax_vec: - tcg_out32(s, encode_vdvjvk_insn(umax_vec_insn[vece], a0, a1, a2)); - break; + insn = umax_vec_insn[vece]; + goto vdvjvk; case INDEX_op_ssadd_vec: - tcg_out32(s, encode_vdvjvk_insn(ssadd_vec_insn[vece], a0, a1, a2)); - break; + insn = ssadd_vec_insn[vece]; + goto vdvjvk; case INDEX_op_usadd_vec: - tcg_out32(s, encode_vdvjvk_insn(usadd_vec_insn[vece], a0, a1, a2)); - break; + insn = usadd_vec_insn[vece]; + goto vdvjvk; case INDEX_op_sssub_vec: - tcg_out32(s, encode_vdvjvk_insn(sssub_vec_insn[vece], a0, a1, a2)); - break; + insn = sssub_vec_insn[vece]; + goto vdvjvk; case INDEX_op_ussub_vec: - tcg_out32(s, encode_vdvjvk_insn(ussub_vec_insn[vece], a0, a1, a2)); - break; + insn = ussub_vec_insn[vece]; + goto vdvjvk; case INDEX_op_shlv_vec: - tcg_out32(s, encode_vdvjvk_insn(shlv_vec_insn[vece], a0, a1, a2)); - break; + insn = shlv_vec_insn[vece]; + goto vdvjvk; case INDEX_op_shrv_vec: - tcg_out32(s, encode_vdvjvk_insn(shrv_vec_insn[vece], a0, a1, a2)); - break; + insn = shrv_vec_insn[vece]; + goto vdvjvk; case INDEX_op_sarv_vec: - tcg_out32(s, encode_vdvjvk_insn(sarv_vec_insn[vece], a0, a1, a2)); - break; + insn = sarv_vec_insn[vece]; + goto vdvjvk; case INDEX_op_shli_vec: tcg_out32(s, encode_vdvjuk3_insn(shli_vec_insn[vece], a0, a1, a2)); break; @@ -2020,15 +2025,14 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, case INDEX_op_sari_vec: tcg_out32(s, encode_vdvjuk3_insn(sari_vec_insn[vece], a0, a1, a2)); break; - case INDEX_op_rotrv_vec: - tcg_out32(s, encode_vdvjvk_insn(rotrv_vec_insn[vece], a0, a1, a2)); - break; case INDEX_op_rotlv_vec: /* rotlv_vec a1, a2 = rotrv_vec a1, -a2 */ tcg_out32(s, encode_vdvj_insn(neg_vec_insn[vece], temp_vec, a2)); - tcg_out32(s, encode_vdvjvk_insn(rotrv_vec_insn[vece], a0, a1, - temp_vec)); - break; + a2 = temp_vec; + /* fall through */ + case INDEX_op_rotrv_vec: + insn = rotrv_vec_insn[vece]; + goto vdvjvk; case INDEX_op_rotli_vec: /* rotli_vec a1, a2 = rotri_vec a1, -a2 */ a2 = extract32(-a2, 0, 3 + vece); @@ -2058,6 +2062,9 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, break; default: g_assert_not_reached(); + vdvjvk: + tcg_out32(s, encode_vdvjvk_insn(insn, a0, a1, a2)); + break; } }