From patchwork Fri Dec 9 02:05:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632230 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp592589pvb; Thu, 8 Dec 2022 18:17:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf63vaHpPbKw3RcaSW5c45gI/oO6nGwzlm38wQcDfHRWbxv27rvg6pAR2YEzMZNKVjL0m9Uc X-Received: by 2002:a05:622a:1e93:b0:3a5:42aa:d59d with SMTP id bz19-20020a05622a1e9300b003a542aad59dmr5809623qtb.37.1670552267925; Thu, 08 Dec 2022 18:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552267; cv=none; d=google.com; s=arc-20160816; b=TZu2OGOOCN/i7AHPwnBuarvWGB04NLGvbHUGbVnV1nbTWaadXCVFll3OoHayJaLNNI N0BzCaNqYcID7olH+e2dWRnKL1Z5EASvHWHnm2qty2tzkzz0I+e5aPXBTB2Mn6EBN6X0 gn2HKIN4w3wG6ltUSo9IsVH9WGG4Jpr9vZZ39oaovkMxjoWLQ7peKFleOut47or2t2MA uDsd3ppadvym62tmPHqDmdvTF6+dspNnZmCs1ETOzK558NDGjnSIcVidzkoaLK25RgCd PCwzxKMNEOibkt4FsbiVaQL/bPpyddMyf4soSHAR/xjyQ7IR2+VJEHszYMD128s7j6LP XFgw== 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=hELIWO/9s4dMzjgjNIgr7btQwZnxqh26ctXstkwJ0Bg=; b=baVHdoD+5sfUag7Ze/aqhiE8YRG9n14tdJQiuCKQODGWRVPvKOCyzSLN1RrazzUDrc xxyiHbGlUOklI3XjsV+Y4fzqN0DeDfH9Q+eH/5qKqVXyEfCx5BSXNWHrdDi3viei3u1T ZkHLGUy8kVmG+CwO+48/s4NbzukqNrh6X9VauB3JAAI8YJcEUU8pmU9mxf4HKU9axw1+ BW+R/f2jeIjlro0hBrdONhdstZy/nFpyTCKMkEN48uiRX1h3ccFRdKxzt9sD6aB+0bfn 46BiFBbJZgXKGqgsI3vylxMVsrXAT65Umo0c8OdFHd1leHqCOjUnFLIqANEUk1bwqzYs DJZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PmY/0yi7"; 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 y17-20020ac85251000000b003a7e45d8d46si24178qtn.469.2022.12.08.18.17.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:17:47 -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="PmY/0yi7"; 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 1p3Slz-00060s-7F; Thu, 08 Dec 2022 21:05:59 -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 1p3Slv-0005yX-5N for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:55 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slr-0001ww-Pr for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:54 -0500 Received: by mail-oi1-x22e.google.com with SMTP id m204so3275077oib.6 for ; Thu, 08 Dec 2022 18:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=hELIWO/9s4dMzjgjNIgr7btQwZnxqh26ctXstkwJ0Bg=; b=PmY/0yi7E0sBRGTMdrrpC8g9cpCcEMyasYw4e3mMWSl27uV7F02lHdB+FqrbYm1OST IhSLMk7Ai9SQTw7xQJk96OzX0FqB3wgkE0iHRslHkm267Gd1GjPU1xCzsqUbRopOzh51 B6itTn9SVO+LWOkKd2z4Xzm7phy3JuomkC9XkjlZrki5sRE/Fj0HTBSYovK9vmS2AnRt U/4yaE1EW2jF76qJXOKM+bH1vTXjj0Cv+JrBLwowHJoy4aX0oE3R/iXfapsrK5kJIRG8 iHGiyFoykWanvq5zLmTclAQsWic1xNM8FdoMdQSEuSC/LmUb6/2UQxW8QmE+CJpflw+t SkSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=hELIWO/9s4dMzjgjNIgr7btQwZnxqh26ctXstkwJ0Bg=; b=8Kt6MJr9KuhzCSfkjBqSvcq8TRzo56oFSyj8QmbgbHRo/GXGWfR+1jxR4sYfP+ETkt r2aiNlYk721mqiHITkCr5h5vlJEnT6DiWWQClASBBIIjdh/H6fYmJo59GNvfWTu1CDc7 Vlfvyw6BGKblpZdDze4DBqh5HK+N1HU0KlcN6WkQkuzJif7TUaoNZM9npHwm0KzAU2GH 5hHNNnyOMRsRKHsXQs+ewOye3SNvXLDcTOuyPxfGPNR0xku9HbYkWxlq0/bn1CoNxkVB 3AAnUmxl2a1auW+nLjGTLMQ+V/uiJ+rxJzwo10YuU2Tp6paTTZyZnG+HjR+I8AQLbBnd 8wwA== X-Gm-Message-State: ANoB5pnXKLfddMyjuLnZsk39Qb1JpHmjelnD85m8BI1jb3HcmhL+VLXd IIe/su+oc9ja31lcWHDW39sYU3O0OePfs7sDm4o= X-Received: by 2002:a05:6808:218a:b0:35e:214f:11c0 with SMTP id be10-20020a056808218a00b0035e214f11c0mr2755255oib.22.1670551549028; Thu, 08 Dec 2022 18:05:49 -0800 (PST) Received: from stoup.. ([2806:102e:18:2efc:d298:de6f:2ed:87a4]) by smtp.gmail.com with ESMTPSA id s14-20020a05683004ce00b0066f7e1188f0sm53531otd.68.2022.12.08.18.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 14/27] tcg/s390x: Support MIE2 multiply single instructions Date: Thu, 8 Dec 2022 20:05:17 -0600 Message-Id: <20221209020530.396391-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221209020530.396391-1-richard.henderson@linaro.org> References: <20221209020530.396391-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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 The MIE2 facility adds 3-operand versions of multiply. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target.h | 1 + tcg/s390x/tcg-target.c.inc | 34 ++++++++++++++++++++++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 00ba727b70..33a82e3286 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -23,6 +23,7 @@ C_O1_I2(r, 0, ri) C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, ri) +C_O1_I2(r, r, rJ) C_O1_I2(r, rZ, r) C_O1_I2(v, v, r) C_O1_I2(v, v, v) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index db10a39381..1fb7b8fb1d 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -63,6 +63,7 @@ typedef enum TCGReg { /* Facilities that are checked at runtime. */ #define FACILITY_LOAD_ON_COND2 53 +#define FACILITY_MISC_INSN_EXT2 58 #define FACILITY_VECTOR 129 #define FACILITY_VECTOR_ENH1 135 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index a81a82c70b..9634126ed1 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -175,6 +175,8 @@ typedef enum S390Opcode { RRE_SLBGR = 0xb989, RRE_XGR = 0xb982, + RRFa_MSRKC = 0xb9fd, + RRFa_MSGRKC = 0xb9ed, RRFa_NRK = 0xb9f4, RRFa_NGRK = 0xb9e4, RRFa_ORK = 0xb9f6, @@ -2015,14 +2017,18 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_mul_i32: + a0 = args[0], a1 = args[1], a2 = (int32_t)args[2]; if (const_args[2]) { - if ((int32_t)args[2] == (int16_t)args[2]) { - tcg_out_insn(s, RI, MHI, args[0], args[2]); + tcg_out_mov(s, TCG_TYPE_I32, a0, a1); + if (a2 == (int16_t)a2) { + tcg_out_insn(s, RI, MHI, a0, a2); } else { - tcg_out_insn(s, RIL, MSFI, args[0], args[2]); + tcg_out_insn(s, RIL, MSFI, a0, a2); } + } else if (a0 == a1) { + tcg_out_insn(s, RRE, MSR, a0, a2); } else { - tcg_out_insn(s, RRE, MSR, args[0], args[2]); + tcg_out_insn(s, RRFa, MSRKC, a0, a1, a2); } break; @@ -2272,14 +2278,18 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_mul_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; if (const_args[2]) { - if (args[2] == (int16_t)args[2]) { - tcg_out_insn(s, RI, MGHI, args[0], args[2]); + tcg_out_mov(s, TCG_TYPE_I64, a0, a1); + if (a2 == (int16_t)a2) { + tcg_out_insn(s, RI, MGHI, a0, a2); } else { - tcg_out_insn(s, RIL, MSGFI, args[0], args[2]); + tcg_out_insn(s, RIL, MSGFI, a0, a2); } + } else if (a0 == a1) { + tcg_out_insn(s, RRE, MSGR, a0, a2); } else { - tcg_out_insn(s, RRE, MSGR, args[0], args[2]); + tcg_out_insn(s, RRFa, MSGRKC, a0, a1, a2); } break; @@ -2934,9 +2944,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, r, ri); case INDEX_op_mul_i32: - return C_O1_I2(r, 0, ri); + return (HAVE_FACILITY(MISC_INSN_EXT2) + ? C_O1_I2(r, r, ri) + : C_O1_I2(r, 0, ri)); case INDEX_op_mul_i64: - return C_O1_I2(r, 0, rJ); + return (HAVE_FACILITY(MISC_INSN_EXT2) + ? C_O1_I2(r, r, rJ) + : C_O1_I2(r, 0, rJ)); case INDEX_op_shl_i32: case INDEX_op_shr_i32: