From patchwork Sat Jan 7 07:50:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640064 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1174335pvb; Fri, 6 Jan 2023 23:52:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXttXmdZxUbWKWZjG9fK9bJcn1pVLuy0nZcbEhUAKfOmA3zkOhlo7W1RyWBbbv+EEGzYSrwZ X-Received: by 2002:ac8:6709:0:b0:3a7:fd82:f69b with SMTP id e9-20020ac86709000000b003a7fd82f69bmr76715722qtp.8.1673077968971; Fri, 06 Jan 2023 23:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673077968; cv=none; d=google.com; s=arc-20160816; b=daKJWxhc/NW3loM5dF+Z+9UUnPTkdAkjjtbCwRBwWvDN3vD+4Wrt7lFxVfNrAKdLvf +XYIrMnl365PjX2EwYoNonN0lRgk1TydJWh9Lcd2wzlno38x+YQtJiRDQXeE9otZnYJe B+aJjYT8xgkRtCjGAZJXwE5GzZxPTDHwoam0oGJDiCkxvjeTp16eSOYDIE07IKRjg7o8 6d9OsXYYiB7HDoBEwDiwOWXLX2LtnKnLMBepcIDtn/PcYP1YqosGDLPGGa5x6ppFF5/j x9Z4sbyIEqN+wGReaZeTLR0/LAU0mD5dCVvvxb8kXnl9fT49BLvQlm8T0W24GPRmmvbu h80A== 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=tLBGpsh6MTEMtw6+WKTyIS5KlZ4TUnE33H/La06GVTk=; b=RDBaCIxV/QPEOeZRFU8ggR0+3KSJOlXxWQq1qeBeTeZoaOGAegV49Ac+dj0RRcGlpM +wXWrf9wmG5DbMfZSKZuyCrimdAB21if4no8NRM9WVx453ktyk52xy7XFeju9uF4LCl8 zd5FALfnCOFzVTTxKY5uphvKfjz3IFTQA2dJK2lt8S6w0EgXONuk09tYYkc6WgQqgHyg aEEKKRGtyq+fJWEApv5AH1Xnm9mhCi9KG1DVtPJYrRO3zA4Iwts16BfCVDwx1c//hOjL H+MWY/G0uOVYrBkuQWotx+gKrv1LGic3/cWhhodJ9ZUC3BwWh01ggAb+6x29d/DYocxt hfEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GstfbavK; 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 b1-20020ac844c1000000b003a612cb2108si1960579qto.455.2023.01.06.23.52.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jan 2023 23:52:48 -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=GstfbavK; 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 1pE3zK-0003g1-4X; Sat, 07 Jan 2023 02:51:34 -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 1pE3zD-0003cm-AB for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:27 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pE3z8-0004A8-JE for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:24 -0500 Received: by mail-pl1-x634.google.com with SMTP id d3so4053497plr.10 for ; Fri, 06 Jan 2023 23:51:21 -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=tLBGpsh6MTEMtw6+WKTyIS5KlZ4TUnE33H/La06GVTk=; b=GstfbavKbR/hKrq+5/03asADMkr1j2VpBWMLFBExsPS/gBkNNwqyEKAnHnmiHSB+31 NqiD9DbEruQ2WklNKnXoKw1oK3uccsunsY+r07MVNVf0iO/XxJWT6wSO6nTiQP9USsRl 9CaJW8gvuir6rD3VqMBteAyxgKLHQY6qWT4VqkNEdIcHEvzSDYXSJnziMqFBP2352iDn u9SiOErubKac4ybOSScZEbjgKz4QeW9V8YImk2hQz8tDzihLuneWNf17WrsvGqLC4HBT LBaHYm/COKGza5UmVX0hcONHXdf4zVs97djgw21NmNgdBIg7Vp64ylL59c7dyn5JUHs7 F53Q== 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=tLBGpsh6MTEMtw6+WKTyIS5KlZ4TUnE33H/La06GVTk=; b=TWAqXhxoELGwaQKzv+BV4CgkDPdE611ZW8yS/1ZLFQU9HKAWXmfFBWi/8mmYvy9RsC MV8WZK25M79HLAwO6zm3HQin/8QUfRKj+qH7BhcZ5CnUDouxc8uhtlxb1qE09eHvmHK/ d+1XyYg7FCLdtu2+0G/Qs5iazRXlQKWa73ySGQREgAgo6vEtww4wBrku5RBEHDoQkRn0 CS191Y/HN3TD++7J5iiDvIcAcysMBXk1NABwDkN3hr1mL6+t7aI2o/DPMfxqIrc18XWM O5+/Qmtr2Ew4XCx/QMNKwgpMx7nEQrzgGjbv2/jKbgUg7AZpJPKEYChZvUXPIinm6SMR Z1/w== X-Gm-Message-State: AFqh2kp79bi/l1tSbDe9+cw63JTaj5L7yNDBN8DkjfBn0gSnSt1US0SV 5JEdEOjFkup8xJG/hPp26/ofdE/WgJofduST X-Received: by 2002:a17:90b:4391:b0:226:412e:20a7 with SMTP id in17-20020a17090b439100b00226412e20a7mr27617932pjb.26.1673077880665; Fri, 06 Jan 2023 23:51:20 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:9d81:5b04:51d7:acae]) by smtp.gmail.com with ESMTPSA id bj5-20020a17090b088500b00212e5068e17sm1945119pjb.40.2023.01.06.23.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 23:51:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 01/27] tcg/s390x: Use register pair allocation for div and mulu2 Date: Fri, 6 Jan 2023 23:50:52 -0800 Message-Id: <20230107075118.1814503-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230107075118.1814503-1-richard.henderson@linaro.org> References: <20230107075118.1814503-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Previously we hard-coded R2 and R3. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 4 ++-- tcg/s390x/tcg-target-con-str.h | 8 +------ tcg/s390x/tcg-target.c.inc | 43 +++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 426dd92e51..00ba727b70 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -29,8 +29,8 @@ C_O1_I2(v, v, v) C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, r, 0) C_O1_I4(r, r, ri, rI, 0) -C_O2_I2(b, a, 0, r) -C_O2_I3(b, a, 0, 1, r) +C_O2_I2(o, m, 0, r) +C_O2_I3(o, m, 0, 1, r) C_O2_I4(r, r, 0, 1, rA, r) C_O2_I4(r, r, 0, 1, ri, r) C_O2_I4(r, r, 0, 1, r, r) diff --git a/tcg/s390x/tcg-target-con-str.h b/tcg/s390x/tcg-target-con-str.h index 8bb0358ae5..76446aecae 100644 --- a/tcg/s390x/tcg-target-con-str.h +++ b/tcg/s390x/tcg-target-con-str.h @@ -11,13 +11,7 @@ REGS('r', ALL_GENERAL_REGS) REGS('L', ALL_GENERAL_REGS & ~SOFTMMU_RESERVE_REGS) REGS('v', ALL_VECTOR_REGS) -/* - * A (single) even/odd pair for division. - * TODO: Add something to the register allocator to allow - * this kind of regno+1 pairing to be done more generally. - */ -REGS('a', 1u << TCG_REG_R2) -REGS('b', 1u << TCG_REG_R3) +REGS('o', 0xaaaa) /* odd numbered general regs */ /* * Define constraint letters for constants: diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index b9ba7b605e..cb00bb6999 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -2264,10 +2264,18 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_div2_i32: - tcg_out_insn(s, RR, DR, TCG_REG_R2, args[4]); + tcg_debug_assert(args[0] == args[2]); + tcg_debug_assert(args[1] == args[3]); + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RR, DR, args[1], args[4]); break; case INDEX_op_divu2_i32: - tcg_out_insn(s, RRE, DLR, TCG_REG_R2, args[4]); + tcg_debug_assert(args[0] == args[2]); + tcg_debug_assert(args[1] == args[3]); + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RRE, DLR, args[1], args[4]); break; case INDEX_op_shl_i32: @@ -2521,17 +2529,30 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_div2_i64: - /* ??? We get an unnecessary sign-extension of the dividend - into R3 with this definition, but as we do in fact always - produce both quotient and remainder using INDEX_op_div_i64 - instead requires jumping through even more hoops. */ - tcg_out_insn(s, RRE, DSGR, TCG_REG_R2, args[4]); + /* + * ??? We get an unnecessary sign-extension of the dividend + * into op0 with this definition, but as we do in fact always + * produce both quotient and remainder using INDEX_op_div_i64 + * instead requires jumping through even more hoops. + */ + tcg_debug_assert(args[0] == args[2]); + tcg_debug_assert(args[1] == args[3]); + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RRE, DSGR, args[1], args[4]); break; case INDEX_op_divu2_i64: - tcg_out_insn(s, RRE, DLGR, TCG_REG_R2, args[4]); + tcg_debug_assert(args[0] == args[2]); + tcg_debug_assert(args[1] == args[3]); + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RRE, DLGR, args[1], args[4]); break; case INDEX_op_mulu2_i64: - tcg_out_insn(s, RRE, MLGR, TCG_REG_R2, args[3]); + tcg_debug_assert(args[0] == args[2]); + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RRE, MLGR, args[1], args[3]); break; case INDEX_op_shl_i64: @@ -3226,10 +3247,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_div2_i64: case INDEX_op_divu2_i32: case INDEX_op_divu2_i64: - return C_O2_I3(b, a, 0, 1, r); + return C_O2_I3(o, m, 0, 1, r); case INDEX_op_mulu2_i64: - return C_O2_I2(b, a, 0, r); + return C_O2_I2(o, m, 0, r); case INDEX_op_add2_i32: case INDEX_op_sub2_i32: