From patchwork Fri Dec 9 02:05:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632213 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589347pvb; Thu, 8 Dec 2022 18:08:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Sp8bfjYt7AgFjBhNhcyC7aVb31XcaT2K6o4gQOqNtriivGNKxeOsTOwPUcT7Rh7Xpy4Ai X-Received: by 2002:ac8:6648:0:b0:3a7:fc39:6cd with SMTP id j8-20020ac86648000000b003a7fc3906cdmr3964643qtp.10.1670551714860; Thu, 08 Dec 2022 18:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551714; cv=none; d=google.com; s=arc-20160816; b=HfjRi2Yahoh6vuZMeK+4wjbpKln1w+XmyDioHU2NowsJh27JDKsPOuF2Yt7HeT2tQq HF0DHx8yBMKjyU2RAIPV8hE4Ksv9XynCzHl7ts+As7cuSHfRps7LZXe91uPPj7e8CX1Y tk+RTaXv5Y/9xSWgQsRvTNwRBVibBQdN8wd4qESGXys6rs9hzyQmyhOzIoc/+kvLkX7K c7mQdSZZQkQYwxpDqC3G/jgkg3u7LZ3BUphYb/u7N4DRbVkKlkUNHo+Z+EZiRgh6yIj7 ApP5bHK47jtjUTMA0d8qo9axff2TltuMwVEPD0wLQe3MhBS0hd9XL13T+JQZUymuPNRm ngag== 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=xq1ZOl+IINYXCXTLpBmtuHW+3smLpY/XSPbCHzDXIM3iXG0+YEtejhp7gb4VIe2RRr IK0e5MNZsqHF3fFyDWCEYECzexEAPHSN+wO0NTtmci5HF40pXZocf9WdnBVpnPyS7/Gq Cjnl6sODE6Dg6hcl57lyv8hHNSNpGaypFCp83L42FqwFHfWE2CQITEnPtCIkXhMQ6iQ/ cMXUVRcXjVQtbVI4k2EHuYJI8XSqujSlwSTKCA129XXXfNqn+pkPk5iEcIu5EZosjY59 4y2Tt47OgRDDAToK1cc+DeMwPaFe72fFMuRD6+W6VxRxPXDgDadZHMD0xQCoA31wo4mG H49w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hdAAEQfc; 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 j25-20020ac84419000000b003a55b624080si33060qtn.48.2022.12.08.18.08.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:34 -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=hdAAEQfc; 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 1p3Slg-0005tW-84; Thu, 08 Dec 2022 21:05:40 -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 1p3Sle-0005sv-7P for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:38 -0500 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slc-0001sJ-EG for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:37 -0500 Received: by mail-ot1-x32f.google.com with SMTP id m6-20020a9d7e86000000b0066ec505ae93so1979785otp.9 for ; Thu, 08 Dec 2022 18:05:35 -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=hdAAEQfc1XuN6rLOokMQgTRriEyyMhQE/SABt2hFLnm6XvBVKkF6nBGpPIL0g1IQ+N eQ9s3WB5V6IFhn8EMDflqqAWvkK2Wlttj7Mq2DCVLTVeyLr1pczw72xigV28iumbk6/0 8wPdmRFT5kSQraW58d7HEEixh+jCwBQ7NVYMulC/b2YX3U5qNOiBccdSUHZu2PE7P1c8 gh2ZRyWMGj0FGOzZfC7lHZOQkM6xBtuwCS5YzLfmKuJvBI4lhE7BCTkLSDmBMIFWJxUo Tq/M8Eqavb8giXm/AYCz+c6TkQE5tUzE7LeXcD4dK8PFc+fZ7ydUFN90sR9N5X+yPbPa ncJg== 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=xsYwDtUiJdY1TJNYrFbz8EtS0PYm9O6CrSgRwGom99DVS2Jk+fF7uAMZ4HZDQKmOVt jq0YjN+WYLyp3lw5r8bXUpY9eMTByfRNYP/HPmVb/S99VeXE5ZmVsIByTAlb2I0f48bS m6UTZzrPpz6RA+mYTTE00Tyom+AhhxLRTUXH1FHWHS1SzOkIlyU78CitKTQRTNa4nv0J m82HRJXnx0LVTM5tioqkF5vndHBxYbes7+tQj3a/D3GAYdHlfAVIQLoGqINyi6Z0vVa7 mb28wPQKXQTaZbeg853w//kLcadJcLh/fYhDwmyPfc8fyHGNovEN9yWRu2JKdr/xermZ G80w== X-Gm-Message-State: ANoB5pklCJourwmxZCjm9/dyPvErWbWOpILi3Rd2R6TVpfe6IHjzQZ8F yjPExBGeYnx4hEtUpgiE21Xb1Mu6Kes1bvmMdzc= X-Received: by 2002:a05:6830:6113:b0:661:dfeb:a95f with SMTP id ca19-20020a056830611300b00661dfeba95fmr2827162otb.10.1670551534491; Thu, 08 Dec 2022 18:05:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 01/27] tcg/s390x: Use register pair allocation for div and mulu2 Date: Thu, 8 Dec 2022 20:05:04 -0600 Message-Id: <20221209020530.396391-2-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::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.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: From patchwork Fri Dec 9 02:05:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632227 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591906pvb; Thu, 8 Dec 2022 18:15:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ev0Ypl4T2yp016rVx4sAkVBIpzlE6+XdXBCasno3uA3Gs2JskiZ104nAEUDOYET5/KOTA X-Received: by 2002:ac8:111a:0:b0:3a5:7396:f296 with SMTP id c26-20020ac8111a000000b003a57396f296mr5787843qtj.44.1670552157202; Thu, 08 Dec 2022 18:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552157; cv=none; d=google.com; s=arc-20160816; b=NG7k9DGPeWJK5BPRE5PbGlr4uzKiP5zVQt/GSuQehiDMp6ZutG28OmGOgnMRkl8Y15 1DeIS9k568uJwdEJfUsE0lfAqKU+QGD6gKwJhkEhwFgdGcK77VZmK5OMkwF/uPI77xq9 PMUAxJo0cvuU/NWglENdFXQN40z6ThOKaASFhHNZmqq1RuoPxw+hPo8SgupYuSwv/ygl 5WHHE0gv0zdgODTH5xBFAzKSCLntvq64H74BAbFIGrYK4oaFCAP/UGzl3nA0CuEIUT/o MYuxe4sd0fagcObYhRze2yj0Avp9m5DC5ESRikhMZZIeHSvmS6VokfmIP+oxwnvlxoYJ P2EQ== 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=Ozj5wc7NFmB3O/MgzepcpO4OOcL4F6DQsmKEPOxkO0Q=; b=QeL2eL8+v2bAxTWwkZ4kORNBVucU6Y+NfteEdMjBwop7oEQ/UfzT+LucSL/qr6Kamg Z2/lHpeL5ZJvDjiSihPGZSFBsBAH6n0MdHlD4fJwt6QYCoHYzypdCFR7AfQJDyV8M0ks etPu9qwl5TaIP/Q2Mw0LVh0EBPyCJB7wiLtcwstBg6OPWVJYuMQTW5f20thm9S3A9s/H tXppOrUgwl8FgaB04t1Pslw1L4nK3U5B5SYoqvM6HTc0lRkjzBPz79iyNsGgGP3je+nV 91F0gzXb+l0whgMLpOOw0URP2Q3VSTT+0SQf2p+tu8rDKHJS80F2yreh61+HJeq17JbX Nibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y/gHJby8"; 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 j17-20020ac84411000000b003a7e39f479bsi29083qtn.270.2022.12.08.18.15.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:15:57 -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="y/gHJby8"; 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 1p3Slh-0005tu-TR; Thu, 08 Dec 2022 21:05:41 -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 1p3Slg-0005tM-0V for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:40 -0500 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sld-0001tk-UO for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:39 -0500 Received: by mail-ot1-x32e.google.com with SMTP id z14-20020a9d65ce000000b0067059c25facso1982760oth.6 for ; Thu, 08 Dec 2022 18:05:36 -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=Ozj5wc7NFmB3O/MgzepcpO4OOcL4F6DQsmKEPOxkO0Q=; b=y/gHJby8tvHVNF1G2WZ2NqA7p73QZ9pgkqsLnUNGHo6lt3Fxd8nSecwCQf5tmhqnl/ jxkOyk1NZjALjN2swN3In96PdS6Q5rtgEa/wu3BBSHIPPPn0BuC4VYjbLUuqAjOfav6K l+vQhAOsJJxGSwpa4zYH5CbAWQt7mTOPF+0yLvKQv1HYxZWfuOGsa3U0IfgO92sNKmMi BurdAhZSfIMcLmp8xf0ZWdtb/3SofNUULS7OwDXo9sTs652S9+X30dQbLfWlfIWg2F+0 9W8Ct+vB2YCK6m8ue1XIgZENbkS47XuoJPHOxwTD7A2cmr4x4Ue64tAr73y6RcRyHGZN ex3A== 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=Ozj5wc7NFmB3O/MgzepcpO4OOcL4F6DQsmKEPOxkO0Q=; b=Sri6Fv+u2Z8kT4OtqhonxP8/+jSD+XC08YYQinomKFOnSA+b6Fjt/VbPET5rF7Om++ 96GGZLIjewkH1aePU4ToMMZ2r2/gZnXcYjNj156x+F9gkhK4Va5knvEtEQe1QW1FKWL+ JWNZgk2oZM4L0bHG14zu4VyljwZUkQy66Hy9g/KclKeUBr8TPQ0FPO20gAj2ENyKOEWT LpY9IlSmjDc8Qle3lRFo6Y6RuYDnk1a45Cwi9GrDQY1X7F0wkkoIOn8PJliDnxIEMJ7u 7Ug2LgRRPf+9GnbptVv8CT8KJHGr6E1ElR53ckoHqHmjKrUD7DrrAXA3hEAHUZBTZW1b RaSQ== X-Gm-Message-State: ANoB5pnAEo/IaLmu016AUcE7D0OIUn8H6iyz9SqC1sORpMVt0FwyC8yD Z+3kdYSJmKIMlg46txjN/vl+2HNOn6P6DQ4NU70= X-Received: by 2002:a9d:17e8:0:b0:66d:a04b:eeac with SMTP id j95-20020a9d17e8000000b0066da04beeacmr1692862otj.30.1670551535584; Thu, 08 Dec 2022 18:05:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 02/27] tcg/s390x: Remove TCG_REG_TB Date: Thu, 8 Dec 2022 20:05:05 -0600 Message-Id: <20221209020530.396391-3-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::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.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 This reverts 829e1376d940 ("tcg/s390: Introduce TCG_REG_TB"), and several follow-up patches. The primary motivation is to reduce the less-tested code paths, pre-z10. Secondarily, this allows the unconditional use of TCG_TARGET_HAS_direct_jump, which might be more important for performance than any slight increase in code size. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- v4: Do not simplify tgen_ori, tgen_xori. --- tcg/s390x/tcg-target.c.inc | 97 +++----------------------------------- 1 file changed, 6 insertions(+), 91 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index cb00bb6999..ba4bb6a629 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -65,12 +65,6 @@ /* A scratch register that may be be used throughout the backend. */ #define TCG_TMP0 TCG_REG_R1 -/* A scratch register that holds a pointer to the beginning of the TB. - We don't need this when we have pc-relative loads with the general - instructions extension facility. */ -#define TCG_REG_TB TCG_REG_R12 -#define USE_REG_TB (!HAVE_FACILITY(GEN_INST_EXT)) - #ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG TCG_REG_R13 #endif @@ -813,8 +807,8 @@ static bool maybe_out_small_movi(TCGContext *s, TCGType type, } /* load a register with an immediate value */ -static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, - tcg_target_long sval, bool in_prologue) +static void tcg_out_movi(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long sval) { tcg_target_ulong uval; @@ -853,14 +847,6 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_out_insn(s, RIL, LARL, ret, off); return; } - } else if (USE_REG_TB && !in_prologue) { - ptrdiff_t off = tcg_tbrel_diff(s, (void *)sval); - if (off == sextract64(off, 0, 20)) { - /* This is certain to be an address within TB, and therefore - OFF will be negative; don't try RX_LA. */ - tcg_out_insn(s, RXY, LAY, ret, TCG_REG_TB, TCG_REG_NONE, off); - return; - } } /* A 32-bit unsigned value can be loaded in 2 insns. And given @@ -876,10 +862,6 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, if (HAVE_FACILITY(GEN_INST_EXT)) { tcg_out_insn(s, RIL, LGRL, ret, 0); new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); - } else if (USE_REG_TB && !in_prologue) { - tcg_out_insn(s, RXY, LG, ret, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, sval, R_390_20, s->code_ptr - 2, - tcg_tbrel_diff(s, NULL)); } else { TCGReg base = ret ? ret : TCG_TMP0; tcg_out_insn(s, RIL, LARL, base, 0); @@ -888,12 +870,6 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } } -static void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long sval) -{ - tcg_out_movi_int(s, type, ret, sval, false); -} - /* Emit a load/store type instruction. Inputs are: DATA: The register to be loaded or stored. BASE+OFS: The effective address. @@ -1037,13 +1013,6 @@ static void tcg_out_ld_abs(TCGContext *s, TCGType type, return; } } - if (USE_REG_TB) { - ptrdiff_t disp = tcg_tbrel_diff(s, abs); - if (disp == sextract64(disp, 0, 20)) { - tcg_out_ld(s, type, dest, TCG_REG_TB, disp); - return; - } - } tcg_out_movi(s, TCG_TYPE_PTR, dest, addr & ~0xffff); tcg_out_ld(s, type, dest, dest, addr & 0xffff); @@ -1243,17 +1212,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) return; } - /* Use the constant pool if USE_REG_TB, but not for small constants. */ - if (USE_REG_TB) { - if (!maybe_out_small_movi(s, type, TCG_TMP0, val)) { - tcg_out_insn(s, RXY, NG, dest, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, val & valid, R_390_20, s->code_ptr - 2, - tcg_tbrel_diff(s, NULL)); - return; - } - } else { - tcg_out_movi(s, type, TCG_TMP0, val); - } + tcg_out_movi(s, type, TCG_TMP0, val); if (type == TCG_TYPE_I32) { tcg_out_insn(s, RR, NR, dest, TCG_TMP0); } else { @@ -1297,17 +1256,12 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } } - /* Use the constant pool if USE_REG_TB, but not for small constants. */ if (maybe_out_small_movi(s, type, TCG_TMP0, val)) { if (type == TCG_TYPE_I32) { tcg_out_insn(s, RR, OR, dest, TCG_TMP0); } else { tcg_out_insn(s, RRE, OGR, dest, TCG_TMP0); } - } else if (USE_REG_TB) { - tcg_out_insn(s, RXY, OG, dest, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, val, R_390_20, s->code_ptr - 2, - tcg_tbrel_diff(s, NULL)); } else { /* Perform the OR via sequential modifications to the high and low parts. Do this via recursion to handle 16-bit vs 32-bit @@ -1332,17 +1286,12 @@ static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } } - /* Use the constant pool if USE_REG_TB, but not for small constants. */ if (maybe_out_small_movi(s, type, TCG_TMP0, val)) { if (type == TCG_TYPE_I32) { tcg_out_insn(s, RR, XR, dest, TCG_TMP0); } else { tcg_out_insn(s, RRE, XGR, dest, TCG_TMP0); } - } else if (USE_REG_TB) { - tcg_out_insn(s, RXY, XG, dest, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, val, R_390_20, s->code_ptr - 2, - tcg_tbrel_diff(s, NULL)); } else { /* Perform the xor by parts. */ tcg_debug_assert(HAVE_FACILITY(EXT_IMM)); @@ -1395,19 +1344,6 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, if (maybe_out_small_movi(s, type, TCG_TMP0, c2)) { c2 = TCG_TMP0; /* fall through to reg-reg */ - } else if (USE_REG_TB) { - if (type == TCG_TYPE_I32) { - op = (is_unsigned ? RXY_CLY : RXY_CY); - tcg_out_insn_RXY(s, op, r1, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, (uint32_t)c2, R_390_20, s->code_ptr - 2, - 4 - tcg_tbrel_diff(s, NULL)); - } else { - op = (is_unsigned ? RXY_CLG : RXY_CG); - tcg_out_insn_RXY(s, op, r1, TCG_REG_TB, TCG_REG_NONE, 0); - new_pool_label(s, c2, R_390_20, s->code_ptr - 2, - tcg_tbrel_diff(s, NULL)); - } - goto exit; } else { if (type == TCG_TYPE_I32) { op = (is_unsigned ? RIL_CLRL : RIL_CRL); @@ -2109,35 +2045,21 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, if (!QEMU_PTR_IS_ALIGNED(s->code_ptr + 1, 4)) { tcg_out16(s, NOP); } - tcg_debug_assert(!USE_REG_TB); tcg_out16(s, RIL_BRCL | (S390_CC_ALWAYS << 4)); s->tb_jmp_insn_offset[a0] = tcg_current_code_size(s); s->code_ptr += 2; } else { /* load address stored at s->tb_jmp_target_addr + a0 */ - tcg_out_ld_abs(s, TCG_TYPE_PTR, TCG_REG_TB, + tcg_out_ld_abs(s, TCG_TYPE_PTR, TCG_TMP0, tcg_splitwx_to_rx(s->tb_jmp_target_addr + a0)); /* and go there */ - tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, TCG_REG_TB); + tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, TCG_TMP0); } set_jmp_reset_offset(s, a0); - - /* For the unlinked path of goto_tb, we need to reset - TCG_REG_TB to the beginning of this TB. */ - if (USE_REG_TB) { - int ofs = -tcg_current_code_size(s); - /* All TB are restricted to 64KiB by unwind info. */ - tcg_debug_assert(ofs == sextract64(ofs, 0, 20)); - tcg_out_insn(s, RXY, LAY, TCG_REG_TB, - TCG_REG_TB, TCG_REG_NONE, ofs); - } break; case INDEX_op_goto_ptr: a0 = args[0]; - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, a0); - } tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, a0); break; @@ -3405,9 +3327,6 @@ static void tcg_target_init(TCGContext *s) /* XXX many insns can't be used with R0, so we better avoid it for now */ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0); tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK); - if (USE_REG_TB) { - tcg_regset_set_reg(s->reserved_regs, TCG_REG_TB); - } } #define FRAME_SIZE ((int)(TCG_TARGET_CALL_STACK_OFFSET \ @@ -3428,16 +3347,12 @@ static void tcg_target_qemu_prologue(TCGContext *s) #ifndef CONFIG_SOFTMMU if (guest_base >= 0x80000) { - tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base, true); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base); tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); } #endif tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, - tcg_target_call_iarg_regs[1]); - } /* br %r3 (go to TB) */ tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, tcg_target_call_iarg_regs[1]); From patchwork Fri Dec 9 02:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632209 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp588986pvb; Thu, 8 Dec 2022 18:07:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5nzapsYrXmwEvvbF80t1fePKO5VAKvNrKMUWKC86KrxDbomXS51/ddeGRerW1/SkiUDdIk X-Received: by 2002:a05:6214:564a:b0:4c7:5d35:21bb with SMTP id mh10-20020a056214564a00b004c75d3521bbmr5461396qvb.12.1670551662150; Thu, 08 Dec 2022 18:07:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551662; cv=none; d=google.com; s=arc-20160816; b=qb96GhGMC6pPAaJfwDhzbWVCNBFlN3wUTWk+jlc6H8UeolQB0bU3C2q03FUTtjsGgc JvC/VpM/Toc3Mwz2ubJRsQ1hAp3is3FmogxwTCzPR0IY+70Ct6f4U8WzuJfr5GndBp5M UY0RchotUm47AiLLXij1ZDT2a4ZDmufJxsGT/NPQx8eSgS0Ml6cuC7pHLB3B4p3Qe++q qjiDOyZsUCIfN/TT8SJh1fBiJySdOjQ1yYDxvSRPCnyMudWZDvDV3hTf3CW69mb7s0yq MU9fC3iHfHCeHuTY0TdvFSV9SJczOrJW+WySVelHv0XeLuITeLAexnvRpb8fyK5W434e wzjQ== 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=Pil2vyVFKco0OazESrG0YmMd/pBt8GQeFupUzgGbxf4=; b=j8k+OeZqGtbmwi1rWJLI+/EgPrGWhRqiCTGX8phTx8vcFqfnUbCwX/oMo51IcDBTsZ Sc19KIrLRwPIGK0nFLEgMO1dlcu8Agfyp+Wgl46P9vcFhdylX9nya7/sLdZkH5uwQj7U /RrUHMEciPnFnRvTpXU4SKfjEbJg3HiQN+WA8VscaEL34b9wDUP9zEtkcx9yhWaQOJIf vK5rNO7VHkGTcjGt/+j9Cs9QkqxjCnv8KjeFP/Wj6EfbvjeE5K3H9GIO1j98MMG3Pj0g v3R3ObhkSmDxA5lijSx+UVHiukVDx/cZf9YX/v2GpnZP84aVrGFe9da2BYUVTO9qj2rt 2Kcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ry5/y++6"; 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 gy7-20020a056214242700b004c712541a9fsi83706qvb.95.2022.12.08.18.07.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:07:42 -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="ry5/y++6"; 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 1p3Slh-0005ti-8O; Thu, 08 Dec 2022 21:05:41 -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 1p3Slf-0005tK-Gv for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:39 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sld-0001ty-Uv for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:39 -0500 Received: by mail-ot1-x32b.google.com with SMTP id db10-20020a0568306b0a00b0066d43e80118so1997471otb.1 for ; Thu, 08 Dec 2022 18:05:37 -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=Pil2vyVFKco0OazESrG0YmMd/pBt8GQeFupUzgGbxf4=; b=ry5/y++6gLLCnyzf8/9gUl43QqpdeM0/ATSfKq0DHTcAwYYVx8Q6IfTI5N/E9eSJSp f7ciP9Xdti+gKiCj3ZrjTSBadrytEAKVz+KwNzWLXOQh89Cru/T9dqg10JGdoucJviUf /qWS4cXZY3czHOFoQ0D+NdRYG7XBZszXKgunvnB/7w252IsN3kdpVKcjcVV6LLU/ktGN RjPwU3AbL2CeoMLAupGUtvwvhE5D82NfBvA3T9l7PJ3+5eD8dy3fi08fURjov4xTcTrQ Qng1rUtKzaLuTLwWA0Uc/hQnp4RlzPw33U6HVLZe+AG2fKrvypa6feGMGBCZ/Ql8SICs Ax6A== 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=Pil2vyVFKco0OazESrG0YmMd/pBt8GQeFupUzgGbxf4=; b=fZF9CvImMWLNd1V981Dg5HmqDhYHUwsSRcJRF+isFJg0PXRjiTP4b9nxPC2W3tvAj3 lgv4Y6cDVgOb+uPVl2b6ZsVJFclxR/blyibf5qPYwXgNedOJqBIdaeXpLSdlg7LgK+gZ lN+d5KGK29+oYhd5hY+Ho/uGfb47EBJf9kFJGoqYRRmyGmpD55SKJIN9BNaaEm3Lyzyz EVDOLs9B1UV2+AJKiMC/lnHnTQXLTuPy39GZQR8JsoU643dJFnSRjW2xS5n75up+SC2P zyV+/pUt22bz5pL2Cn2PjkL4393JqCsjgOorxRakVlIZ+dgXFZ0LSGu0l8DxnUwDMe3I no0g== X-Gm-Message-State: ANoB5pkLLwK5Dd3RQgrXz8lFV4J7yy6j3QSgmE6e1Dt/605omzqu2pbP 42gXQNdfvqRT2xnY7+mmp/JDslqh+uf7d+mgqN4= X-Received: by 2002:a05:6830:26c3:b0:670:6c81:6e55 with SMTP id m3-20020a05683026c300b006706c816e55mr2021004otu.3.1670551536709; Thu, 08 Dec 2022 18:05:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 03/27] tcg/s390x: Always set TCG_TARGET_HAS_direct_jump Date: Thu, 8 Dec 2022 20:05:06 -0600 Message-Id: <20221209020530.396391-4-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::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 Since USE_REG_TB is removed, there is no need to load the target TB address into a register. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 2 +- tcg/s390x/tcg-target.c.inc | 48 +++++++------------------------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 22d70d431b..645f522058 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -103,7 +103,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 -#define TCG_TARGET_HAS_direct_jump HAVE_FACILITY(GEN_INST_EXT) +#define TCG_TARGET_HAS_direct_jump 1 #define TCG_TARGET_HAS_qemu_st8_i32 0 #define TCG_TARGET_HAS_div2_i64 1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index ba4bb6a629..2cdd0d7a92 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -996,28 +996,6 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, return false; } -/* load data from an absolute host address */ -static void tcg_out_ld_abs(TCGContext *s, TCGType type, - TCGReg dest, const void *abs) -{ - intptr_t addr = (intptr_t)abs; - - if (HAVE_FACILITY(GEN_INST_EXT) && !(addr & 1)) { - ptrdiff_t disp = tcg_pcrel_diff(s, abs) >> 1; - if (disp == (int32_t)disp) { - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RIL, LRL, dest, disp); - } else { - tcg_out_insn(s, RIL, LGRL, dest, disp); - } - return; - } - } - - tcg_out_movi(s, TCG_TYPE_PTR, dest, addr & ~0xffff); - tcg_out_ld(s, type, dest, dest, addr & 0xffff); -} - static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src, int msb, int lsb, int ofs, int z) { @@ -2037,24 +2015,16 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_goto_tb: a0 = args[0]; - if (s->tb_jmp_insn_offset) { - /* - * branch displacement must be aligned for atomic patching; - * see if we need to add extra nop before branch - */ - if (!QEMU_PTR_IS_ALIGNED(s->code_ptr + 1, 4)) { - tcg_out16(s, NOP); - } - tcg_out16(s, RIL_BRCL | (S390_CC_ALWAYS << 4)); - s->tb_jmp_insn_offset[a0] = tcg_current_code_size(s); - s->code_ptr += 2; - } else { - /* load address stored at s->tb_jmp_target_addr + a0 */ - tcg_out_ld_abs(s, TCG_TYPE_PTR, TCG_TMP0, - tcg_splitwx_to_rx(s->tb_jmp_target_addr + a0)); - /* and go there */ - tcg_out_insn(s, RR, BCR, S390_CC_ALWAYS, TCG_TMP0); + /* + * branch displacement must be aligned for atomic patching; + * see if we need to add extra nop before branch + */ + if (!QEMU_PTR_IS_ALIGNED(s->code_ptr + 1, 4)) { + tcg_out16(s, NOP); } + tcg_out16(s, RIL_BRCL | (S390_CC_ALWAYS << 4)); + s->tb_jmp_insn_offset[a0] = tcg_current_code_size(s); + s->code_ptr += 2; set_jmp_reset_offset(s, a0); break; From patchwork Fri Dec 9 02:05:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632224 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591579pvb; Thu, 8 Dec 2022 18:15:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf74vLLPx6moljgoN3gNOzITKj1L79Wpc9kMIeEEBEGwkeVpObAQmdM06oKoE8X3q/qs1YF/ X-Received: by 2002:ac8:1246:0:b0:3a7:648d:23ce with SMTP id g6-20020ac81246000000b003a7648d23cemr5757329qtj.25.1670552100073; Thu, 08 Dec 2022 18:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552100; cv=none; d=google.com; s=arc-20160816; b=xeStoqCawZ2eotH5B1jJC6DUgJt96/JnXLuKe0JGCc+EglTvR/UAM1+Pfi0HI6qkTB 8spgpx+ocNlJYywlsuqOTmHPI3Me9wUvpAxASoJNty/KFXQv15yGrlFOFzbeaNzwb1uE EWMIu6BedtBPP42b5VPN9jRqulpWcMNV/5wKQknsU75PjlXF38HrtLaG7COYQGrXfATP 0oFv/Rt2MI1ZxjDe3gA8exmcgH1R2vBBqX/XeV8YJYO1tuXbLt90ZkGU3v9KdBjMCU92 VZFecL0ZOkeGnAZxdHy9Rb0pJTTwnSwFU8WIi10gbtDjg+moRsFv4m2mXtnqu0yl+H3R p1sg== 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=N4yQZvLrLzDnvwFEth2EWeDyowrOx4C5jmZrW9T8lUY=; b=qvGMtiHnQy2lyFQY4qjIiFU1JU4sAi1B83i9cfa1REYY+3uBf+XTcXNBOfmj6PlIHt Wa/L/gHDHNE89yMEBKv9zcfNfefw7o61td+nWR3Dx6/FmL+vcFYQjr7LXAdlTKWSGu+x k/O1354GNlE0VDcLqP6W2OcjOa/AP6DIa9ogOaWU853gg9eUbjqJWwcgWllQa5wT+1xO noURf100XIb3KtNN1uaokjFhDEQf3Qw9rLwZZq0ArAetNnySwqQ0XuBSq4EVDlpmf/47 n1EuvjA7ejISVSn0VLkyYMtkgmz/YGV/JNeqJE5C8OtZ/KliRSJhVkncTxXrZsxb+ktN OjNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gWbrq6DZ; 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 do15-20020a05620a2b0f00b006fb6f4f4ec8si48337qkb.549.2022.12.08.18.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:15:00 -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=gWbrq6DZ; 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 1p3Sli-0005uH-SB; Thu, 08 Dec 2022 21:05:42 -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 1p3Slh-0005te-2c for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:41 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sle-0001uN-Vr for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:40 -0500 Received: by mail-ot1-x32b.google.com with SMTP id t19-20020a9d7753000000b0066d77a3d474so1974054otl.10 for ; Thu, 08 Dec 2022 18:05:38 -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=N4yQZvLrLzDnvwFEth2EWeDyowrOx4C5jmZrW9T8lUY=; b=gWbrq6DZrKrkLOawEIUIEv4Nct0ve73wXBdxn0/7M9oPwJbOLdXZZ0PW5yXis0cnKn NFDry45k8fG/8bu9MndBD0Pwat7uejJQR1W15w3+iyAG5dwyk2CMoPweTB0n/Jc9IeIB te7uhEA51zNwWLcnJLgLfiFK0vxcGtiMPbUv4L1RkQYDT93VvAXs4dJjPnbaV9qFSAGr NloflS5dduVtfv3T98wqq4hfTbcaSVy2ZwlltZS5t0YfEuVgOmZpWt1KAnWLh/y9Amg5 yJys8/g+yshAd/N2HF6I0xcJIDDYBAMyRzbtBi4UKDjvQNvMgJQXf1D2hWQa98zo0go0 Z5qg== 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=N4yQZvLrLzDnvwFEth2EWeDyowrOx4C5jmZrW9T8lUY=; b=ERC4PLE/W4AVJvyaLtKY1WeKYOcLSpjuFgaxGVbpRMu9aALseYWcXKLpq5yqkQMCgB qGQ2HBHqEQQm1uLhBx3Ca8VKnWs7DsbuvkBz560S49hByG02UJtTecbz4jt7mq7z0g+e iyCcYqBvYUn93VQgrwhItWyherhfEGKnSFdv8NWEBwJqJrPDunad8HaHg+fCdTtQvqgK 6mi6y6OTfCTlw0dxMuUE5TjG62Vdt0bkh6AA9EB6oPfPMEGBVL+OeyBS5sovu5JI7YLv wREG1mPvLgH4wWXtMBFf15yAxfLUxM1+jD3dvHNI4ZrYMXMmWEnlKb7VZmobwu9K5fZU LnuQ== X-Gm-Message-State: ANoB5pkDeGvFwH3pdjkoDR/h6psydS4RwzbeSMiveTbxWBdzDEpAh9cW RmVEAtRv3HO1LVRqPPxKkHEAwcd0AH5rk+Fs83Q= X-Received: by 2002:a05:6830:1081:b0:670:6419:c3ee with SMTP id y1-20020a056830108100b006706419c3eemr1730385oto.16.1670551537868; Thu, 08 Dec 2022 18:05:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 04/27] tcg/s390x: Remove USE_LONG_BRANCHES Date: Thu, 8 Dec 2022 20:05:07 -0600 Message-Id: <20221209020530.396391-5-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::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 size of a compiled TB is limited by the uint16_t used by gen_insn_end_off[] -- there is no need for a 32-bit branch. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 2cdd0d7a92..dea889ffa1 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -33,11 +33,6 @@ #include "../tcg-pool.c.inc" #include "elf.h" -/* ??? The translation blocks produced by TCG are generally small enough to - be entirely reachable with a 16-bit displacement. Leaving the option for - a 32-bit displacement here Just In Case. */ -#define USE_LONG_BRANCHES 0 - #define TCG_CT_CONST_S16 0x100 #define TCG_CT_CONST_S32 0x200 #define TCG_CT_CONST_S33 0x400 @@ -1525,10 +1520,6 @@ static void tgen_branch(TCGContext *s, int cc, TCGLabel *l) { if (l->has_value) { tgen_gotoi(s, cc, l->u.value_ptr); - } else if (USE_LONG_BRANCHES) { - tcg_out16(s, RIL_BRCL | (cc << 4)); - tcg_out_reloc(s, s->code_ptr, R_390_PC32DBL, l, 2); - s->code_ptr += 2; } else { tcg_out16(s, RI_BRC | (cc << 4)); tcg_out_reloc(s, s->code_ptr, R_390_PC16DBL, l, 2); From patchwork Fri Dec 9 02:05:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632221 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591523pvb; Thu, 8 Dec 2022 18:14:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7UJ9Xsa3Vvoph1FLgE4hWhJzpWdJ+0E2IJOjSdRiNej8BJZCBbAIAgKt2xU9Fe9S6K9qVa X-Received: by 2002:a0c:e847:0:b0:4c7:971e:3c04 with SMTP id l7-20020a0ce847000000b004c7971e3c04mr6088934qvo.46.1670552089776; Thu, 08 Dec 2022 18:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552089; cv=none; d=google.com; s=arc-20160816; b=cWZsHdxW7yxjCYmr/iD6JQGmMTXgpEX9z7Mc8VL8DFpJLfKOi6U7Vk3FcHUyiuKXtp qNu03yXNoTkO7Ctx3XqdKN/TnGgmi80SDhZdN6qdPwTNYphVOe/7z3GeOyTOak1XYZdB UmQeMlosky9+U/RT3NQWrSOzyWHZZ34qG1GSbiH126+lqQn0XH56eUWcQBIU6HXQnlpA cD92BJlMrQwfuNgUjIxlEcZX1k350zaI4wlnW2u7RI8t476sJ9ykLg82QISNXsPf7ojD HWVJXom5Mb+8rhOVcOU7z7jVfw2m4dLlO3RyHw+IrV7n4Hb8gv7VWVrkGIuAuw6jC4sI x+oA== 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=26da5o9nlyxSfOnK98M7FqxwGpV7sc71vV3Cvt0qTgQ=; b=ZezqZG4xyPqwV69/cjFA/fQIjxP5E0WEO/gWWSGkrOTlb3eM6W1hia0FNXw/qzzCdJ aGsRVc//huusiWjuIVE9NXpY1ZnJXcOZnapv2+Kf8PjyRt428dOFgyBpDlkd1R0ZkfQO sOq6qhecGEt0X5B+pYrFELj3u6pDXEKSDgNmGZtyF6jKw7I5gN86OUC5KD+nVLwTFh0y MVQ3jLNvq/O5a7zX/JRAJlE9f3Ge6nIudrSD0derjlUztqBSMgEXYhThq9C/xduvfxuj Z5/uNsr0l9KLmDeWXkPg+rq0lfUxd4KMLZOd4hFiIvWDt0YRAUi9oBHJenySknoNdP5I UwGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IW4Ig2jN; 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 jv12-20020a05621429ec00b004bbcbc5fef0si62810qvb.582.2022.12.08.18.14.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:14:49 -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=IW4Ig2jN; 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 1p3Slj-0005uI-Ka; Thu, 08 Dec 2022 21:05:43 -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 1p3Slh-0005ts-Oe for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:41 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slg-0001uc-4P for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:41 -0500 Received: by mail-ot1-x32c.google.com with SMTP id t19-20020a9d7753000000b0066d77a3d474so1974074otl.10 for ; Thu, 08 Dec 2022 18:05:39 -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=26da5o9nlyxSfOnK98M7FqxwGpV7sc71vV3Cvt0qTgQ=; b=IW4Ig2jNKq+qMOe2Mcv802CjGrPXR4SSoK5VSeRLKDIVVVRLU9wxg9L/oMuIXetvc/ w1lkfcjXWekx6uXwt+rKA+cjVc/CasZBCILe9WXw0VWxi9HXcF5gnYeAERXd411p+Rcr IIZt3i//vmAimv9HcZgriIczBROycP5/DGFgcXuKkaad4D9S9e0/eNCXQAqXucS5WSlS jqjPueCC1geyUIQ/hOITPonvXySQh5vaWi3O8gYyjcve9B7W7/u8hFaaXL9AnhFzPofm cZ4yeGtx3WlGPygf+TA5kh2xJdiO9ZW2YJKplYheqwmUK15hPZ1r6d+1V9MCp9W3Jn47 /BBQ== 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=26da5o9nlyxSfOnK98M7FqxwGpV7sc71vV3Cvt0qTgQ=; b=RucM4MA9YRICBLn1B5UWzOYAvfbJnF8eV1L4QwdY2KeliGDIVkNCAOQgDU1KrtLz8/ PkFTLcopTdVeee1jB7JAFD4sEyUCRS6/PJwepOYJipnJ2VnNI5jzFB6X6d32y44poE0z Con2XpSXcdjzuiyH2JKtJQ2CEwr6kUZmGnsmV8AKYjaD8gqWtk+z6RxhcV9jfR4w9nDX N+OQxDNnn33vTnWQVXsh3fdi/0ATz2NWa+ft4hermw3gDA1sObeULmR+goTeTAjneSpT m+RwGHjqMaehF6q5EMtt93EZZneMx36ycgblhfpVdHODCW1SiE15mmuuPqEiUzTL1q6U AkFQ== X-Gm-Message-State: ANoB5pne1P+7CJMCf3SWEj4O/cSmirQDnjVR1Gx3klHeYpvLNi1MU3Av UXRwPIETx6jR4cDi8Jt2mPYfMfNm/cLvBlk6gEc= X-Received: by 2002:a9d:74d1:0:b0:66d:c4f:761f with SMTP id a17-20020a9d74d1000000b0066d0c4f761fmr1796301otl.15.1670551538980; Thu, 08 Dec 2022 18:05:38 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 05/27] tcg/s390x: Check for long-displacement facility at startup Date: Thu, 8 Dec 2022 20:05:08 -0600 Message-Id: <20221209020530.396391-6-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::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 We are already assuming the existance of long-displacement, but were not being explicit about it. This has been present since z990. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 6 ++++-- tcg/s390x/tcg-target.c.inc | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 645f522058..7f230ed243 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -52,11 +52,13 @@ typedef enum TCGReg { #define TCG_TARGET_NB_REGS 64 -/* A list of relevant facilities used by this translator. Some of these - are required for proper operation, and these are checked at startup. */ +/* Facilities required for proper operation; checked at startup. */ #define FACILITY_ZARCH_ACTIVE 2 #define FACILITY_LONG_DISP 18 + +/* Facilities that are checked at runtime. */ + #define FACILITY_EXT_IMM 21 #define FACILITY_GEN_INST_EXT 34 #define FACILITY_LOAD_ON_COND 45 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index dea889ffa1..1fcefba7ba 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -3211,6 +3211,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) static void query_s390_facilities(void) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); + const char *which; /* Is STORE FACILITY LIST EXTENDED available? Honestly, I believe this is present on all 64-bit systems, but let's check for it anyway. */ @@ -3232,6 +3233,20 @@ static void query_s390_facilities(void) if (!(hwcap & HWCAP_S390_VXRS)) { s390_facilities[2] = 0; } + + /* + * Check for all required facilities. + * ZARCH_ACTIVE is done via preprocessor check for 64-bit. + */ + if (!HAVE_FACILITY(LONG_DISP)) { + which = "long-displacement"; + goto fail; + } + return; + + fail: + error_report("%s: missing required facility %s", __func__, which); + exit(EXIT_FAILURE); } static void tcg_target_init(TCGContext *s) From patchwork Fri Dec 9 02:05:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632206 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp588470pvb; Thu, 8 Dec 2022 18:06:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4AcCsGJH8nIDJTkLV8EMj+80Ei4nwfmm3Os4InPyoRNUYWE4kMW5LQK+Vo4zBYFk0kNRlz X-Received: by 2002:a05:622a:c6:b0:39c:da20:d47d with SMTP id p6-20020a05622a00c600b0039cda20d47dmr9067650qtw.18.1670551583668; Thu, 08 Dec 2022 18:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551583; cv=none; d=google.com; s=arc-20160816; b=HEqmftczq7Y/CYyjGKjz8H6l+JNF+oL1TcIP7csiT3+9XI932KHz+8xBiKsmC3GTwU 1GyKk5NIzmD3eTv+QDq8KNEzvAeJeuu1mSWfcfH0cMC8aAS5qN0cRbfNtoOikE6L8UtQ U7rme9SbVD0q6xrTWlzrmxT8BxBmk4a50isl4qxqUpFixLd2J/uQXXSSoarQfYjTo8CR xyx65CQwXGKJY05jX/gZqbAOG3QyxLJro0LxYgtj0j+unclkoadMQ51x6KWIuq6qOItm M+yyvEwYHzUpdYRXw3cGpH8CPtDRL3Z+YCOmvWgswcTecOfkpnvPRDbJvhgCXWzJWlQk OmqQ== 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=25Ko++yQBwy/H4R6FsmmzZ4rxqjqQk1kf6nKToI9X2c=; b=LcapHt6uzCYu8QICEq333wp4T+hsZbthnAUS80dyoZ0Jl7ImQ9YsykCKqj2B9QXtvb oTE+4y1XquMkn95U55IZt8uY9h0GmT50LYkI2t0nK6u7XUtGiV1pr1+8/77kC2tKNdIA P7mppwe7mxS0gAy6H1kkcme6E8SIk4z5NOwdq6tGtAWNeIZPmhNnjFcO7rnZoUUlOdF6 2zKJjgXHwP0Ia/BO6ClIoM1411l+KvzddPcsHedpMJ4Z7sQCoCshl4z/1933nG8pGsQS 0UDlxs62br64lYvB9GUXUYhqUQnqKkl0LrjkuaGA/bfTAOn7/Q9FD64SSDev91lvPWTb AwMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w1LNY/z9"; 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 h24-20020ac87158000000b0039a1d73d2dcsi24789qtp.226.2022.12.08.18.06.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:06:23 -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="w1LNY/z9"; 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 1p3Sll-0005vo-Nx; Thu, 08 Dec 2022 21:05:45 -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 1p3Slj-0005uR-PY for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:43 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slh-0001uu-H0 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:43 -0500 Received: by mail-ot1-x32d.google.com with SMTP id p10-20020a9d76ca000000b0066d6c6bce58so1981557otl.7 for ; Thu, 08 Dec 2022 18:05:41 -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=25Ko++yQBwy/H4R6FsmmzZ4rxqjqQk1kf6nKToI9X2c=; b=w1LNY/z9M5+tQTYoUyce6ZYfpNjdpx0dZylEnzCSQeshaTzijtC8/FrgKdN4cL7w6r dara7nLuGGNITmgyjwVgLXg2dVkiqBf9kRt1N9Mf1D60Aumjv6723jV9uwWRF+blX8e0 MJLO9ncxGe6x0C1+vV6dfmRmpg7qywlyhWBYoqKRBWsXifLnWyu1GSdqyOdyn8hVilYF A9xDp0SYzl+RQb0Do3Avx1QwNylX5tAJZUrHoB1GCC/1p1hqsdtF8M645P8UAc5qZhKF Gq0xbfHJUKQ7b5JOexEMpbnjRBkCNvOcuU9Nb0Z2027kcD/p+CnxaoNrCr5tBvZNauc0 u7Pw== 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=25Ko++yQBwy/H4R6FsmmzZ4rxqjqQk1kf6nKToI9X2c=; b=F6t5kVzhpDTmWjqW5HvlRLDpYFTtIPD5tqQ38m4M31O7Ar3RPZF0HM78Q0aXruHtmu h0tpylfEIiOo3PVF5vUu4BIOQX5tvLv6ZC4ds3fwbtSfSbS7dBztAl4u/eTQQy8gA/tf B1ApJ4dOzU8JUlyfeWzE4FsL/H49D07hPzWiCq/cCJQWqKP5to6Lfl2LclJV0/mKRDhw y9saAi9SlsmMZj1E8tDjCv2hoaFOoStmvJhdPyag12bTy8u66mvKOqC6ChImkLX3jj8w he9PR7d+cn1zq+I/RIkz3UR4go4cHzML+wKoFJubwWkc7Y8tGfB/tnaQ9WJNEnVrAArR 4oBA== X-Gm-Message-State: ANoB5pmuizIrTzEOnGkaIK0xJ48DyzN03t2vSXDPylN2+/6KohN+bvvK l0RR9gH5f75upBAn5WYNL5xy6wnEMNbppqAA020= X-Received: by 2002:a05:6830:378b:b0:66e:61be:1a90 with SMTP id bi11-20020a056830378b00b0066e61be1a90mr2060896otb.23.1670551540073; Thu, 08 Dec 2022 18:05:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 06/27] tcg/s390x: Check for extended-immediate facility at startup Date: Thu, 8 Dec 2022 20:05:09 -0600 Message-Id: <20221209020530.396391-7-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::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.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 extended-immediate facility was introduced in z9-109, which itself was end-of-life in 2017. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 4 +- tcg/s390x/tcg-target.c.inc | 231 +++++++++++-------------------------- 2 files changed, 72 insertions(+), 163 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 7f230ed243..126ba1048a 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -56,10 +56,10 @@ typedef enum TCGReg { #define FACILITY_ZARCH_ACTIVE 2 #define FACILITY_LONG_DISP 18 +#define FACILITY_EXT_IMM 21 /* Facilities that are checked at runtime. */ -#define FACILITY_EXT_IMM 21 #define FACILITY_GEN_INST_EXT 34 #define FACILITY_LOAD_ON_COND 45 #define FACILITY_FAST_BCR_SER FACILITY_LOAD_ON_COND @@ -126,7 +126,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_eqv_i64 0 #define TCG_TARGET_HAS_nand_i64 0 #define TCG_TARGET_HAS_nor_i64 0 -#define TCG_TARGET_HAS_clz_i64 HAVE_FACILITY(EXT_IMM) +#define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 #define TCG_TARGET_HAS_deposit_i64 HAVE_FACILITY(GEN_INST_EXT) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 1fcefba7ba..42e161cc7e 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -819,19 +819,17 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } /* Try all 48-bit insns that can load it in one go. */ - if (HAVE_FACILITY(EXT_IMM)) { - if (sval == (int32_t)sval) { - tcg_out_insn(s, RIL, LGFI, ret, sval); - return; - } - if (uval <= 0xffffffff) { - tcg_out_insn(s, RIL, LLILF, ret, uval); - return; - } - if ((uval & 0xffffffff) == 0) { - tcg_out_insn(s, RIL, LLIHF, ret, uval >> 32); - return; - } + if (sval == (int32_t)sval) { + tcg_out_insn(s, RIL, LGFI, ret, sval); + return; + } + if (uval <= 0xffffffff) { + tcg_out_insn(s, RIL, LLILF, ret, uval); + return; + } + if ((uval & 0xffffffff) == 0) { + tcg_out_insn(s, RIL, LLIHF, ret, uval >> 32); + return; } /* Try for PC-relative address load. For odd addresses, @@ -844,15 +842,6 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } } - /* A 32-bit unsigned value can be loaded in 2 insns. And given - that LLILL, LLIHL, LLILF above did not succeed, we know that - both insns are required. */ - if (uval <= 0xffffffff) { - tcg_out_insn(s, RI, LLILL, ret, uval); - tcg_out_insn(s, RI, IILH, ret, uval >> 16); - return; - } - /* Otherwise, stuff it in the constant pool. */ if (HAVE_FACILITY(GEN_INST_EXT)) { tcg_out_insn(s, RIL, LGRL, ret, 0); @@ -1002,82 +991,22 @@ static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src, static void tgen_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (HAVE_FACILITY(EXT_IMM)) { - tcg_out_insn(s, RRE, LGBR, dest, src); - return; - } - - if (type == TCG_TYPE_I32) { - if (dest == src) { - tcg_out_sh32(s, RS_SLL, dest, TCG_REG_NONE, 24); - } else { - tcg_out_sh64(s, RSY_SLLG, dest, src, TCG_REG_NONE, 24); - } - tcg_out_sh32(s, RS_SRA, dest, TCG_REG_NONE, 24); - } else { - tcg_out_sh64(s, RSY_SLLG, dest, src, TCG_REG_NONE, 56); - tcg_out_sh64(s, RSY_SRAG, dest, dest, TCG_REG_NONE, 56); - } + tcg_out_insn(s, RRE, LGBR, dest, src); } static void tgen_ext8u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (HAVE_FACILITY(EXT_IMM)) { - tcg_out_insn(s, RRE, LLGCR, dest, src); - return; - } - - if (dest == src) { - tcg_out_movi(s, type, TCG_TMP0, 0xff); - src = TCG_TMP0; - } else { - tcg_out_movi(s, type, dest, 0xff); - } - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RR, NR, dest, src); - } else { - tcg_out_insn(s, RRE, NGR, dest, src); - } + tcg_out_insn(s, RRE, LLGCR, dest, src); } static void tgen_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (HAVE_FACILITY(EXT_IMM)) { - tcg_out_insn(s, RRE, LGHR, dest, src); - return; - } - - if (type == TCG_TYPE_I32) { - if (dest == src) { - tcg_out_sh32(s, RS_SLL, dest, TCG_REG_NONE, 16); - } else { - tcg_out_sh64(s, RSY_SLLG, dest, src, TCG_REG_NONE, 16); - } - tcg_out_sh32(s, RS_SRA, dest, TCG_REG_NONE, 16); - } else { - tcg_out_sh64(s, RSY_SLLG, dest, src, TCG_REG_NONE, 48); - tcg_out_sh64(s, RSY_SRAG, dest, dest, TCG_REG_NONE, 48); - } + tcg_out_insn(s, RRE, LGHR, dest, src); } static void tgen_ext16u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) { - if (HAVE_FACILITY(EXT_IMM)) { - tcg_out_insn(s, RRE, LLGHR, dest, src); - return; - } - - if (dest == src) { - tcg_out_movi(s, type, TCG_TMP0, 0xffff); - src = TCG_TMP0; - } else { - tcg_out_movi(s, type, dest, 0xffff); - } - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RR, NR, dest, src); - } else { - tcg_out_insn(s, RRE, NGR, dest, src); - } + tcg_out_insn(s, RRE, LLGHR, dest, src); } static inline void tgen_ext32s(TCGContext *s, TCGReg dest, TCGReg src) @@ -1150,15 +1079,13 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) tgen_ext32u(s, dest, dest); return; } - if (HAVE_FACILITY(EXT_IMM)) { - if ((val & valid) == 0xff) { - tgen_ext8u(s, TCG_TYPE_I64, dest, dest); - return; - } - if ((val & valid) == 0xffff) { - tgen_ext16u(s, TCG_TYPE_I64, dest, dest); - return; - } + if ((val & valid) == 0xff) { + tgen_ext8u(s, TCG_TYPE_I64, dest, dest); + return; + } + if ((val & valid) == 0xffff) { + tgen_ext16u(s, TCG_TYPE_I64, dest, dest); + return; } /* Try all 32-bit insns that can perform it in one go. */ @@ -1171,13 +1098,11 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } /* Try all 48-bit insns that can perform it in one go. */ - if (HAVE_FACILITY(EXT_IMM)) { - for (i = 0; i < 2; i++) { - tcg_target_ulong mask = ~(0xffffffffull << i * 32); - if (((val | ~valid) & mask) == mask) { - tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i * 32); - return; - } + for (i = 0; i < 2; i++) { + tcg_target_ulong mask = ~(0xffffffffull << i * 32); + if (((val | ~valid) & mask) == mask) { + tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i * 32); + return; } } if (HAVE_FACILITY(GEN_INST_EXT) && risbg_mask(val)) { @@ -1219,13 +1144,11 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } /* Try all 48-bit insns that can perform it in one go. */ - if (HAVE_FACILITY(EXT_IMM)) { - for (i = 0; i < 2; i++) { - tcg_target_ulong mask = (0xffffffffull << i * 32); - if ((val & mask) != 0 && (val & ~mask) == 0) { - tcg_out_insn_RIL(s, oif_insns[i], dest, val >> i * 32); - return; - } + for (i = 0; i < 2; i++) { + tcg_target_ulong mask = (0xffffffffull << i * 32); + if ((val & mask) != 0 && (val & ~mask) == 0) { + tcg_out_insn_RIL(s, oif_insns[i], dest, val >> i * 32); + return; } } @@ -1239,7 +1162,6 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) /* Perform the OR via sequential modifications to the high and low parts. Do this via recursion to handle 16-bit vs 32-bit masks in each half. */ - tcg_debug_assert(HAVE_FACILITY(EXT_IMM)); tgen_ori(s, type, dest, val & 0x00000000ffffffffull); tgen_ori(s, type, dest, val & 0xffffffff00000000ull); } @@ -1248,15 +1170,13 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) { /* Try all 48-bit insns that can perform it in one go. */ - if (HAVE_FACILITY(EXT_IMM)) { - if ((val & 0xffffffff00000000ull) == 0) { - tcg_out_insn(s, RIL, XILF, dest, val); - return; - } - if ((val & 0x00000000ffffffffull) == 0) { - tcg_out_insn(s, RIL, XIHF, dest, val >> 32); - return; - } + if ((val & 0xffffffff00000000ull) == 0) { + tcg_out_insn(s, RIL, XILF, dest, val); + return; + } + if ((val & 0x00000000ffffffffull) == 0) { + tcg_out_insn(s, RIL, XIHF, dest, val >> 32); + return; } if (maybe_out_small_movi(s, type, TCG_TMP0, val)) { @@ -1267,7 +1187,6 @@ static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } } else { /* Perform the xor by parts. */ - tcg_debug_assert(HAVE_FACILITY(EXT_IMM)); if (val & 0xffffffff) { tcg_out_insn(s, RIL, XILF, dest, val); } @@ -1301,16 +1220,15 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, goto exit; } - if (HAVE_FACILITY(EXT_IMM)) { - if (type == TCG_TYPE_I32) { - op = (is_unsigned ? RIL_CLFI : RIL_CFI); - tcg_out_insn_RIL(s, op, r1, c2); - goto exit; - } else if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { - op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); - tcg_out_insn_RIL(s, op, r1, c2); - goto exit; - } + if (type == TCG_TYPE_I32) { + op = (is_unsigned ? RIL_CLFI : RIL_CFI); + tcg_out_insn_RIL(s, op, r1, c2); + goto exit; + } + if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { + op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); + tcg_out_insn_RIL(s, op, r1, c2); + goto exit; } /* Use the constant pool, but not for small constants. */ @@ -1318,16 +1236,9 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, c2 = TCG_TMP0; /* fall through to reg-reg */ } else { - if (type == TCG_TYPE_I32) { - op = (is_unsigned ? RIL_CLRL : RIL_CRL); - tcg_out_insn_RIL(s, op, r1, 0); - new_pool_label(s, (uint32_t)c2, R_390_PC32DBL, - s->code_ptr - 2, 2 + 4); - } else { - op = (is_unsigned ? RIL_CLGRL : RIL_CGRL); - tcg_out_insn_RIL(s, op, r1, 0); - new_pool_label(s, c2, R_390_PC32DBL, s->code_ptr - 2, 2); - } + op = (is_unsigned ? RIL_CLGRL : RIL_CGRL); + tcg_out_insn_RIL(s, op, r1, 0); + new_pool_label(s, c2, R_390_PC32DBL, s->code_ptr - 2, 2); goto exit; } } @@ -2072,10 +1983,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, RI, AHI, a0, a2); break; } - if (HAVE_FACILITY(EXT_IMM)) { - tcg_out_insn(s, RIL, AFI, a0, a2); - break; - } + tcg_out_insn(s, RIL, AFI, a0, a2); + break; } tcg_out_mem(s, RX_LA, RXY_LAY, a0, a1, TCG_REG_NONE, a2); } else if (a0 == a1) { @@ -2326,17 +2235,17 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_insn(s, RI, AGHI, a0, a2); break; } - if (HAVE_FACILITY(EXT_IMM)) { - if (a2 == (int32_t)a2) { - tcg_out_insn(s, RIL, AGFI, a0, a2); - break; - } else if (a2 == (uint32_t)a2) { - tcg_out_insn(s, RIL, ALGFI, a0, a2); - break; - } else if (-a2 == (uint32_t)-a2) { - tcg_out_insn(s, RIL, SLGFI, a0, -a2); - break; - } + if (a2 == (int32_t)a2) { + tcg_out_insn(s, RIL, AGFI, a0, a2); + break; + } + if (a2 == (uint32_t)a2) { + tcg_out_insn(s, RIL, ALGFI, a0, a2); + break; + } + if (-a2 == (uint32_t)-a2) { + tcg_out_insn(s, RIL, SLGFI, a0, -a2); + break; } } tcg_out_mem(s, RX_LA, RXY_LAY, a0, a1, TCG_REG_NONE, a2); @@ -3137,15 +3046,11 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_add2_i32: case INDEX_op_sub2_i32: - return (HAVE_FACILITY(EXT_IMM) - ? C_O2_I4(r, r, 0, 1, ri, r) - : C_O2_I4(r, r, 0, 1, r, r)); + return C_O2_I4(r, r, 0, 1, ri, r); case INDEX_op_add2_i64: case INDEX_op_sub2_i64: - return (HAVE_FACILITY(EXT_IMM) - ? C_O2_I4(r, r, 0, 1, rA, r) - : C_O2_I4(r, r, 0, 1, r, r)); + return C_O2_I4(r, r, 0, 1, rA, r); case INDEX_op_st_vec: return C_O0_I2(v, r); @@ -3242,6 +3147,10 @@ static void query_s390_facilities(void) which = "long-displacement"; goto fail; } + if (!HAVE_FACILITY(EXT_IMM)) { + which = "extended-immediate"; + goto fail; + } return; fail: From patchwork Fri Dec 9 02:05:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632220 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591124pvb; Thu, 8 Dec 2022 18:13:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4j40O1se+gpB2BRj+236135+MWA1VxLxt+U5KOlag/G69Q9ZA2ML9dGEAZAOgy6+tATV4M X-Received: by 2002:a05:6214:5c8a:b0:4bb:5a05:16d4 with SMTP id lj10-20020a0562145c8a00b004bb5a0516d4mr5564832qvb.11.1670552018421; Thu, 08 Dec 2022 18:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552018; cv=none; d=google.com; s=arc-20160816; b=MFrZrdXu7Y4PTcKAywlhg9wS6C2AO/b+ckB9km/c5sJrlZOgh6e3YKNppf0Az8kBz4 7c3fEENtpChCCz9kwxmS+NaXTSXnoty3m5ClWrgrpuAz9wGY3T91AfVip0+D42003+HV Y3QFhRhoLYK+Pe8iQWaT3EZr0PLfBtVhNKcivUMMjqT/CAPPq2St3gVzBpe1e3MuN/qK UznboKHAMBf/lOa0IsVpk+a/f+8Tuv9+x/OeHDrANL8mOj3ZLvKXkIoEMUeQvyWXWcBH RckgZo9VbYOcwK8PeAZ8/R+NLgUYJoSPa2kEe/s/Xda+cPwZpNlT34BKEvFjhBmq7JzN CZig== 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=oaWPLzYHFjhFB1tuAfWhCD/kpjISuCEiRwLxQm7Lwyo=; b=DTf7AEXZwKGJufdBL5LZd38/AIGvxoJ+YINx0ucxs406Lr+EZBGsziA+9seaCe96RW 9JVhxxYldfKnTWMdhT0rZsnFR8lW1VjhWqkdgD7KTqIUT1MXwRDQoeARLAqE1k8NhhTu EKna13Z0KGnkJu7tshSHLyE4ByUARD/Y26hEH5S4W1p/kcvkHE25x/uj8QYSaHQnNUVw u3FS32Sy6tytZNSEUfwkPdOr0XSqzWlx4G2YaIBGdJCqR0C/kn5tVq9g6m58TEc7m692 o6Rmd+WvhiKwag/QCfj0OIZofppSuMLHcN6oY83e0YGhilBwr5Lrr55/hT9HK+aNtSou ZnUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t6Qfxqlv; 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 h4-20020a05620a244400b006ea415df571si64845qkn.189.2022.12.08.18.13.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:13:38 -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=t6Qfxqlv; 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 1p3Slm-0005wX-TA; Thu, 08 Dec 2022 21:05:46 -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 1p3Slk-0005ua-Cj for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:44 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sli-0001vI-DW for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:44 -0500 Received: by mail-ot1-x331.google.com with SMTP id cn2-20020a056830658200b0066c74617e3dso1997404otb.2 for ; Thu, 08 Dec 2022 18:05:41 -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=oaWPLzYHFjhFB1tuAfWhCD/kpjISuCEiRwLxQm7Lwyo=; b=t6QfxqlvvSfBCFUzkB6xQpCnJNSjSPFHBMFZs4dueikNRvNZI4Hoot8TisRNQqS7VE khtRS5EZ/Q+fw4l0eCUxODb7QnAEvMzzqrITegy3TqP2NmRazhVsqXfEZ9PViWOBtQqP KFTOy3EuiGOpoNB+o39GDntXjwvAlP4RUTgghkrurshRLcAs9h306w098Z3/nAO41wtO J39DGupOq9wNu3bhtUbChiQHScjhsnfcUnDFF+fCqpILEfQaJcmVJwKDRCJrkTmD1kGB XKLqTFExkWL5DVPG7XRFWAUpCxBPZq7iZWMs+qlI7Gus8g1gh0oHjW/OjQp48k6imqur F8Mw== 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=oaWPLzYHFjhFB1tuAfWhCD/kpjISuCEiRwLxQm7Lwyo=; b=GUicdQTK+S99bN7v3kZT6r3KOQmr8Yq0zG3JxR+6PyRLnhdL753UJdzALtkzL4VMhD KmQyum6gKAuvQ/syP94D/Nc7EzVYwKDd2Dj6l1Zm1YtDZoBmNiudftBqoLrS4QpBusfz I/6Cb13kXoo7J/yRNLm8KuwaXKdjSMased7pk/xGC428HnZt3s1JBlShUYvR8EF+phSY 5TMSwJkvqe41IlC/LSK5eZmf7n4wHplIzkV/WDqKX/BysK6Jx4K/Gevg/1mI2vUsJhEJ xW3mskcGJnBOqXeZBca7OfZgHrTNXlMs7aY/e7LN77BeYMQY7G6PV65oMCO48e/iOM7F 3pKQ== X-Gm-Message-State: ANoB5pn23aCZ7kMncXiREo9PQ+m5SLNZ3U86Cr26eXH3eX5qAGhNP+1D ScubXLoqNzZ43sUGc1b9tsrgfadotdYZm85qO+k= X-Received: by 2002:a9d:6b82:0:b0:670:5e21:70f0 with SMTP id b2-20020a9d6b82000000b006705e2170f0mr1904060otq.22.1670551541233; Thu, 08 Dec 2022 18:05:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 07/27] tcg/s390x: Check for general-instruction-extension facility at startup Date: Thu, 8 Dec 2022 20:05:10 -0600 Message-Id: <20221209020530.396391-8-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::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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 general-instruction-extension facility was introduced in z10, which itself was end-of-life in 2019. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 10 ++-- tcg/s390x/tcg-target.c.inc | 100 ++++++++++++++++--------------------- 2 files changed, 49 insertions(+), 61 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 126ba1048a..d47e8ba66a 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -57,10 +57,10 @@ typedef enum TCGReg { #define FACILITY_ZARCH_ACTIVE 2 #define FACILITY_LONG_DISP 18 #define FACILITY_EXT_IMM 21 +#define FACILITY_GEN_INST_EXT 34 /* Facilities that are checked at runtime. */ -#define FACILITY_GEN_INST_EXT 34 #define FACILITY_LOAD_ON_COND 45 #define FACILITY_FAST_BCR_SER FACILITY_LOAD_ON_COND #define FACILITY_DISTINCT_OPS FACILITY_LOAD_ON_COND @@ -92,8 +92,8 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_clz_i32 0 #define TCG_TARGET_HAS_ctz_i32 0 #define TCG_TARGET_HAS_ctpop_i32 0 -#define TCG_TARGET_HAS_deposit_i32 HAVE_FACILITY(GEN_INST_EXT) -#define TCG_TARGET_HAS_extract_i32 HAVE_FACILITY(GEN_INST_EXT) +#define TCG_TARGET_HAS_deposit_i32 1 +#define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 0 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_movcond_i32 1 @@ -129,8 +129,8 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 -#define TCG_TARGET_HAS_deposit_i64 HAVE_FACILITY(GEN_INST_EXT) -#define TCG_TARGET_HAS_extract_i64 HAVE_FACILITY(GEN_INST_EXT) +#define TCG_TARGET_HAS_deposit_i64 1 +#define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 #define TCG_TARGET_HAS_extract2_i64 0 #define TCG_TARGET_HAS_movcond_i64 1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 42e161cc7e..f0b581293c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -843,15 +843,8 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } /* Otherwise, stuff it in the constant pool. */ - if (HAVE_FACILITY(GEN_INST_EXT)) { - tcg_out_insn(s, RIL, LGRL, ret, 0); - new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); - } else { - TCGReg base = ret ? ret : TCG_TMP0; - tcg_out_insn(s, RIL, LARL, base, 0); - new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); - tcg_out_insn(s, RXY, LG, ret, base, TCG_REG_NONE, 0); - } + tcg_out_insn(s, RIL, LGRL, ret, 0); + new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); } /* Emit a load/store type instruction. Inputs are: @@ -1105,7 +1098,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) return; } } - if (HAVE_FACILITY(GEN_INST_EXT) && risbg_mask(val)) { + if (risbg_mask(val)) { tgen_andi_risbg(s, dest, dest, val); return; } @@ -1460,48 +1453,47 @@ static void tgen_brcond(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, TCGArg c2, int c2const, TCGLabel *l) { int cc; + bool is_unsigned = is_unsigned_cond(c); + bool in_range; + S390Opcode opc; - if (HAVE_FACILITY(GEN_INST_EXT)) { - bool is_unsigned = is_unsigned_cond(c); - bool in_range; - S390Opcode opc; + cc = tcg_cond_to_s390_cond[c]; - cc = tcg_cond_to_s390_cond[c]; + if (!c2const) { + opc = (type == TCG_TYPE_I32 + ? (is_unsigned ? RIE_CLRJ : RIE_CRJ) + : (is_unsigned ? RIE_CLGRJ : RIE_CGRJ)); + tgen_compare_branch(s, opc, cc, r1, c2, l); + return; + } - if (!c2const) { - opc = (type == TCG_TYPE_I32 - ? (is_unsigned ? RIE_CLRJ : RIE_CRJ) - : (is_unsigned ? RIE_CLGRJ : RIE_CGRJ)); - tgen_compare_branch(s, opc, cc, r1, c2, l); - return; - } - - /* COMPARE IMMEDIATE AND BRANCH RELATIVE has an 8-bit immediate field. - If the immediate we've been given does not fit that range, we'll - fall back to separate compare and branch instructions using the - larger comparison range afforded by COMPARE IMMEDIATE. */ - if (type == TCG_TYPE_I32) { - if (is_unsigned) { - opc = RIE_CLIJ; - in_range = (uint32_t)c2 == (uint8_t)c2; - } else { - opc = RIE_CIJ; - in_range = (int32_t)c2 == (int8_t)c2; - } + /* + * COMPARE IMMEDIATE AND BRANCH RELATIVE has an 8-bit immediate field. + * If the immediate we've been given does not fit that range, we'll + * fall back to separate compare and branch instructions using the + * larger comparison range afforded by COMPARE IMMEDIATE. + */ + if (type == TCG_TYPE_I32) { + if (is_unsigned) { + opc = RIE_CLIJ; + in_range = (uint32_t)c2 == (uint8_t)c2; } else { - if (is_unsigned) { - opc = RIE_CLGIJ; - in_range = (uint64_t)c2 == (uint8_t)c2; - } else { - opc = RIE_CGIJ; - in_range = (int64_t)c2 == (int8_t)c2; - } + opc = RIE_CIJ; + in_range = (int32_t)c2 == (int8_t)c2; } - if (in_range) { - tgen_compare_imm_branch(s, opc, cc, r1, c2, l); - return; + } else { + if (is_unsigned) { + opc = RIE_CLGIJ; + in_range = (uint64_t)c2 == (uint8_t)c2; + } else { + opc = RIE_CGIJ; + in_range = (int64_t)c2 == (int8_t)c2; } } + if (in_range) { + tgen_compare_imm_branch(s, opc, cc, r1, c2, l); + return; + } cc = tgen_cmp(s, type, c, r1, c2, c2const, false); tgen_branch(s, cc, l); @@ -1659,7 +1651,7 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, MemOp opc, cross pages using the address of the last byte of the access. */ a_off = (a_bits >= s_bits ? 0 : s_mask - a_mask); tlb_mask = (uint64_t)TARGET_PAGE_MASK | a_mask; - if (HAVE_FACILITY(GEN_INST_EXT) && a_off == 0) { + if (a_off == 0) { tgen_andi_risbg(s, TCG_REG_R3, addr_reg, tlb_mask); } else { tcg_out_insn(s, RX, LA, TCG_REG_R3, addr_reg, TCG_REG_NONE, a_off); @@ -2972,17 +2964,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) : C_O1_I2(r, 0, ri)); case INDEX_op_mul_i32: - /* If we have the general-instruction-extensions, then we have - MULTIPLY SINGLE IMMEDIATE with a signed 32-bit, otherwise we - have only MULTIPLY HALFWORD IMMEDIATE, with a signed 16-bit. */ - return (HAVE_FACILITY(GEN_INST_EXT) - ? C_O1_I2(r, 0, ri) - : C_O1_I2(r, 0, rI)); - + return C_O1_I2(r, 0, ri); case INDEX_op_mul_i64: - return (HAVE_FACILITY(GEN_INST_EXT) - ? C_O1_I2(r, 0, rJ) - : C_O1_I2(r, 0, rI)); + return C_O1_I2(r, 0, rJ); case INDEX_op_shl_i32: case INDEX_op_shr_i32: @@ -3151,6 +3135,10 @@ static void query_s390_facilities(void) which = "extended-immediate"; goto fail; } + if (!HAVE_FACILITY(GEN_INST_EXT)) { + which = "general-instructions-extension"; + goto fail; + } return; fail: From patchwork Fri Dec 9 02:05:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632225 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591841pvb; Thu, 8 Dec 2022 18:15:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf6aMDJ1LxWT+aEOQLTod+PVOv0pqzIbJPjGszH1kJVZeEwWd4qPjaHDHEZFNT7KUBk2hwdO X-Received: by 2002:a0c:80c4:0:b0:4b4:a3d5:7bbb with SMTP id 62-20020a0c80c4000000b004b4a3d57bbbmr6161645qvb.10.1670552147372; Thu, 08 Dec 2022 18:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552147; cv=none; d=google.com; s=arc-20160816; b=ywSPfUmLaaPtQrz4gOnFqPZXp3Y3EeOEB7GgvRAq7x9G7MPBV+pOL5IrSQaSW9afAS TFw5REJhrmE7VOL9D4U8YMdA/fXOE332FoSMrilIi6vyxroVnjcQGTrgdCeKtPGWOQQ1 i+j/qAfZWmoxl4mr1VMMvpbVfEEquNebAC99v+HHQyyROepTyWCcFo6c4wpNnaJzRtQH uhwGjmIojUbP/gMyzLA8pVnp/GZRLsRS2vizjaDV0YUZpiXLl3CIGwy+QqI7NwktAmFG yr/5uIlOAJY77AagGnyW3Fea1W017oJNVSzcXIlkfjwBetoKOVrpbr+dUHdSQzfJQ3pb plZw== 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=h4n6658V8gzuBQVeX0F+T4ObLOLK7n60xjvBN2Tekig=; b=Qu/IaMyP/diKTeVTAIIhPLsHPFWDSQ/MmUsKj8Oc7+01lrHrpplBOPANpy0ZWwjX1K ijCMZAuWzRlSr4+52xx1d2RWbrJF8FH1fEsz5g7DOvkTK3KpunPsHBkDy0cwijFjWlk7 VZ2cEPp9q6su/glye+FuU6hBOzkoL09/3qBGIzMg8A8wwQ/r887d3E5vVWy4n/cMjbzt R3SWrUx49E3pxaJyfObiTV5muPccj7x1PGzuUl/lxwABIaJ+5Hta8vTEgUN51OX4Muuc FXg9uSXPG8t0hPfM0JDY4qCl/X8xRqQ7r6qX/Bot5BBFjB/UNHI3WcN/8WQmnJj7n8uH ccuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZaH47SsZ; 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 q2-20020a05621419e200b004ad311da286si82682qvc.280.2022.12.08.18.15.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:15: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=ZaH47SsZ; 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 1p3Slm-0005w6-8H; Thu, 08 Dec 2022 21:05:46 -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 1p3Sll-0005vE-DK for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:45 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slj-0001vW-LQ for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:45 -0500 Received: by mail-ot1-x335.google.com with SMTP id l8-20020a056830054800b006705fd35eceso1976110otb.12 for ; Thu, 08 Dec 2022 18:05:43 -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=h4n6658V8gzuBQVeX0F+T4ObLOLK7n60xjvBN2Tekig=; b=ZaH47SsZ5p/Af+izYy/fULz6+LtGGrw8NgJVoKzVBkBxO2dRonww80HhSf/Z00SLSs rT6cYFNodAGaMIkxTLLfO9CyOtHobz8qyh/dFjGfwKwy3XPHxCqJJvUaHtKOrM2xaKXL 2yi1VhlaNi6B8ZzKZsQNYgs06s6EabT6+X3I5x9tV+XSdmj/Ccu/ARGbzveT/jFhpj1R 5d0PthhEGQkU2W9lnQLIn4fV3kz6R1vLKaWBnLzow/JdK8PIoiXP4wA6civSUj4Wwi9S TJn5R/k8r+Ilw29zibY1J+9tHG2NA9ZLcQZm9y2gW0lCjjmRWpFYYo4mBqPpE7IVMNwH Gwsw== 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=h4n6658V8gzuBQVeX0F+T4ObLOLK7n60xjvBN2Tekig=; b=RzHvpCiH46v2QdNWwHZt6bqOR24X6gr2NdycfZRfgCjCrdoecrOfffFwFncIkMJyMR EHtUy2vqYh0RCqTJRZteOYN7AGHj11zRi6a5qeySrwqZ7dhI6nrvQpnxTBc5cTVdSr7G TzdrS8AKQF/bIbFnxz2npBmeXwvmhknVT2zYj8ed5pSUisSBoTx8+Y+vyHmXFn5j4m2P 6BRHKE8Mn36vHkAoNKVpo5RnrvRjWpQ3paYDs8fem6RlFZx3CmRPccMEVXe3lPghV+q/ e/miYkla5GW5xMJi2I90mqDzwhMnx2HVNe/HCrVIxbc5tuySz/GXEiv6CellOtLDWlq/ eS/A== X-Gm-Message-State: ANoB5pnsA78aloOhpHaAsr4P13QeWVL53XPk0H85Gc6cdLUQXFst85PO JxT7PX28BHta5whLw9gsTF/hkJlii9N/xMV5I14= X-Received: by 2002:a9d:30f:0:b0:670:5bc0:fd66 with SMTP id 15-20020a9d030f000000b006705bc0fd66mr1753608otv.30.1670551542325; Thu, 08 Dec 2022 18:05:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 08/27] tcg/s390x: Check for load-on-condition facility at startup Date: Thu, 8 Dec 2022 20:05:11 -0600 Message-Id: <20221209020530.396391-9-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::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.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 general-instruction-extension facility was introduced in z196, which itself was end-of-life in 2021. In addition, z196 is the minimum CPU supported by our set of supported operating systems: RHEL 7 (z196), SLES 12 (z196) and Ubuntu 16.04 (zEC12). Check for facility number 45, which will be the consilidated check for several facilities. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 6 ++-- tcg/s390x/tcg-target.c.inc | 72 +++++++++++++------------------------- 2 files changed, 27 insertions(+), 51 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index d47e8ba66a..31d5510d2d 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -58,12 +58,12 @@ typedef enum TCGReg { #define FACILITY_LONG_DISP 18 #define FACILITY_EXT_IMM 21 #define FACILITY_GEN_INST_EXT 34 +#define FACILITY_45 45 /* Facilities that are checked at runtime. */ -#define FACILITY_LOAD_ON_COND 45 -#define FACILITY_FAST_BCR_SER FACILITY_LOAD_ON_COND -#define FACILITY_DISTINCT_OPS FACILITY_LOAD_ON_COND +#define FACILITY_FAST_BCR_SER 45 +#define FACILITY_DISTINCT_OPS 45 #define FACILITY_LOAD_ON_COND2 53 #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 f0b581293c..29a64ad0fe 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1252,7 +1252,6 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, TCGReg dest, TCGReg c1, TCGArg c2, int c2const) { int cc; - bool have_loc; /* With LOC2, we can always emit the minimum 3 insns. */ if (HAVE_FACILITY(LOAD_ON_COND2)) { @@ -1263,9 +1262,6 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, return; } - have_loc = HAVE_FACILITY(LOAD_ON_COND); - - /* For HAVE_LOC, only the paths through GTU/GT/LEU/LE are smaller. */ restart: switch (cond) { case TCG_COND_NE: @@ -1310,59 +1306,35 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, case TCG_COND_LT: case TCG_COND_GE: /* Swap operands so that we can use LEU/GTU/GT/LE. */ - if (c2const) { - if (have_loc) { - break; - } - tcg_out_movi(s, type, TCG_TMP0, c2); - c2 = c1; - c2const = 0; - c1 = TCG_TMP0; - } else { + if (!c2const) { TCGReg t = c1; c1 = c2; c2 = t; + cond = tcg_swap_cond(cond); + goto restart; } - cond = tcg_swap_cond(cond); - goto restart; + break; default: g_assert_not_reached(); } cc = tgen_cmp(s, type, cond, c1, c2, c2const, false); - if (have_loc) { - /* Emit: d = 0, t = 1, d = (cc ? t : d). */ - tcg_out_movi(s, TCG_TYPE_I64, dest, 0); - tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1); - tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc); - } else { - /* Emit: d = 1; if (cc) goto over; d = 0; over: */ - tcg_out_movi(s, type, dest, 1); - tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1); - tcg_out_movi(s, type, dest, 0); - } + /* Emit: d = 0, t = 1, d = (cc ? t : d). */ + tcg_out_movi(s, TCG_TYPE_I64, dest, 0); + tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1); + tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc); } static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGReg c1, TCGArg c2, int c2const, TCGArg v3, int v3const) { - int cc; - if (HAVE_FACILITY(LOAD_ON_COND)) { - cc = tgen_cmp(s, type, c, c1, c2, c2const, false); - if (v3const) { - tcg_out_insn(s, RIE, LOCGHI, dest, v3, cc); - } else { - tcg_out_insn(s, RRF, LOCGR, dest, v3, cc); - } + int cc = tgen_cmp(s, type, c, c1, c2, c2const, false); + if (v3const) { + tcg_out_insn(s, RIE, LOCGHI, dest, v3, cc); } else { - c = tcg_invert_cond(c); - cc = tgen_cmp(s, type, c, c1, c2, c2const, false); - - /* Emit: if (cc) goto over; dest = r3; over: */ - tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1); - tcg_out_insn(s, RRE, LGR, dest, v3); + tcg_out_insn(s, RRF, LOCGR, dest, v3, cc); } } @@ -1382,14 +1354,8 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, } else { tcg_out_mov(s, TCG_TYPE_I64, dest, a2); } - if (HAVE_FACILITY(LOAD_ON_COND)) { - /* Emit: if (one bit found) dest = r0. */ - tcg_out_insn(s, RRF, LOCGR, dest, TCG_REG_R0, 2); - } else { - /* Emit: if (no one bit found) goto over; dest = r0; over: */ - tcg_out_insn(s, RI, BRC, 8, (4 + 4) >> 1); - tcg_out_insn(s, RRE, LGR, dest, TCG_REG_R0); - } + /* Emit: if (one bit found) dest = r0. */ + tcg_out_insn(s, RRF, LOCGR, dest, TCG_REG_R0, 2); } } @@ -3124,6 +3090,7 @@ static void query_s390_facilities(void) } /* + * Minimum supported cpu revision is z196. * Check for all required facilities. * ZARCH_ACTIVE is done via preprocessor check for 64-bit. */ @@ -3139,6 +3106,15 @@ static void query_s390_facilities(void) which = "general-instructions-extension"; goto fail; } + /* + * Facility 45 is a big bin that contains: distinct-operands, + * fast-BCR-serialization, high-word, population-count, + * interlocked-access-1, and load/store-on-condition-1 + */ + if (!HAVE_FACILITY(45)) { + which = "45"; + goto fail; + } return; fail: From patchwork Fri Dec 9 02:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632208 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp588902pvb; Thu, 8 Dec 2022 18:07:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6IMvVL9E/AbGk1JCBMDldR05gdKiSFySvYkMqSSqhJCQy+CpjwcJ7mVDjb862AElMsGSi8 X-Received: by 2002:ac8:760b:0:b0:3a7:f3c6:8817 with SMTP id t11-20020ac8760b000000b003a7f3c68817mr5535126qtq.54.1670551649037; Thu, 08 Dec 2022 18:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551649; cv=none; d=google.com; s=arc-20160816; b=04T1xD3FwjXg6gOOAqmo0vkYRgqURSJyU5dibkvoTaBa/SFPYThHSMC8+IyXDY8cF2 vmvv5FyhFYSgjHG4+A+lo13zmwBrGN5IhMZfhbS1kviCmp1GSczJ+3PsEkVbGNcUXc80 5LXVwtjHP9Mdk+0oMjrCQ1Tyt51kRMMtscVQj17BW+FQ6JFMUNqkSIyzKGicWOhO3sue meHyrK0MBFEkN/avWv2wVFz2MV5LcbhkJ8CG+4rLhKP391IHgz1wv8AEgUVx5NPbMZS+ xUb8gvRkvHcSTyW/gpvhptYqDLethMZAh9qFqhq2g32FOW6n2lLwwxqzce9x5GTk4nEH cPmQ== 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=/3AO0EWlMT0lILOrDJMjNk2wMlVf+vs0sOwevFdt0Qk=; b=0MAW1/sADyOYkN4+oxshVZf7OJjZEKlTflAXTLf7PKCeSGEyZqjzvVurBZQjjzXTNM YcMc2q6h1asINV7h7w35GGM9pE9+Ca4HgIJ3Ea+r2rgB1mMbqliYYbbPFQr0MgcDhDfv P/c7twh7SAz15VIvCEG6C5uvO19hHx967n8SuDrqhpWrFhOV7yJSZtWpWZin95vrMi+m nUn6WlX3gcvgiIu3LhfTbOC0o/difSJN2/PeC+k5Yfp9Od3JA1FuQQeww1c8u1Bearpe IjcP5lUrIspG3LQMs6g0wFs38JUh4RPI1dzxPC0Vd/uemZLRE2n2Kl4SUx+IRPnFe5Dz 8XKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JTY/iGJ9"; 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 dt44-20020a05620a47ac00b006ed177daa68si63010qkb.32.2022.12.08.18.07.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:07:29 -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="JTY/iGJ9"; 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 1p3Slr-0005x2-Qq; Thu, 08 Dec 2022 21:05:51 -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 1p3Slm-0005w8-A3 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:46 -0500 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slk-0001vq-PO for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:46 -0500 Received: by mail-oi1-x234.google.com with SMTP id l127so3259646oia.8 for ; Thu, 08 Dec 2022 18:05:44 -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=/3AO0EWlMT0lILOrDJMjNk2wMlVf+vs0sOwevFdt0Qk=; b=JTY/iGJ9C5Mr36xPA84a7WAqdtyZMxSRgvmPxpL/EEwLe0arnbuOrhzUT/4D1j0nV3 sD3r/e/PgH456CzMlL3gmmZHMuq+/RNeQgCuMGoeemjkjjiqKY45FatuFA2bTvTk6UrS B2ZoovvhvPX6NQ/tqufF9ag4Q6WjLzlgQdFRyGeE8nDI3rWBhdABpWE+/R2pJFli1yIl KPJLsO8B8VaMjPHCravd45nbQLjckPFVN8vXh0l5A4GRuAsrofoXd0FTcjXHWz3o/mGV hRWURbVH+huTbvbsiVcJo4jVpO3UnLZpQNEx7JMCh7mg0NiRlz6DeA7Ob8qmerVB8/08 GEOA== 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=/3AO0EWlMT0lILOrDJMjNk2wMlVf+vs0sOwevFdt0Qk=; b=dRJGd+veUpzh4COw+nlUrGjEwJZJbPVXObu+aOeRBDQZvKSQLQmBk49ufCSsKwPhNU I4MK4Xe7uy60OWmwAmzJz1s4UE4WDDrwLf9en3WcJq5V/BqrBeWOmydLqfKJ+uW/uFCZ g60CVWcuP3Qd8mSPUXtCzOnrsBgADs3tIby2KXIK3wO7IbvWQALxhb72suOVY32Z7LpZ oysVOejH9lUSQPDNYxGXVSlVVCvA0PUVFCckKNgI45gmsfjzOtk7uANC0EgbWzJDN/+K j4k0zgRi2tt5y7T99KbpqhjiWW+KPCWUK/jnvuy1zYjOXcG83TxF8OyEff1/nfnAlHV8 KNpg== X-Gm-Message-State: ANoB5pncfHarCSQgAq7cFIz8IkSCim36VHJZUPAeQdZlKJ6Fimt8vmg9 1zH6mtWfU9/lOK91gfoU81+/WMbWKjyqH6m94s4= X-Received: by 2002:a54:4503:0:b0:35b:822:8d71 with SMTP id l3-20020a544503000000b0035b08228d71mr1542981oil.9.1670551543460; Thu, 08 Dec 2022 18:05:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 09/27] tcg/s390x: Remove FAST_BCR_SER facility check Date: Thu, 8 Dec 2022 20:05:12 -0600 Message-Id: <20221209020530.396391-10-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::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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 fast-bcr-serialization facility is bundled into facility 45, along with load-on-condition. We are checking this at startup. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/s390x/tcg-target.h | 1 - tcg/s390x/tcg-target.c.inc | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 31d5510d2d..fc9ae82700 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -62,7 +62,6 @@ typedef enum TCGReg { /* Facilities that are checked at runtime. */ -#define FACILITY_FAST_BCR_SER 45 #define FACILITY_DISTINCT_OPS 45 #define FACILITY_LOAD_ON_COND2 53 #define FACILITY_VECTOR 129 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 29a64ad0fe..dd58f0cdb5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -2431,7 +2431,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, /* The host memory model is quite strong, we simply need to serialize the instruction stream. */ if (args[0] & TCG_MO_ST_LD) { - tcg_out_insn(s, RR, BCR, HAVE_FACILITY(FAST_BCR_SER) ? 14 : 15, 0); + /* fast-bcr-serialization facility (45) is present */ + tcg_out_insn(s, RR, BCR, 14, 0); } break; From patchwork Fri Dec 9 02:05:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632226 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591909pvb; Thu, 8 Dec 2022 18:15:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5I0COaWAb0XDMh8/7vtjp4HVk2vgZ6k29Tom6d4UHTXSaouaPoay3LWSy2y35xS0vnkAXY X-Received: by 2002:ac8:540a:0:b0:3a6:8dc8:18f5 with SMTP id b10-20020ac8540a000000b003a68dc818f5mr6061275qtq.66.1670552157541; Thu, 08 Dec 2022 18:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552157; cv=none; d=google.com; s=arc-20160816; b=DWwq2bz6rjVePa0ou9ar77RnNDzqnunR+blzc1+ytzGGNs9wkgiwwbxtP60H7Jse4i gX+BFxPiVEeVTakuQMDQhe6odZ/Si43FijZ62OqHRb6KwKl9p9b55PUGAofWE8i2KL1M Cg3Z6kHb5T1Bf3CkZ204Z/K7PQn9n4bU1VYIUeQ4+Thu+1+8tsQFC6FaRC2NXTNMD1RF dKRQMo5/1f9/CIfB9licVAUXVGL16eSGwqsvmJFst8IWC1Hk7x7Wjr0TrAFMyHwkfuqM MQNztaLpJAxbot8Rjqfvfyxon3SBKncFT85BdQYLdeWARQC+sVMxzFhL4lN6nG+e+dhP H41Q== 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=8dJchTnb5uNiKNB26rXc8pPkHP1mXmQfsp6Yr2QLErc=; b=JHuVOMq+hckMBa8YDGyK8E1+9PDf6KNJpX3Bo2ltIpfBVdfUIrNPZpKSQH4G8N0RnG EYkdUf8OGT6F4340ANXWrzEfwUOucrLbAPPkMD8/YXzxSjSO7ZVDFWKUBcojS0dibr5B H9H/fz00zW3UlNZpvyFbl1q2FdlyaOGZd6VwNnLei1JlJM7OMYOTXDuUfr/gUTW22nfp D5181jH6xfSNJM3/OQKzzfL0lj0IVsfQ0JCqVz1qP88LBK5BHACsEy+3F43JnsN7KpS1 KP84mVseStdbg/lDotBaH9UjfdQyUw5ummESpAg/HMQj35hcwwCZb2YgVHN8MbqyEEK7 aGfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KUBnXHO2; 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 c12-20020ac8518c000000b003a7b44dbd4fsi34409qtn.137.2022.12.08.18.15.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:15:57 -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=KUBnXHO2; 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 1p3Slu-0005y9-GQ; Thu, 08 Dec 2022 21:05:54 -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 1p3Sln-0005wr-9t for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:47 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sll-0001w4-M5 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:47 -0500 Received: by mail-ot1-x32a.google.com with SMTP id l8-20020a056830054800b006705fd35eceso1976152otb.12 for ; Thu, 08 Dec 2022 18:05:45 -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=8dJchTnb5uNiKNB26rXc8pPkHP1mXmQfsp6Yr2QLErc=; b=KUBnXHO2/NXDiZ3Z+wRw+tlJznXRr0B93swlrGi0GU68T7nYPakQm3ahodaW1bShym 9tUBrQ9s2RCXr4fFFfaE8TY9Y22yfbQp9f5YS/lcU5PJ5Wrlfb14an0+49BojaxSvaXk zM3H6cOtSrrPJoEMKHDQCLJh8D4p2DiC/WTMfMsciYAAhJrAeCY7IV3gcYoa34M3C/oE iMvaleAVdR3wkXcVkCe0JuJmtNTK9jaM1od89L9ogCFwBVDOzrmRmEW2q1PUnPstRPwJ Q83WDwr339XejQAu//fierr2FlEtYu24PnL//O+Dm6z8eti0JqeYOHY7GaHRkp0hLRbd X+0w== 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=8dJchTnb5uNiKNB26rXc8pPkHP1mXmQfsp6Yr2QLErc=; b=KhL9kzMK1zsUxCe/dDU5fBu7uwljcZf62gH7k8+y1XgG+q9R3VDZiD7v7xb0uUvTk9 XfJwP3rFtCdCh/n2RZqCNEDNE4WzAvO1mmnI/fsy2yjNw8ofpGkJJZAXOoVlvml7UIQR UdoHasrAZ7CNgySuJzx9u8GIFqUSu/uIZuLsCmfsA3+9GlD79LO/bHtfNbFG82Zwd2Zl et8sTg6yT7DW7Q0yEBietbhVWgfeaFh1sCWsp6hCwIXQ6GVuFs20pvV4DJCuc7iWxAoq AxJtQfkvzetxRNZDu4QDEK8B8e0/XCzPqkAOpOT9wqoM6xZrm0IZhdxLTPpC0UcRGmsj Lr4A== X-Gm-Message-State: ANoB5pnIIb59FKBGDtm2n3CH1iPmur4OqRxJDc6d4a1cBB4NXulZTsUs QTRn0X2YxDCZ7XjbI7QVGsHaETqGy359k2nCU+4= X-Received: by 2002:a9d:161:0:b0:670:6615:a9e8 with SMTP id 88-20020a9d0161000000b006706615a9e8mr2314094otu.34.1670551544590; Thu, 08 Dec 2022 18:05:44 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:44 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 10/27] tcg/s390x: Remove DISTINCT_OPERANDS facility check Date: Thu, 8 Dec 2022 20:05:13 -0600 Message-Id: <20221209020530.396391-11-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::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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 distinct-operands facility is bundled into facility 45, along with load-on-condition. We are checking this at startup. Remove the a0 == a1 checks for 64-bit sub, and, or, xor, as there is no space savings for avoiding the distinct-operands insn. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.h | 1 - tcg/s390x/tcg-target.c.inc | 16 ++-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index fc9ae82700..db10a39381 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -62,7 +62,6 @@ typedef enum TCGReg { /* Facilities that are checked at runtime. */ -#define FACILITY_DISTINCT_OPS 45 #define FACILITY_LOAD_ON_COND2 53 #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 dd58f0cdb5..e4403ffabf 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -2218,8 +2218,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, if (const_args[2]) { a2 = -a2; goto do_addi_64; - } else if (a0 == a1) { - tcg_out_insn(s, RRE, SGR, a0, a2); } else { tcg_out_insn(s, RRF, SGRK, a0, a1, a2); } @@ -2230,8 +2228,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_andi(s, TCG_TYPE_I64, args[0], args[2]); - } else if (a0 == a1) { - tcg_out_insn(s, RRE, NGR, args[0], args[2]); } else { tcg_out_insn(s, RRF, NGRK, a0, a1, a2); } @@ -2241,8 +2237,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_ori(s, TCG_TYPE_I64, a0, a2); - } else if (a0 == a1) { - tcg_out_insn(s, RRE, OGR, a0, a2); } else { tcg_out_insn(s, RRF, OGRK, a0, a1, a2); } @@ -2252,8 +2246,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_xori(s, TCG_TYPE_I64, a0, a2); - } else if (a0 == a1) { - tcg_out_insn(s, RRE, XGR, a0, a2); } else { tcg_out_insn(s, RRF, XGRK, a0, a1, a2); } @@ -2926,9 +2918,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_or_i64: case INDEX_op_xor_i32: case INDEX_op_xor_i64: - return (HAVE_FACILITY(DISTINCT_OPS) - ? C_O1_I2(r, r, ri) - : C_O1_I2(r, 0, ri)); + return C_O1_I2(r, r, ri); case INDEX_op_mul_i32: return C_O1_I2(r, 0, ri); @@ -2938,9 +2928,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_shl_i32: case INDEX_op_shr_i32: case INDEX_op_sar_i32: - return (HAVE_FACILITY(DISTINCT_OPS) - ? C_O1_I2(r, r, ri) - : C_O1_I2(r, 0, ri)); + return C_O1_I2(r, r, ri); case INDEX_op_brcond_i32: case INDEX_op_brcond_i64: From patchwork Fri Dec 9 02:05:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632228 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591952pvb; Thu, 8 Dec 2022 18:16:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XKaFPzd6OEdIb//quaPltefZrqwz41JQEYl3tVhPLM3PmkTRUEazYWi4SU9LGxqoF2og1 X-Received: by 2002:ad4:50cd:0:b0:4c7:1c72:58f3 with SMTP id e13-20020ad450cd000000b004c71c7258f3mr5753774qvq.43.1670552164496; Thu, 08 Dec 2022 18:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552164; cv=none; d=google.com; s=arc-20160816; b=drBLMPw7KMs7pBTkSnclshGx00YhcXXG44ofmuuibyw3AFcNeMSJyHLBhdJWvRCL9l mEJ1WVaIYIT3cwdbZuQHQ8mFBLm3oOlGssybUZ2+oq6FFhhOHpDhJ+toJ9T5tcRnQ5cb QZCwoIYYXkTgNQd6tbyFEFyn+rPCF7h5ocx+UUToVtFL6ibnbVnE1sS9itZrIWQM/kLV mDxJaQcNyjaC4IfD5KNUyjnpkKkryBBmiL9yRcY5w8FWjQ00oVtzK7j8eqZspGO0aXzx 2LP+G1Taqg6ITG1olhw3sn1UdJDQPBZdwM1IFwHPwye63/ikQ2YLBIDQjM5B689rX8Sq nUOw== 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=81bUyJ3q1hrBplCCzLWitqxn9dUaRZZOJiTy7eZWBno=; b=WIHqnUhA5fNioOD1Z6bicFAHJ0QzR/URaV7iIVUbO8Mt/44iX/aW8V5IVrhp7+MAzR F3hHhx+yR6e8omBtOvJfEEhNMvgONC2NvvmqOQrisK3RHXn80hT91kshoxYdZ+NPpiDq 2X4RQpuaEw+hRzynF8K5Ds/ssEQL2wVOUzGflV1L6aMGesaAhyN3jd/79JQOOzse4796 5vrkP8PnVJwQW0athrJshwW/YAD7LVGafijO/BuC1mcV34s535wTJEZiZhinV1cSRdJ/ YUvcHN5W6csClIlSHGau6oq/c9IUKFaFGao1AiKdqSQZwraCtn3UgFo3moXqrPxwhUx5 fZkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lNuCi2cD; 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 c10-20020ad45aea000000b004c6b2403895si80899qvh.295.2022.12.08.18.16.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:16:04 -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=lNuCi2cD; 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 1p3Slu-0005y8-GM; Thu, 08 Dec 2022 21:05:54 -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 1p3Slo-0005x3-Cq for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:51 -0500 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slm-0001wJ-Qo for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:48 -0500 Received: by mail-oi1-x22d.google.com with SMTP id k189so3263420oif.7 for ; Thu, 08 Dec 2022 18:05:46 -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=81bUyJ3q1hrBplCCzLWitqxn9dUaRZZOJiTy7eZWBno=; b=lNuCi2cDRXWwqgayG1kfNaqGV7g8CdyZtJTRCzSvqUZrDdKIOYgmXxBhODc53L0jcU IA//zxgDJ58LgilMRjSiO2IsZOhV6nGJCBdoFeueecdad4fC0lHWb/Be5ZIAQEgBJNC5 zaeUO2yMt68nRad9BSI03ri5OKpza1YWfSpAu1E9YYoDwVTFVT/Sx5s1jJuwfh+UTKgb fU3u9vjpwl4svPT/KK8H4LIv+izyihntGIr8fFFXJt3rm8IIgoV1Te3W+EoAHtyj/iqQ h8D74eDAB5We+b0Wp8axs/lHUfs4KzutYDYj1Yle22HqhoMv+e51c4R7CnLpQ31s+dYN SW5w== 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=81bUyJ3q1hrBplCCzLWitqxn9dUaRZZOJiTy7eZWBno=; b=cHdE2Wn5MyHzj4e7gFCdQdMBIURw6ZlOGaRB6lx9SZ1aMx/1NfonxlreBBzKkbZdkf bww7kuW98kX+AauCb94IqBdhfpFYj6kJmsv/Sljc1XAK4OqgxM6hZ1Mip4ktsEk3PoQT smK9FFs0pJM3xkgXblzWVzgqJi3qJv4gMKlkTVKaHFBeHV49PmTZSQ0zihtuRuZBpCiQ Vgr+3fPzkUucoFM0MuA0niuDr2JTeyXtFeb0xUmB0XV70CKaNxQhgNhnPErqc2l7YU/j WjoYJAUAttbKK+2QuMAc+T9cKUA+O94U+c2+XndV31brI8yL81EovBtM6t39Fe94UTC7 dcNA== X-Gm-Message-State: ANoB5plkgKuQHkSH9j7+q43zx0IGf/m6O/hiPLjcDP6uPEUp4VEwZAXl 5GL1po2seciCmKfm5QqvEF+VijYAuGV8iX5TWDI= X-Received: by 2002:a05:6808:296:b0:35b:bebf:f89c with SMTP id z22-20020a056808029600b0035bbebff89cmr1779789oic.15.1670551545673; Thu, 08 Dec 2022 18:05:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 11/27] tcg/s390x: Use LARL+AGHI for odd addresses Date: Thu, 8 Dec 2022 20:05:14 -0600 Message-Id: <20221209020530.396391-12-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::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.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 Add one instead of dropping odd addresses to the constant pool. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index e4403ffabf..6cf07152a5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -806,6 +806,7 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long sval) { tcg_target_ulong uval; + ptrdiff_t pc_off; /* Try all 32-bit insns that can load it in one go. */ if (maybe_out_small_movi(s, type, ret, sval)) { @@ -832,14 +833,14 @@ static void tcg_out_movi(TCGContext *s, TCGType type, return; } - /* Try for PC-relative address load. For odd addresses, - attempt to use an offset from the start of the TB. */ - if ((sval & 1) == 0) { - ptrdiff_t off = tcg_pcrel_diff(s, (void *)sval) >> 1; - if (off == (int32_t)off) { - tcg_out_insn(s, RIL, LARL, ret, off); - return; + /* Try for PC-relative address load. For odd addresses, add one. */ + pc_off = tcg_pcrel_diff(s, (void *)sval) >> 1; + if (pc_off == (int32_t)pc_off) { + tcg_out_insn(s, RIL, LARL, ret, pc_off); + if (sval & 1) { + tcg_out_insn(s, RI, AGHI, ret, 1); } + return; } /* Otherwise, stuff it in the constant pool. */ From patchwork Fri Dec 9 02:05:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632229 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp592360pvb; Thu, 8 Dec 2022 18:17:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf78gOENB/YAeEDf3luokuZsu31L40JMJmgcx+GMy8SZ34lA9iU5cQ1n+FNLJHBCna2lv1Zj X-Received: by 2002:a05:622a:1b92:b0:39c:da20:602 with SMTP id bp18-20020a05622a1b9200b0039cda200602mr7725000qtb.12.1670552227177; Thu, 08 Dec 2022 18:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552227; cv=none; d=google.com; s=arc-20160816; b=WuQZOYsZJG51y15Ly/DWjt3pf0O55SHh+TKWmKD6cQ3pHhiDPGqqjxExfWRdX8NOvY vpDYlZgLOxx8tyQTOCBa0u21iLfJhd2kWmZuno+M6dE1Y2UZhHtEGldAOG8OzBeWV911 8dUD7ET1MO9NyRCc7lUXWhEhKbEt9UvfUNMhw6F8ck5eE8s2SwlxZviWignYNtSnkAt5 Ti3f2Vg4bF3idyThNOB6l54HuK6ZQxscCrQg37yg25r0d39msRyf4EgRBbTaofVDynEM p6f+naxknyCd/lMVmObniWaO9VRYRFTVAtAoMbnmPJFntW892kKTA6r697kKYaqIg1H0 vwMg== 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=C23h7Yx8JzQKAeZMd/n6e9yoB9czBQRnkklZY0NaEjA=; b=E3iVaEPqaZYd99eCOYEosX2Bp+1oq5wzNB6Ao9qlJbsHtwUaYFaXlrIzcq451SE7eY LX9mWGrbBsZiUstpDzz5g+rxZEI6K/hG55ZYy1wvgJ6seagU2k+/LkHz+LYU50DIbtC1 nr2IQnjSDA3Wac+UUqQ3Xh5En2zy+zt5tKkr2D60/iUHlHSNX7WUqNGlJyt2aJtOhu5p /vAL7exL7CIE2wl7ZWY+MRtUUInf5HIGiPiSgejaStVmkwT/tyxscMTaMMt/Nexb6aPq toXJbjpeLHiN0GXFMKxAPU3jfQ34gA8+KzLL6m1oCZ0NKmA5b4Ad5tY2SVotQEscWTH+ H3ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wnHIgHTF; 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 ci25-20020a05622a261900b0039abfb4cabdsi15946qtb.748.2022.12.08.18.17.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:17:07 -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=wnHIgHTF; 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 1p3Slv-0005yT-56; Thu, 08 Dec 2022 21:05:55 -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 1p3Slt-0005xd-Jf for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:53 -0500 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slr-0001wd-OO for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:53 -0500 Received: by mail-ot1-x329.google.com with SMTP id a7-20020a056830008700b0066c82848060so1994178oto.4 for ; Thu, 08 Dec 2022 18:05:47 -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=C23h7Yx8JzQKAeZMd/n6e9yoB9czBQRnkklZY0NaEjA=; b=wnHIgHTFw19JGK/R66MmcQymZkEZtYBCrbpik4bUNKR7pDuDkW2d9GJUlryoA66WnU YnnokWy0pRPtDpqmhEtTe2+3PHevBI4DgK9WWkY7jjB38Pd0ZbFDx0Sb1ROAe/LwuZoA qpsPE0J9JPFXxToC8bVitPkF9QbnYmeaBkvOt8jnmWbd398zlG1sqZ8odbxZLsiO83gO J4m7yoeGu5wmabQFUTXrplO3zlY4DmhQHV5WTxc3IUrel9txvqfn/GlCwdFuybeeRrRZ TPGOF6LbhbMevDcp/PvHhrnPOFuDuplNWEyXv+GB74ZgBkRdrbOKq+xKjEKZWUdEHF+K cZwQ== 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=C23h7Yx8JzQKAeZMd/n6e9yoB9czBQRnkklZY0NaEjA=; b=mJsYdbpFfKj2wQyCkqedLgmVu6mdB10oiSgwww36+3I+/LUOyr7qH05LIlQpYFRzPu qyxWDZN/QsTcApLf0fGz9gq3nmtAhn8MwZLQR3mZPNS/rAUNapVaLW/7fJ0XoqYPc0BC z59XwyrSzvC1Y6lGNZ7g61wZzKbWKmlmtZeFKHdg46SmHlHsvplIX1eMlZ/OFnbAM2ml BizgelGxHl2/opPX8mqNEE7dDnPLbrWPZsRky9+fcgFT5Ebq5G3yDggcccBLwlbY6lOJ c15bp5mzvaYNqfjVwLIEXSgiPEPdeAHxI6iXipm9MV8nvfYRFdECleDCm3gW3Dwdyo7O iCKQ== X-Gm-Message-State: ANoB5plmZO6HUkKDSbddWnGFX5DS+M4AnCToTdIxpRPtX4YDBBT0xRS7 C7AVvQUmLzR9IlWpz1nRQnNBeDOf0zsmcnA1E4k= X-Received: by 2002:a05:6830:2098:b0:670:6976:a864 with SMTP id y24-20020a056830209800b006706976a864mr1966221otq.29.1670551546822; Thu, 08 Dec 2022 18:05:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 12/27] tcg/s390x: Distinguish RRF-a and RRF-c formats Date: Thu, 8 Dec 2022 20:05:15 -0600 Message-Id: <20221209020530.396391-13-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::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.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 One has 3 register arguments; the other has 2 plus an m3 field. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 6cf07152a5..d38a602dd9 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -172,18 +172,19 @@ typedef enum S390Opcode { RRE_SLBGR = 0xb989, RRE_XGR = 0xb982, - RRF_LOCR = 0xb9f2, - RRF_LOCGR = 0xb9e2, - RRF_NRK = 0xb9f4, - RRF_NGRK = 0xb9e4, - RRF_ORK = 0xb9f6, - RRF_OGRK = 0xb9e6, - RRF_SRK = 0xb9f9, - RRF_SGRK = 0xb9e9, - RRF_SLRK = 0xb9fb, - RRF_SLGRK = 0xb9eb, - RRF_XRK = 0xb9f7, - RRF_XGRK = 0xb9e7, + RRFa_NRK = 0xb9f4, + RRFa_NGRK = 0xb9e4, + RRFa_ORK = 0xb9f6, + RRFa_OGRK = 0xb9e6, + RRFa_SRK = 0xb9f9, + RRFa_SGRK = 0xb9e9, + RRFa_SLRK = 0xb9fb, + RRFa_SLGRK = 0xb9eb, + RRFa_XRK = 0xb9f7, + RRFa_XGRK = 0xb9e7, + + RRFc_LOCR = 0xb9f2, + RRFc_LOCGR = 0xb9e2, RR_AR = 0x1a, RR_ALR = 0x1e, @@ -538,8 +539,14 @@ static void tcg_out_insn_RRE(TCGContext *s, S390Opcode op, tcg_out32(s, (op << 16) | (r1 << 4) | r2); } -static void tcg_out_insn_RRF(TCGContext *s, S390Opcode op, - TCGReg r1, TCGReg r2, int m3) +static void tcg_out_insn_RRFa(TCGContext *s, S390Opcode op, + TCGReg r1, TCGReg r2, TCGReg r3) +{ + tcg_out32(s, (op << 16) | (r3 << 12) | (r1 << 4) | r2); +} + +static void tcg_out_insn_RRFc(TCGContext *s, S390Opcode op, + TCGReg r1, TCGReg r2, int m3) { tcg_out32(s, (op << 16) | (m3 << 12) | (r1 << 4) | r2); } @@ -1324,7 +1331,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, /* Emit: d = 0, t = 1, d = (cc ? t : d). */ tcg_out_movi(s, TCG_TYPE_I64, dest, 0); tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1); - tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc); + tcg_out_insn(s, RRFc, LOCGR, dest, TCG_TMP0, cc); } static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, @@ -1335,7 +1342,7 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, if (v3const) { tcg_out_insn(s, RIE, LOCGHI, dest, v3, cc); } else { - tcg_out_insn(s, RRF, LOCGR, dest, v3, cc); + tcg_out_insn(s, RRFc, LOCGR, dest, v3, cc); } } @@ -1356,7 +1363,7 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, tcg_out_mov(s, TCG_TYPE_I64, dest, a2); } /* Emit: if (one bit found) dest = r0. */ - tcg_out_insn(s, RRF, LOCGR, dest, TCG_REG_R0, 2); + tcg_out_insn(s, RRFc, LOCGR, dest, TCG_REG_R0, 2); } } @@ -1960,7 +1967,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } else if (a0 == a1) { tcg_out_insn(s, RR, SR, a0, a2); } else { - tcg_out_insn(s, RRF, SRK, a0, a1, a2); + tcg_out_insn(s, RRFa, SRK, a0, a1, a2); } break; @@ -1972,7 +1979,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } else if (a0 == a1) { tcg_out_insn(s, RR, NR, a0, a2); } else { - tcg_out_insn(s, RRF, NRK, a0, a1, a2); + tcg_out_insn(s, RRFa, NRK, a0, a1, a2); } break; case INDEX_op_or_i32: @@ -1983,7 +1990,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } else if (a0 == a1) { tcg_out_insn(s, RR, OR, a0, a2); } else { - tcg_out_insn(s, RRF, ORK, a0, a1, a2); + tcg_out_insn(s, RRFa, ORK, a0, a1, a2); } break; case INDEX_op_xor_i32: @@ -1994,7 +2001,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } else if (a0 == a1) { tcg_out_insn(s, RR, XR, args[0], args[2]); } else { - tcg_out_insn(s, RRF, XRK, a0, a1, a2); + tcg_out_insn(s, RRFa, XRK, a0, a1, a2); } break; @@ -2220,7 +2227,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a2 = -a2; goto do_addi_64; } else { - tcg_out_insn(s, RRF, SGRK, a0, a1, a2); + tcg_out_insn(s, RRFa, SGRK, a0, a1, a2); } break; @@ -2230,7 +2237,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_andi(s, TCG_TYPE_I64, args[0], args[2]); } else { - tcg_out_insn(s, RRF, NGRK, a0, a1, a2); + tcg_out_insn(s, RRFa, NGRK, a0, a1, a2); } break; case INDEX_op_or_i64: @@ -2239,7 +2246,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_ori(s, TCG_TYPE_I64, a0, a2); } else { - tcg_out_insn(s, RRF, OGRK, a0, a1, a2); + tcg_out_insn(s, RRFa, OGRK, a0, a1, a2); } break; case INDEX_op_xor_i64: @@ -2248,7 +2255,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_mov(s, TCG_TYPE_I64, a0, a1); tgen_xori(s, TCG_TYPE_I64, a0, a2); } else { - tcg_out_insn(s, RRF, XGRK, a0, a1, a2); + tcg_out_insn(s, RRFa, XGRK, a0, a1, a2); } break; From patchwork Fri Dec 9 02:05:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632232 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp593046pvb; Thu, 8 Dec 2022 18:19:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JCZDGAFhQGHJvu16xxtEMtIcQKMqznJfAMZI2GjkgAQJpjEwY4tvOmLEzAh7nXlCFopFq X-Received: by 2002:a05:6214:e6c:b0:4c7:7257:68a2 with SMTP id jz12-20020a0562140e6c00b004c7725768a2mr7833922qvb.15.1670552345335; Thu, 08 Dec 2022 18:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552345; cv=none; d=google.com; s=arc-20160816; b=qDuRD2goVhAXPO44J1NDjh/jRJVDwtwGwz9YfXaluOUY4mVPXi8LfTZgAW3o0b0zdJ QpxGUYkKEO1acjCXsF5G+vK6TdWJKLxBqZJmyYBDtCMVM7cO5oGzdkdIFN/CdOOnzc2V OwZq/N4H3bcG/ZGStXxam/4I1yhEt/FuGdJNXL3y3JfXObNiMDUNoCaWzDQ/zrfMqi/3 S9IAwlcPGwyLkQWDD6FSNnxgfuJ5a31dDi4pvhtnjtsz8LuGx33Lx+jtERlVzHpt6RMo 04uEg2DL7ufeIa0JLqITMCO7LZrUqrgo2a6EhsoV0q2GRZztHJeH58HgJJl2A8ZttR4i 8ylw== 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=R/GryLdVxy6DbC9JdLFOg5oT779WNfnXadHx5Ifz/fE=; b=rFJVY0M8BYbbrZGK8cVxkSGdJJ1G9QBB01+mhK1cFKUXJGhNKyMEYx5nA+EFEkLjUp rxQoNTtY7kCEIPYrhALg9FbgcXLczayNDHewuleZ/ZQpqCeQZrBmDHavjfDeC+Kh7xa3 LUcwiCU/soD4/vUoWqPpakLt0ZTY4xYE+V2o7K91SnHA8Xl6wgTiHk7l4EYl/bhq22az 8zSwL1vyeMmw5/L/Cm/sOMjBH44UUV+vVgb3+On7IzRnpsrwAz2bkxx++y2gjdG7Hsil s8h9kPNa7sYO9NBMBNad2oSC/RpNCO27VRkHYJH2WMc0eUQjKPL635rntJUwL5Iuw50i VGkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kTutfcM3; 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 u15-20020a0562141c0f00b004c5d62cafcesi79634qvc.307.2022.12.08.18.19.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:19:05 -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=kTutfcM3; 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 1p3Slv-0005yu-F5; Thu, 08 Dec 2022 21:05:55 -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 1p3Slt-0005xc-Gk for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:53 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slr-0001wp-Ox for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:53 -0500 Received: by mail-oi1-x232.google.com with SMTP id q186so3252300oia.9 for ; Thu, 08 Dec 2022 18:05:48 -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=R/GryLdVxy6DbC9JdLFOg5oT779WNfnXadHx5Ifz/fE=; b=kTutfcM3BgDFkYEZmD2+7gjWxHkwtYVxlflt4Queht7GMlsatiGBo0gsRE988KDt0q 5eQ8QKkvk0HKKVZHQ/smUo1N3zoMkQEDiLPl40x0nh+8WjJUOf+/vylPDPk7Nq46gX+8 0gGSjPkhK1IjJ5rmRty5SDkx2fscWLRmLB4U7IcG+B83vXPzRklIKjD5Cw1d7CjN8M58 vFoUpS/5wOv/XVnVr01cg2uVRWsuo42/ETRf5pstYTIsEytAxaJJY/RclCsjIFhhQJsP vxJpZU7CmFutfHWDqrpnC9lRwDu5CCEceMhjtdyhVwBgNACkqIokCwm/KfcBLJkMmlfr lGuw== 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=R/GryLdVxy6DbC9JdLFOg5oT779WNfnXadHx5Ifz/fE=; b=VF26l5xJmkLupecYiPALLclzWM6wz1iyQq4thm93PTdCZJFJ26buR/6ZGPjgvRN830 xwUGT/SBul2fXcit50jO1tj5aDG0VScMB34Z0L37HwGO01BpIqbiRW8li9a2BD955HCR tC80vHml6dhiabuAUqSAg7Y/pJZ7Fza9rNIFDI2Kq8R1raJT8ViSAivQFjkWRxRDzy1Z 5JpnVrkOdW5HudTI88r3Id386ltawd8ztfvZ6pyxalba4OzRq38fqoXz0WQ6WRiyfTqv 8tXvIUipYgJXK+aMmcubv9Ra6/WQjbCPu6R1iTOpwBV9x8BU8OHftRBzhQmaWxN6aDZD U1hQ== X-Gm-Message-State: ANoB5pm33TjPDnkTlqAj1k8wQETBDbaIdBqoPsC/uTNmlqY10xwGvtqg NGiyFDpik1C2CtfEqxgoO2tmrJY/iPJ7FOg14s4= X-Received: by 2002:a05:6808:1b23:b0:355:1de8:cd59 with SMTP id bx35-20020a0568081b2300b003551de8cd59mr2385992oib.23.1670551547942; Thu, 08 Dec 2022 18:05:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 13/27] tcg/s390x: Distinguish RIE formats Date: Thu, 8 Dec 2022 20:05:16 -0600 Message-Id: <20221209020530.396391-14-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::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 There are multiple variations, with different fields. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 47 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index d38a602dd9..a81a82c70b 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -128,16 +128,19 @@ typedef enum S390Opcode { RI_OILL = 0xa50b, RI_TMLL = 0xa701, - RIE_CGIJ = 0xec7c, - RIE_CGRJ = 0xec64, - RIE_CIJ = 0xec7e, - RIE_CLGRJ = 0xec65, - RIE_CLIJ = 0xec7f, - RIE_CLGIJ = 0xec7d, - RIE_CLRJ = 0xec77, - RIE_CRJ = 0xec76, - RIE_LOCGHI = 0xec46, - RIE_RISBG = 0xec55, + RIEb_CGRJ = 0xec64, + RIEb_CLGRJ = 0xec65, + RIEb_CLRJ = 0xec77, + RIEb_CRJ = 0xec76, + + RIEc_CGIJ = 0xec7c, + RIEc_CIJ = 0xec7e, + RIEc_CLGIJ = 0xec7d, + RIEc_CLIJ = 0xec7f, + + RIEf_RISBG = 0xec55, + + RIEg_LOCGHI = 0xec46, RRE_AGR = 0xb908, RRE_ALGR = 0xb90a, @@ -556,7 +559,7 @@ static void tcg_out_insn_RI(TCGContext *s, S390Opcode op, TCGReg r1, int i2) tcg_out32(s, (op << 16) | (r1 << 20) | (i2 & 0xffff)); } -static void tcg_out_insn_RIE(TCGContext *s, S390Opcode op, TCGReg r1, +static void tcg_out_insn_RIEg(TCGContext *s, S390Opcode op, TCGReg r1, int i2, int m3) { tcg_out16(s, (op & 0xff00) | (r1 << 4) | m3); @@ -985,9 +988,9 @@ static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src, int msb, int lsb, int ofs, int z) { /* Format RIE-f */ - tcg_out16(s, (RIE_RISBG & 0xff00) | (dest << 4) | src); + tcg_out16(s, (RIEf_RISBG & 0xff00) | (dest << 4) | src); tcg_out16(s, (msb << 8) | (z << 7) | lsb); - tcg_out16(s, (ofs << 8) | (RIE_RISBG & 0xff)); + tcg_out16(s, (ofs << 8) | (RIEf_RISBG & 0xff)); } static void tgen_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) @@ -1266,7 +1269,7 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, /* Emit: d = 0, d = (cc ? 1 : d). */ cc = tgen_cmp(s, type, cond, c1, c2, c2const, false); tcg_out_movi(s, TCG_TYPE_I64, dest, 0); - tcg_out_insn(s, RIE, LOCGHI, dest, 1, cc); + tcg_out_insn(s, RIEg, LOCGHI, dest, 1, cc); return; } @@ -1340,7 +1343,7 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, { int cc = tgen_cmp(s, type, c, c1, c2, c2const, false); if (v3const) { - tcg_out_insn(s, RIE, LOCGHI, dest, v3, cc); + tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); } else { tcg_out_insn(s, RRFc, LOCGR, dest, v3, cc); } @@ -1409,6 +1412,7 @@ static void tgen_compare_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, TCGReg r2, TCGLabel *l) { tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); + /* Format RIE-b */ tcg_out16(s, (opc & 0xff00) | (r1 << 4) | r2); tcg_out16(s, 0); tcg_out16(s, cc << 12 | (opc & 0xff)); @@ -1418,6 +1422,7 @@ static void tgen_compare_imm_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, int i2, TCGLabel *l) { tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); + /* Format RIE-c */ tcg_out16(s, (opc & 0xff00) | (r1 << 4) | cc); tcg_out16(s, 0); tcg_out16(s, (i2 << 8) | (opc & 0xff)); @@ -1435,8 +1440,8 @@ static void tgen_brcond(TCGContext *s, TCGType type, TCGCond c, if (!c2const) { opc = (type == TCG_TYPE_I32 - ? (is_unsigned ? RIE_CLRJ : RIE_CRJ) - : (is_unsigned ? RIE_CLGRJ : RIE_CGRJ)); + ? (is_unsigned ? RIEb_CLRJ : RIEb_CRJ) + : (is_unsigned ? RIEb_CLGRJ : RIEb_CGRJ)); tgen_compare_branch(s, opc, cc, r1, c2, l); return; } @@ -1449,18 +1454,18 @@ static void tgen_brcond(TCGContext *s, TCGType type, TCGCond c, */ if (type == TCG_TYPE_I32) { if (is_unsigned) { - opc = RIE_CLIJ; + opc = RIEc_CLIJ; in_range = (uint32_t)c2 == (uint8_t)c2; } else { - opc = RIE_CIJ; + opc = RIEc_CIJ; in_range = (int32_t)c2 == (int8_t)c2; } } else { if (is_unsigned) { - opc = RIE_CLGIJ; + opc = RIEc_CLGIJ; in_range = (uint64_t)c2 == (uint8_t)c2; } else { - opc = RIE_CGIJ; + opc = RIEc_CGIJ; in_range = (int64_t)c2 == (int8_t)c2; } } 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: From patchwork Fri Dec 9 02:05:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632216 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589871pvb; Thu, 8 Dec 2022 18:10:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+nO3I+b0tUoRZbhfmyaPZ1n/2ox/JnXvKRRhys9CBlRp4o47cbaOVliG5RnuTghgL84BA X-Received: by 2002:a05:622a:228c:b0:3a5:844e:8d52 with SMTP id ay12-20020a05622a228c00b003a5844e8d52mr6950628qtb.51.1670551800582; Thu, 08 Dec 2022 18:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551800; cv=none; d=google.com; s=arc-20160816; b=muqk7AkjvIaNuIKj+2obZi8Fs71lbHus7mtaALsHPheW2jicRpVLayga7GiwE/c1V0 LvqZ01C1DHIpo97duTkncdC6eho6g/H2KuABz8RUqdLC9U4IYMPeeAOi+104UkQ1Ai27 +viTc1WE0voj/IkcQoAPC1862FtBL1K+xpVFbUQc+L0563rnSIueca66n1hEmwCAwczG l/98XWarP3/EZe8OL831xg+8DpJ3X+lUGLNs+F3QUwLVlHB61V2nnhAMvjv8cYpPKkWk lVi9smSjqJxPD5id+09iblOjBxwwDfsAknBzaf3h9Xad+IHAahIYBp8igQ7s1WvWfrZ/ plJg== 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=NaBpyNP86SB9+qMhyajHTpSzcVMfDZDqPcSFABJu3pg=; b=d9TB2fP1QqCbET9mW1g3/dzDWUbCDTfZi8fKMa02p6zGbgn24ILjBLlXUXXLUkbGEi aBhq0xHDBPCxE8pkIJsY71LIaHcH4s/ocgQDLN6Ras0YdPemSIGUrlylLXRaA95f+03R QLr0yBAF5bWiet/bH5CP0brwXz2r81ddC/1Bblx6vyhkgkWZte/1eQZ3+MEZSAooE62/ 0Ww51sKKH6JTU1ECvVF0DaofiEr+rRImG6VJ8QzWl1+frkQ7QcICDpDWpNnVSfbY8APw 1FZ6GtriFh8+JUjDvHr+BQh+uHLiQZVyY1xM8iOQHbnDyRlifKBv3cmnpFYLKoO6tD7B nMEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iSb+oWAm; 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 x2-20020ac87a82000000b0039cca19804asi33155qtr.18.2022.12.08.18.10.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:10:00 -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=iSb+oWAm; 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 1p3Slw-0005zI-B3; Thu, 08 Dec 2022 21:05:56 -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 1p3Slu-0005yR-W0 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:55 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slr-0001uu-Pl for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:54 -0500 Received: by mail-ot1-x32d.google.com with SMTP id p10-20020a9d76ca000000b0066d6c6bce58so1981748otl.7 for ; Thu, 08 Dec 2022 18:05:50 -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=NaBpyNP86SB9+qMhyajHTpSzcVMfDZDqPcSFABJu3pg=; b=iSb+oWAm6ZpVGdkxuo575hxDyvaEngcAasqkI9TFLnygAP7S2xCHTR4lhtCQrDN1sS nNVzlBL9uMne0kDQqyBmyLkPT0QfbzqVWCVSXMuPCkJ5h/uA/3wrYjVryudJUZJkl8MM 7ds4bDNCMlOZn+AhIZ67q7lmivGI7eiJJtRCngAQ1hjH9qGQuzllW0NS8s8DZoboLccV SeUfvcB6ZwC4muAgXQTJ2lAw2mwp6H28GA7tx1PEIA7XH31X7NQX+NzcA4blG8Mc7iVK bmm2RW88J1vwdkmwivgPKBF9GheLFEckojxYfvt5S+zPjpCu2dx1fojKGI1zh2+7lPjy KrEA== 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=NaBpyNP86SB9+qMhyajHTpSzcVMfDZDqPcSFABJu3pg=; b=vVUHV+VZYMqzMGriMyQ8iruRPU0boxLFn712PlGIgGp1QmLh+GzOyaNLhsY6vUVdc0 So+qN/InAXUATNay1IQsnoE/HiKreCWPDli9dbNgLDS7pOg7awkqAIsql/4T/4TQ6h1s eH9qr6bmiYIFq7rZPt1G/Ike5fYLMGYhzLHhSXIspBQ8kxm1LfdaTwqW7IrHMB+/dHsM L985egTDxRRPEyWsvpFsEdHk3xwqHOg/Jfwoor13P7kIA62pCZvPnlVpm7SNtnlCv88Q OJ6rxXUseHZeAqWcGrYipmGQfHGyiPZb63V9DeVqogTijoRYVVCI0B7E2Gcr10ePLf/E rt6Q== X-Gm-Message-State: ANoB5pkKyQdnxMiCLvo+a8Bij4Pm7BMFDhIHMtncIGvOf63bFeZ4Lcc2 CXH73H1aXCBCGG5PmjGTTPF2zEBO9xva4fMKQng= X-Received: by 2002:a9d:5d18:0:b0:66d:a2:d0e with SMTP id b24-20020a9d5d18000000b0066d00a20d0emr1830979oti.15.1670551550190; Thu, 08 Dec 2022 18:05:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 15/27] tcg/s390x: Support MIE2 MGRK instruction Date: Thu, 8 Dec 2022 20:05:18 -0600 Message-Id: <20221209020530.396391-16-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::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.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 a 3-operand signed 64x64->128 multiply. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target.h | 2 +- tcg/s390x/tcg-target.c.inc | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 33a82e3286..b1a89a88ba 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -31,6 +31,7 @@ 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(o, m, 0, r) +C_O2_I2(o, m, r, 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) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 1fb7b8fb1d..03ce11a34a 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -136,7 +136,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_add2_i64 1 #define TCG_TARGET_HAS_sub2_i64 1 #define TCG_TARGET_HAS_mulu2_i64 1 -#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 HAVE_FACILITY(MISC_INSN_EXT2) #define TCG_TARGET_HAS_muluh_i64 0 #define TCG_TARGET_HAS_mulsh_i64 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 9634126ed1..871fcb7683 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -175,6 +175,7 @@ typedef enum S390Opcode { RRE_SLBGR = 0xb989, RRE_XGR = 0xb982, + RRFa_MGRK = 0xb9ec, RRFa_MSRKC = 0xb9fd, RRFa_MSGRKC = 0xb9ed, RRFa_NRK = 0xb9f4, @@ -2319,6 +2320,11 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_debug_assert(args[0] == args[1] + 1); tcg_out_insn(s, RRE, MLGR, args[1], args[3]); break; + case INDEX_op_muls2_i64: + tcg_debug_assert((args[1] & 1) == 0); + tcg_debug_assert(args[0] == args[1] + 1); + tcg_out_insn(s, RRFa, MGRK, args[1], args[2], args[3]); + break; case INDEX_op_shl_i64: op = RSY_SLLG; @@ -3009,6 +3015,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_mulu2_i64: return C_O2_I2(o, m, 0, r); + case INDEX_op_muls2_i64: + return C_O2_I2(o, m, r, r); case INDEX_op_add2_i32: case INDEX_op_sub2_i32: From patchwork Fri Dec 9 02:05:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632222 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591574pvb; Thu, 8 Dec 2022 18:14:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf7R+h7JToe1zRC/ZJCA1cRHq7qQS6PbBuKcUumMR+5ZkVjAA8mz4eAI3KoTNOonV2jf+fyN X-Received: by 2002:a0c:f7d0:0:b0:4c7:5d34:f38d with SMTP id f16-20020a0cf7d0000000b004c75d34f38dmr6088010qvo.38.1670552099471; Thu, 08 Dec 2022 18:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552099; cv=none; d=google.com; s=arc-20160816; b=xt0SeBrhidod04jNYpU7ENvx9CiF2CZTQGFFYrxNLeEIxmjoKfIgkxC6EK7fSCg+2H GdVkV11hh2/IBBBVEy7NNlkd8IEguYj9JJE3VYAMZNNQMGXQeFLWjUS6MVW+FksfBc7U 8h4BPZyv5gfU0gdk0wcLo3LJq6d0pIr58kgBZQilGAQqO0aCrRjY/hWK0oiaj/JmnDop XK04JsoWlBmBF8RmpKk8pUat2KEto8EWPQ1MjlycmmZODJyS3VlRQ0aS8Avz/K6MeTGf 5TetJ4oC+dUkltirQ1CqPob9VNOv2RjpbJHg2bKYe8/6T4FJvGY3HwrP1ROOEk9V8/we LHjw== 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=6OEoXXqHMNZJwrhmfB7qxU47ScigEd04r0yEUlWf38k=; b=o6i7MhPSa98BwVE43MbjhuOg9WbCmrGqLbjIgJMJ2oWP8b/dlDZn151EnS1UbIaHoa CFIn2DXn43x9RPkUZslChTW3GeXeAxZsJcGwKRwTjXpXtvmaUAr7R2Q6+QGknYpvtjip u6Tprfcp9uHYvZEZoU9i1Me7WoJ/3NCNzVBnrq8RcsL2rdqMHxyVkslMyt272pnXe9G/ 50dTZ/mR+OgH4JWz6RXuCn9/91JaaQBeXAnYcXfJpeuWReAgx9/bdObjo+Pe2rE2cqvO uv3gFCzo+vFHrbdvALfEOdtdef2zu4kG+wxgB3Kkw8a4DfuySXgykYXkcYe/xRqys33Z OWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yCYWPUOJ; 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 r62-20020a37a841000000b006fa2050406bsi59091qke.283.2022.12.08.18.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:14:59 -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=yCYWPUOJ; 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 1p3Slv-0005z8-RI; Thu, 08 Dec 2022 21:05:55 -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 1p3Slu-0005yQ-VP for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:55 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sls-0001x7-E9 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:54 -0500 Received: by mail-ot1-x333.google.com with SMTP id m7-20020a9d6447000000b0066da0504b5eso1970371otl.13 for ; Thu, 08 Dec 2022 18:05:52 -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=6OEoXXqHMNZJwrhmfB7qxU47ScigEd04r0yEUlWf38k=; b=yCYWPUOJ+s+a0Rb21laCjCP8vqGLlGtP6c7Zb6EyeB/CQ/3pOC8g1oGBFvjolTqjVG dQFhNkRgIbeLBnrCytlSkoWVqR8yIUV8Vphiqad6xx/It70f2AXfj6VNJn7YyOslhd/9 ZyVI8GQLg6Yd34kZlPLO0RvuGqUfu2a/sTwc1vQrt6lKH5s+zhlSD2AlaT14eZJ7tfdI CukVNcxJiRtL71+1OWqSeEMRP3enmd0yAKI56k8mmKgYEp3agX2EZJBlKlNnja5oa86R EO7RqODXej00Xm9KNY9IWGlf51xCk3LQdb39uxe9VZtTfF84LEMyTtly0VhI+t3w3F8v MYPA== 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=6OEoXXqHMNZJwrhmfB7qxU47ScigEd04r0yEUlWf38k=; b=UKLrq5nGT0lPL4JpvTQVv/k5s3kCGAn8OGRTCZj0Itl887juFKdxiw4az9bDAZPlf9 Vk2ZDrku5lxDG0K0600rGHFk9/zfWZLn2+MRUNK75ACSvQ3tIi54jgVbAvCH7f22EguZ i+E+Dy8oOin7A+UVVppcs3luPcqdOK/YnHjs2N3TqQX9hEB7LmUWqiV5p/P+6AlSZrXU 9mmmrf+HDC40hAolmDUrf38W7wWM7QuCnNrQTLXDTvsfnbk+GQWc1mCC9jcn0VoQ38ws U82cOifev0hGdFeBBxM5Hrh14h9mFTIPoVvV4Q0nOU6mIrAYAR9UV6+SKRZobVJrUgFU UuDQ== X-Gm-Message-State: ANoB5pnQqWCMl84PaDMx2Owyb2wrblzJ/eUXA2dKZaXxht2lMdPKgIkE WlI65YtWxH2MQO1oeVRPtcoLKrW3VEG2tRNsfVQ= X-Received: by 2002:a05:6830:6482:b0:661:dfeb:ea4b with SMTP id ck2-20020a056830648200b00661dfebea4bmr2069078otb.10.1670551551359; Thu, 08 Dec 2022 18:05:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 16/27] tcg/s390x: Issue XILF directly for xor_i32 Date: Thu, 8 Dec 2022 20:05:19 -0600 Message-Id: <20221209020530.396391-17-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::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 There is only one instruction that is applicable to a 32-bit immediate xor. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 871fcb7683..fc304327fc 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -2005,7 +2005,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a0 = args[0], a1 = args[1], a2 = (uint32_t)args[2]; if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I32, a0, a1); - tgen_xori(s, TCG_TYPE_I32, a0, a2); + tcg_out_insn(s, RIL, XILF, a0, a2); } else if (a0 == a1) { tcg_out_insn(s, RR, XR, args[0], args[2]); } else { From patchwork Fri Dec 9 02:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632217 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp590553pvb; Thu, 8 Dec 2022 18:11:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JN5xfOMHu0/RVq0QHb2x/9XvdRP3ypwRSv59qiMrVbEsXkVaS9tODdH36YHqCBi+VZ5OT X-Received: by 2002:ac8:521a:0:b0:3a7:e603:910a with SMTP id r26-20020ac8521a000000b003a7e603910amr6446205qtn.15.1670551917000; Thu, 08 Dec 2022 18:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551916; cv=none; d=google.com; s=arc-20160816; b=wRyvm0vYS8ms0wBMwFLnxQb4sEZyVqe/q+qeDP6Ict0X1aJWOA1b/Ad9Bj14voif8U NLWmZ/RsNvrFMEgFFGgi11o7SC4Wjrz2gTvLhY+ia7zsfRdndJusX6hX2DJ6Rdb8P2q5 8jQsvorgNsDuh8P6ORJHsE6i8jagclBH3PnHaTzCxQNM3HzEl5oMtqi4mmCDx8WB8zFk WBBcFhqtr+YrkwFjp1z6XdJb7DeIHb96+La6dscebXNu9gPqYd3sA32iFKjtYGvpmVvF VaViT5cnkXEY4eWQyy7B9FNscNzhX4MtjNv5RLspi37ogMnVtjpbNzUmQNSZelhlQrF0 se9w== 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=ZZ4VRWcd/3v2ZpQqxpOvmExXeCfgt0ZAkQUAPsPFAv4=; b=ZZYEdiu3PKmUt//JhfEDh8RQxFExW96gLfh6stWw7AFUo9V0CnvtALQJYgDZTi015k kz4xuk2hYPtfoYaPtttajmzb26n9JX5EP2DrChszGYpKUXv8703mbSGPc2dw1HTDdRvB ilB4cs7dTXaf4hhXerZ7zrq6bkXNJBkZFi0rbLK8EOywYXC0iQkArnKiBA9eD5WHa/AG lPPIF1fEqZD4md98ydNUjUJlhxyOEFjh/6UgdaAEhWbeGbkUUotZJU/qE8n44fjesACk x4fkVAIQP5V/tL72h+jxEfwhe85hrNef0tjdLIozPCAw4TdKmtf1asZQ9x/lcE6neUhQ WwKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XStexhSV; 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 v6-20020ac87486000000b003a69eb226casi34624qtq.54.2022.12.08.18.11.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:11:56 -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=XStexhSV; 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 1p3Slw-0005zP-K8; Thu, 08 Dec 2022 21:05:56 -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-0005z9-SF for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:55 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slt-0001xU-Ui for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:55 -0500 Received: by mail-ot1-x32c.google.com with SMTP id p24-20020a0568301d5800b0066e6dc09be5so1982002oth.8 for ; Thu, 08 Dec 2022 18:05:53 -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=ZZ4VRWcd/3v2ZpQqxpOvmExXeCfgt0ZAkQUAPsPFAv4=; b=XStexhSVBCjyCq9pMVOOtsEmM3gtG5ouAjxjxKEDK4f4IT3/b+X1akvSh5Jnjc+Bkk 7oT/A6RBtPm+mCtI767LBOH54HYZp/7DEq9iQsyUcJRkDdPQ7CjAAorvTgqJKzO6t1ni v1RTpD5Y1l57Yz1q2ug6A17y4uBuhUrMuuHh18ze8UVxAUPyVUATT2vxoTqhOoiM+9qI hgtFIQhniKB6RclNGB9y5z2GAwdXu/HtR2kmeGjQwPxaRSSK6ZgiQ0He6Rz/r+P4W08P oOSHMCfe0ggDHqm9FJdg1mYY7D20X83GS/ThgfUHSyS+jSD4WJo1ttJnWNkTzPiZmdWa IsMA== 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=ZZ4VRWcd/3v2ZpQqxpOvmExXeCfgt0ZAkQUAPsPFAv4=; b=6YdieSRd5hm3/Y1kb5/L6d5FFoz3PLH9iuuwvhrUkW7jIsiagp+BFFEq1s62zlz9mH rTa90Xm4+Nl5V1R775HBR3ByKuTF6Rc61rTH7Bj++ifnpApcHZ/qc3G0YbRjYgMVj4EN jOdHHvoVz1dVBk0dgAI1xYnI+aulw35tZwufU0XpehZwAme3misIck9/Z8E/swakvUJt Mc7lVBvTX3IxMFeeb7tvmy1G7yQv2Al9aGZfn/hsEP0CyVzvS9d1uo+WRjpSwvi79ZLh fzoDV5anUUTloDlu+qCuRzFE7YAJS25dId+q+Rc6jM3uFIyBe6Pp29SRAi9R/ls8rFMU 19Kw== X-Gm-Message-State: ANoB5pmaENyTyBbQOh+2/F+UODqCNt0hJRuIB7c3bclJduFiYw7ydY+a RzM+fgOlRsa6RARPI0WCUUzOt3xCPFV+V4Lxdx8= X-Received: by 2002:a9d:6511:0:b0:661:dfeb:ea2a with SMTP id i17-20020a9d6511000000b00661dfebea2amr1661759otl.15.1670551552666; Thu, 08 Dec 2022 18:05:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 17/27] tcg/s390x: Tighten constraints for or_i64 and xor_i64 Date: Thu, 8 Dec 2022 20:05:20 -0600 Message-Id: <20221209020530.396391-18-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::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 Drop support for sequential OR and XOR, as the serial dependency is slower than loading the constant first. Let the register allocator handle such immediates by matching only what one insn can achieve. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target-con-str.h | 1 + tcg/s390x/tcg-target.c.inc | 114 ++++++++++++++++----------------- 3 files changed, 56 insertions(+), 60 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index b1a89a88ba..34ae4c7743 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -24,6 +24,7 @@ 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, r, rK) 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-con-str.h b/tcg/s390x/tcg-target-con-str.h index 76446aecae..7b910d6d11 100644 --- a/tcg/s390x/tcg-target-con-str.h +++ b/tcg/s390x/tcg-target-con-str.h @@ -20,4 +20,5 @@ REGS('o', 0xaaaa) /* odd numbered general regs */ CONST('A', TCG_CT_CONST_S33) CONST('I', TCG_CT_CONST_S16) CONST('J', TCG_CT_CONST_S32) +CONST('K', TCG_CT_CONST_P32) CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index fc304327fc..2a7410ba58 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -37,6 +37,7 @@ #define TCG_CT_CONST_S32 0x200 #define TCG_CT_CONST_S33 0x400 #define TCG_CT_CONST_ZERO 0x800 +#define TCG_CT_CONST_P32 0x1000 #define ALL_GENERAL_REGS MAKE_64BIT_MASK(0, 16) #define ALL_VECTOR_REGS MAKE_64BIT_MASK(32, 32) @@ -507,6 +508,28 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, return false; } +static int is_const_p16(uint64_t val) +{ + for (int i = 0; i < 4; ++i) { + uint64_t mask = 0xffffull << (i * 16); + if ((val & ~mask) == 0) { + return i; + } + } + return -1; +} + +static int is_const_p32(uint64_t val) +{ + if ((val & 0xffffffff00000000ull) == 0) { + return 0; + } + if ((val & 0x00000000ffffffffull) == 0) { + return 1; + } + return -1; +} + /* Test if a constant matches the constraint. */ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { @@ -529,6 +552,14 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return val == 0; } + /* + * Note that is_const_p16 is a subset of is_const_p32, + * so we don't need both constraints. + */ + if ((ct & TCG_CT_CONST_P32) && is_const_p32(val) >= 0) { + return true; + } + return 0; } @@ -1125,7 +1156,7 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) } } -static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) +static void tgen_ori(TCGContext *s, TCGReg dest, uint64_t val) { static const S390Opcode oi_insns[4] = { RI_OILL, RI_OILH, RI_OIHL, RI_OIHH @@ -1136,70 +1167,32 @@ static void tgen_ori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) int i; - /* Look for no-op. */ - if (unlikely(val == 0)) { + i = is_const_p16(val); + if (i >= 0) { + tcg_out_insn_RI(s, oi_insns[i], dest, val >> (i * 16)); return; } - /* Try all 32-bit insns that can perform it in one go. */ - for (i = 0; i < 4; i++) { - tcg_target_ulong mask = (0xffffull << i * 16); - if ((val & mask) != 0 && (val & ~mask) == 0) { - tcg_out_insn_RI(s, oi_insns[i], dest, val >> i * 16); - return; - } + i = is_const_p32(val); + if (i >= 0) { + tcg_out_insn_RIL(s, oif_insns[i], dest, val >> (i * 32)); + return; } - /* Try all 48-bit insns that can perform it in one go. */ - for (i = 0; i < 2; i++) { - tcg_target_ulong mask = (0xffffffffull << i * 32); - if ((val & mask) != 0 && (val & ~mask) == 0) { - tcg_out_insn_RIL(s, oif_insns[i], dest, val >> i * 32); - return; - } - } - - if (maybe_out_small_movi(s, type, TCG_TMP0, val)) { - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RR, OR, dest, TCG_TMP0); - } else { - tcg_out_insn(s, RRE, OGR, dest, TCG_TMP0); - } - } else { - /* Perform the OR via sequential modifications to the high and - low parts. Do this via recursion to handle 16-bit vs 32-bit - masks in each half. */ - tgen_ori(s, type, dest, val & 0x00000000ffffffffull); - tgen_ori(s, type, dest, val & 0xffffffff00000000ull); - } + g_assert_not_reached(); } -static void tgen_xori(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) +static void tgen_xori(TCGContext *s, TCGReg dest, uint64_t val) { - /* Try all 48-bit insns that can perform it in one go. */ - if ((val & 0xffffffff00000000ull) == 0) { + switch (is_const_p32(val)) { + case 0: tcg_out_insn(s, RIL, XILF, dest, val); - return; - } - if ((val & 0x00000000ffffffffull) == 0) { + break; + case 1: tcg_out_insn(s, RIL, XIHF, dest, val >> 32); - return; - } - - if (maybe_out_small_movi(s, type, TCG_TMP0, val)) { - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RR, XR, dest, TCG_TMP0); - } else { - tcg_out_insn(s, RRE, XGR, dest, TCG_TMP0); - } - } else { - /* Perform the xor by parts. */ - if (val & 0xffffffff) { - tcg_out_insn(s, RIL, XILF, dest, val); - } - if (val > 0xffffffff) { - tcg_out_insn(s, RIL, XIHF, dest, val >> 32); - } + break; + default: + g_assert_not_reached(); } } @@ -1994,7 +1987,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a0 = args[0], a1 = args[1], a2 = (uint32_t)args[2]; if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I32, a0, a1); - tgen_ori(s, TCG_TYPE_I32, a0, a2); + tgen_ori(s, a0, a2); } else if (a0 == a1) { tcg_out_insn(s, RR, OR, a0, a2); } else { @@ -2256,7 +2249,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a0 = args[0], a1 = args[1], a2 = args[2]; if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I64, a0, a1); - tgen_ori(s, TCG_TYPE_I64, a0, a2); + tgen_ori(s, a0, a2); } else { tcg_out_insn(s, RRFa, OGRK, a0, a1, a2); } @@ -2265,7 +2258,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, a0 = args[0], a1 = args[1], a2 = args[2]; if (const_args[2]) { tcg_out_mov(s, TCG_TYPE_I64, a0, a1); - tgen_xori(s, TCG_TYPE_I64, a0, a2); + tgen_xori(s, a0, a2); } else { tcg_out_insn(s, RRFa, XGRK, a0, a1, a2); } @@ -2944,10 +2937,11 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_and_i32: case INDEX_op_and_i64: case INDEX_op_or_i32: - case INDEX_op_or_i64: case INDEX_op_xor_i32: - case INDEX_op_xor_i64: return C_O1_I2(r, r, ri); + case INDEX_op_or_i64: + case INDEX_op_xor_i64: + return C_O1_I2(r, r, rK); case INDEX_op_mul_i32: return (HAVE_FACILITY(MISC_INSN_EXT2) From patchwork Fri Dec 9 02:05:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632231 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp592998pvb; Thu, 8 Dec 2022 18:18:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf64SqGMHngt1ZQ/M+72hrcMurTJRyvkcDmnedTscidgOjqiNDH4W7pAUeKNs3vuM01HBySr X-Received: by 2002:ad4:5c41:0:b0:4c6:d7bd:cc93 with SMTP id a1-20020ad45c41000000b004c6d7bdcc93mr7433939qva.15.1670552335818; Thu, 08 Dec 2022 18:18:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552335; cv=none; d=google.com; s=arc-20160816; b=vTIX92+Ek5poSvf4tH93ZBpjnytOwvWzp7oijPNLmPjsvqyVRarlUFlj0xSWzhyQUH 6o+VMeHQ76ZrmBgFopEtDAnmqfZsfwO9PgbnEQGZ/EyMSfrD5sB12IKEGexjE64bU8RA UlwpqK73ZzV2zFM8a+dNS09Q8iMXni8uiJtIIrgnmmg2B0542GIZJgyuCalcEE/fUtGi AO4+KLFcfEvLbOhD3E7d58xjlDuUUrjxuA6hFn2DARWvLJqxAaVABR/xo846+HxFZYsL aVn/C2hZz1mZV5CMaDjB19ZRyaLw5FuKcYUI6mxs0K/J/+izd6usZDQxywFIakYHSqdw fEHg== 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=5faDdiSfEvPiidYdsg69vohbWPfRuJFVIG4ImR/in7c=; b=UFO0emCZv+wps5ZpgDZFf1IPYNwQpsv4AAoFihEKYo3CPjW3ALBuejhlIH5LbP1XqY qcYz+uaRT1YfVGh6Gbx3KSJNk0Feqtpq++yL0HGO/IPMxgxPx68KZJOG3N0AbVJKnY/K uGv53/MfMp7oWgcuYoVhLDrzeSK84YoB2xlIexdNPPEeTHxDT4SYJ7pXjqqzxtYTZH0T JQskNuzoLI8I79DlHhiVhaaAMhOS9byiQFhSA2wWbCDULOn7bQ2TR/P9xoLZiNVMBPvC h/94pjOWBBNPxRJ/eZTmZouo37qnjKV67kplFQgMnV0ZEgqGmzyKrk4SRB9UNZ8+u9eE FM3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bcKjlLcQ; 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 nh3-20020a056214390300b004bbf2926fdasi73926qvb.391.2022.12.08.18.18.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:18:55 -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=bcKjlLcQ; 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-00061f-TB; 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 1p3Slw-0005ze-SQ for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:56 -0500 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slu-0001xp-VK for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:56 -0500 Received: by mail-oi1-x229.google.com with SMTP id v82so3271153oib.4 for ; Thu, 08 Dec 2022 18:05:54 -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=5faDdiSfEvPiidYdsg69vohbWPfRuJFVIG4ImR/in7c=; b=bcKjlLcQA/Pmc+NyIQw+EXaFCTxVmn+36mw8mY3KklUehYSPwMsS1Izw0P2HPJcSKF +eJoSEFdXIMm+zAROWlnjShpO/eDMFaYZh1Mo9Px198nKqi5uDS4PEPIAEHk2UYNrOyz e0aRudmUE+TC42pw00Mho8YPb62hD9fq/BflM/RChUYRbDHYbHKdmOChCcYTj9WoLlMH e5AYH5EVCOUBz3zSEr6vZjc9M9biWiZTOMpOLefS1JUzj1fKGa8w0YjPsFzZJmk2iKTO hin7Js3ga31OajkKoSrNh9+cdIsLkFASdP/gOtwSiaTj2RxtmtVjK7qb0uIsIH9OscyM ITIQ== 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=5faDdiSfEvPiidYdsg69vohbWPfRuJFVIG4ImR/in7c=; b=RX+0kdFHDQ8fNsl/J3/KY4NqFpB3ciMxsnTU/NnwXZmC8NJtFGvHHDV6RXNDvCeG2R 5DQSv9lE4p/NgX7qMflPKZ+ntddLVC/xZyjCE819EKCXDynWfPSuhuh22hHaP21YkPtC VSf0Xg2drnA3/fNxGL0YMPkzTGEQcPDryqodEyGYo7jvDwFyQuox2NsKHgaXI7eDkbAZ CNXT0mH3ngzNdvhkntX1JLb/UkNivDXyLsT2G6GJrV3vEhf3mez5APUHDCaMe9ixBRkk mmSvPMexQScfip2WwywYEzxWJYdgOHcwGBMvJr/qYjHwdqO8Uv2gDiugXbRmelfEgyI4 ivYA== X-Gm-Message-State: ANoB5pmGJFbR/+1YMnDj/fKyMgUR4EMT2xFp+fTWBlnzwWgdEHtSJgZ0 PJyc6tXbXGIQzzQxT7iYEl4xWV8S7vPhoUYXaPI= X-Received: by 2002:a05:6808:2203:b0:355:6c59:6838 with SMTP id bd3-20020a056808220300b003556c596838mr2711712oib.27.1670551553772; Thu, 08 Dec 2022 18:05:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 18/27] tcg/s390x: Tighten constraints for and_i64 Date: Thu, 8 Dec 2022 20:05:21 -0600 Message-Id: <20221209020530.396391-19-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::229; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x229.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 Let the register allocator handle such immediates by matching only what one insn can achieve. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target-con-str.h | 2 + tcg/s390x/tcg-target.c.inc | 114 +++++++++++++++++---------------- 3 files changed, 61 insertions(+), 56 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 34ae4c7743..0c4d0da8f5 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -25,6 +25,7 @@ C_O1_I2(r, 0, rJ) C_O1_I2(r, r, ri) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) +C_O1_I2(r, r, rNKR) 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-con-str.h b/tcg/s390x/tcg-target-con-str.h index 7b910d6d11..6fa64a1ed6 100644 --- a/tcg/s390x/tcg-target-con-str.h +++ b/tcg/s390x/tcg-target-con-str.h @@ -21,4 +21,6 @@ CONST('A', TCG_CT_CONST_S33) CONST('I', TCG_CT_CONST_S16) CONST('J', TCG_CT_CONST_S32) CONST('K', TCG_CT_CONST_P32) +CONST('N', TCG_CT_CONST_INV) +CONST('R', TCG_CT_CONST_INVRISBG) CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 2a7410ba58..21007f94ad 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -33,11 +33,13 @@ #include "../tcg-pool.c.inc" #include "elf.h" -#define TCG_CT_CONST_S16 0x100 -#define TCG_CT_CONST_S32 0x200 -#define TCG_CT_CONST_S33 0x400 -#define TCG_CT_CONST_ZERO 0x800 -#define TCG_CT_CONST_P32 0x1000 +#define TCG_CT_CONST_S16 (1 << 8) +#define TCG_CT_CONST_S32 (1 << 9) +#define TCG_CT_CONST_S33 (1 << 10) +#define TCG_CT_CONST_ZERO (1 << 11) +#define TCG_CT_CONST_P32 (1 << 12) +#define TCG_CT_CONST_INV (1 << 13) +#define TCG_CT_CONST_INVRISBG (1 << 14) #define ALL_GENERAL_REGS MAKE_64BIT_MASK(0, 16) #define ALL_VECTOR_REGS MAKE_64BIT_MASK(32, 32) @@ -530,6 +532,38 @@ static int is_const_p32(uint64_t val) return -1; } +/* + * Accept bit patterns like these: + * 0....01....1 + * 1....10....0 + * 1..10..01..1 + * 0..01..10..0 + * Copied from gcc sources. + */ +static bool risbg_mask(uint64_t c) +{ + uint64_t lsb; + /* We don't change the number of transitions by inverting, + so make sure we start with the LSB zero. */ + if (c & 1) { + c = ~c; + } + /* Reject all zeros or all ones. */ + if (c == 0) { + return false; + } + /* Find the first transition. */ + lsb = c & -c; + /* Invert to look for a second transition. */ + c = ~c; + /* Erase the first transition. */ + c &= -lsb; + /* Find the second transition, if any. */ + lsb = c & -c; + /* Match if all the bits are 1's, or if c is zero. */ + return c == -lsb; +} + /* Test if a constant matches the constraint. */ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) { @@ -552,6 +586,9 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return val == 0; } + if (ct & TCG_CT_CONST_INV) { + val = ~val; + } /* * Note that is_const_p16 is a subset of is_const_p32, * so we don't need both constraints. @@ -559,6 +596,9 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) if ((ct & TCG_CT_CONST_P32) && is_const_p32(val) >= 0) { return true; } + if ((ct & TCG_CT_CONST_INVRISBG) && risbg_mask(~val)) { + return true; + } return 0; } @@ -1057,36 +1097,6 @@ static inline void tgen_ext32u(TCGContext *s, TCGReg dest, TCGReg src) tcg_out_insn(s, RRE, LLGFR, dest, src); } -/* Accept bit patterns like these: - 0....01....1 - 1....10....0 - 1..10..01..1 - 0..01..10..0 - Copied from gcc sources. */ -static inline bool risbg_mask(uint64_t c) -{ - uint64_t lsb; - /* We don't change the number of transitions by inverting, - so make sure we start with the LSB zero. */ - if (c & 1) { - c = ~c; - } - /* Reject all zeros or all ones. */ - if (c == 0) { - return false; - } - /* Find the first transition. */ - lsb = c & -c; - /* Invert to look for a second transition. */ - c = ~c; - /* Erase the first transition. */ - c &= -lsb; - /* Find the second transition, if any. */ - lsb = c & -c; - /* Match if all the bits are 1's, or if c is zero. */ - return c == -lsb; -} - static void tgen_andi_risbg(TCGContext *s, TCGReg out, TCGReg in, uint64_t val) { int msb, lsb; @@ -1126,34 +1136,25 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) return; } - /* Try all 32-bit insns that can perform it in one go. */ - for (i = 0; i < 4; i++) { - tcg_target_ulong mask = ~(0xffffull << i * 16); - if (((val | ~valid) & mask) == mask) { - tcg_out_insn_RI(s, ni_insns[i], dest, val >> i * 16); - return; - } + i = is_const_p16(~val & valid); + if (i >= 0) { + tcg_out_insn_RI(s, ni_insns[i], dest, val >> (i * 16)); + return; } - /* Try all 48-bit insns that can perform it in one go. */ - for (i = 0; i < 2; i++) { - tcg_target_ulong mask = ~(0xffffffffull << i * 32); - if (((val | ~valid) & mask) == mask) { - tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i * 32); - return; - } + i = is_const_p32(~val & valid); + tcg_debug_assert(i == 0 || type != TCG_TYPE_I32); + if (i >= 0) { + tcg_out_insn_RIL(s, nif_insns[i], dest, val >> (i * 32)); + return; } + if (risbg_mask(val)) { tgen_andi_risbg(s, dest, dest, val); return; } - tcg_out_movi(s, type, TCG_TMP0, val); - if (type == TCG_TYPE_I32) { - tcg_out_insn(s, RR, NR, dest, TCG_TMP0); - } else { - tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0); - } + g_assert_not_reached(); } static void tgen_ori(TCGContext *s, TCGReg dest, uint64_t val) @@ -2935,10 +2936,11 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_sub_i32: case INDEX_op_sub_i64: case INDEX_op_and_i32: - case INDEX_op_and_i64: case INDEX_op_or_i32: case INDEX_op_xor_i32: return C_O1_I2(r, r, ri); + case INDEX_op_and_i64: + return C_O1_I2(r, r, rNKR); case INDEX_op_or_i64: case INDEX_op_xor_i64: return C_O1_I2(r, r, rK); From patchwork Fri Dec 9 02:05:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632214 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589433pvb; Thu, 8 Dec 2022 18:08:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf75Krs2o7KT+2lUSTpzqzP+7BXLG79LdYIfucrEL2EQqvHMTc4z4RwKLe03VeUeoBnN61Dl X-Received: by 2002:a05:6214:5487:b0:4c7:5d32:a237 with SMTP id lg7-20020a056214548700b004c75d32a237mr5943956qvb.33.1670551726036; Thu, 08 Dec 2022 18:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551726; cv=none; d=google.com; s=arc-20160816; b=Zq2vXvEMHFYTchXv8f5K542NXur50jGtkUZtoMUTwFgiq99jcO3fPU56Smzo2cAVW0 LTlOaxRSznBslsq5LvWMP1MPkaCDU3JKq7YzGEuaBkDi5aXBoOmLuYLH0m6FPHmGg6sD FU3mQobBxKZeAS5G9LqvZC0tfg0nV/fWwNl7Coio+2udZyYlwOze0X1K5T2z+Cqml0C+ /7HfVmzbNy2Ml4yEv9eviRxZ2gCNCMMYzEZ53isCAl3jJY73NPVPmhTYx+4NDycxDtKv AYOf2KnlLFL1eZ5sS8ebHgscw5IFUD8BKskjatsopPJKJvjCqT0C10V0bXZaW9XoT/+k u0qg== 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=r/pLue4GJbxIJm5sMmwSzrcMdvN3fibiketeG7lVYHg=; b=pwCj/WRoJsk5Pf8I6cLuBgFA53aydcpaOjGzVvHVrFUftG44Yd2oOOXR4U9dIKboiS c8+8Pb7+w9XYoUIarUkkZqNc9L/2YXNXTvhGzawTyJyh01pCDuzkLwTgCrNOqLJQKkJa HUMkK/BU263U4cf5HLRzGttUUpPuSLGBpKRJ58aDKmPWjp6MhgLwECn8/tuJNRSqU3yA d1VQ+O1kPHWjC8aiUAhGcv0fGmVTwA9eZm8jSxDBqDl0pRv0v+BWGN7Kp3E6Vc62hIaX wcjseCRp6w+jpJ2vMS+s48ppzQpHAN15sWY3Hej27S0prK9VIt5nGDB/4zlnc4Araxm7 mQQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LczvHU+z; 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 jk10-20020ad45d4a000000b004bde8bb7489si64286qvb.559.2022.12.08.18.08.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:46 -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=LczvHU+z; 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 1p3Sm0-00061q-Vp; Thu, 08 Dec 2022 21:06:01 -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 1p3Slx-00060V-HY for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:57 -0500 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slv-0001vq-JS for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:57 -0500 Received: by mail-oi1-x234.google.com with SMTP id l127so3259989oia.8 for ; Thu, 08 Dec 2022 18:05:55 -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=r/pLue4GJbxIJm5sMmwSzrcMdvN3fibiketeG7lVYHg=; b=LczvHU+zvROps0yYEqNDAaAqRR2oDKwFL3wRNZUdHt2rdVeYyNJn6xqsZuvxsq20M0 UiBTkO9RtyyZ8uaYpSWyQRscK904AxuPReE+OCqSWwRUvKthqZGHIZ52uVnbdZ6AfZOE 5qg7vMxYe/v5hHqo3p2Gccc/WqgHaoDvUeO510ZIoIcsR6PVN1kmOcHnbCuGnXIrm7LH lUoRZLqfxD5lwouB8Jp6pxp58rv6O3gn5ti0nF7bTiVNSbTVVHavxtppqfhaIx3UjiKU j0hU6wtY4Sic3oSv/9IFDj84GkPdZXBTA9OuztlnYE0YFAPL2UeJGvqmITSzJCykFVMP 5b0A== 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=r/pLue4GJbxIJm5sMmwSzrcMdvN3fibiketeG7lVYHg=; b=ABKWy68SrlTGBlFHH2aosD2eE42MnATawLiO8k4yTW3cWtmQQXWKHNZ+NiOKjbm02f 3X1wcJln3U3F4LJYIsqYymp16NO+GeSnW9uzcQm2jgroNs+sDfNUlqz03RO0elbjFlda OmT6fBiyMUm/z4w8OlRlTYNSv6QXiRc8RasbMajtn63VzlDpmAj5L/pXN3u6KyUjLc4C 6w+K4krsi9xWu+/Q6vZXt7R+obze7ABwbHGc9VcKv6rL0Nho6iR47NbGJ9W2b7T0aRVP bkdIZT3dbGrZCuQtkHYZ64pIKIUMx23zkk1AB42e84wWHivkgVrGHq+pfL0nJGaN3xot 8fdQ== X-Gm-Message-State: ANoB5pnnn4xq2Z8ot1Kg/GK1rtiora48a4mw7KfCv5Yy7cIR2yl88l0U 30zNndFV1VX5asPCLrVhQ2hHcrKLfz8WZNFpJzg= X-Received: by 2002:a05:6808:a10:b0:35a:3093:e9e1 with SMTP id n16-20020a0568080a1000b0035a3093e9e1mr1566738oij.3.1670551554853; Thu, 08 Dec 2022 18:05:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 19/27] tcg/s390x: Support MIE3 logical operations Date: Thu, 8 Dec 2022 20:05:22 -0600 Message-Id: <20221209020530.396391-20-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::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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 This is andc, orc, nand, nor, eqv. We can use nor for implementing not. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 3 + tcg/s390x/tcg-target.h | 25 ++++---- tcg/s390x/tcg-target.c.inc | 102 +++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 12 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 0c4d0da8f5..b194ad7f03 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -22,9 +22,12 @@ C_O1_I1(v, vr) C_O1_I2(r, 0, ri) C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) +C_O1_I2(r, r, r) C_O1_I2(r, r, ri) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) +C_O1_I2(r, r, rKR) +C_O1_I2(r, r, rNK) C_O1_I2(r, r, rNKR) C_O1_I2(r, rZ, r) C_O1_I2(v, v, r) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index 03ce11a34a..dabdae1e84 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -64,6 +64,7 @@ typedef enum TCGReg { #define FACILITY_LOAD_ON_COND2 53 #define FACILITY_MISC_INSN_EXT2 58 +#define FACILITY_MISC_INSN_EXT3 61 #define FACILITY_VECTOR 129 #define FACILITY_VECTOR_ENH1 135 @@ -81,13 +82,13 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_ext16u_i32 1 #define TCG_TARGET_HAS_bswap16_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 -#define TCG_TARGET_HAS_not_i32 0 +#define TCG_TARGET_HAS_not_i32 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_neg_i32 1 -#define TCG_TARGET_HAS_andc_i32 0 -#define TCG_TARGET_HAS_orc_i32 0 -#define TCG_TARGET_HAS_eqv_i32 0 -#define TCG_TARGET_HAS_nand_i32 0 -#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_andc_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_orc_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_eqv_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nand_i32 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nor_i32 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_clz_i32 0 #define TCG_TARGET_HAS_ctz_i32 0 #define TCG_TARGET_HAS_ctpop_i32 0 @@ -118,13 +119,13 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_bswap16_i64 1 #define TCG_TARGET_HAS_bswap32_i64 1 #define TCG_TARGET_HAS_bswap64_i64 1 -#define TCG_TARGET_HAS_not_i64 0 +#define TCG_TARGET_HAS_not_i64 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_neg_i64 1 -#define TCG_TARGET_HAS_andc_i64 0 -#define TCG_TARGET_HAS_orc_i64 0 -#define TCG_TARGET_HAS_eqv_i64 0 -#define TCG_TARGET_HAS_nand_i64 0 -#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_andc_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_orc_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_eqv_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nand_i64 HAVE_FACILITY(MISC_INSN_EXT3) +#define TCG_TARGET_HAS_nor_i64 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 0 #define TCG_TARGET_HAS_ctpop_i64 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 21007f94ad..bab2d679c2 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -181,8 +181,18 @@ typedef enum S390Opcode { RRFa_MGRK = 0xb9ec, RRFa_MSRKC = 0xb9fd, RRFa_MSGRKC = 0xb9ed, + RRFa_NCRK = 0xb9f5, + RRFa_NCGRK = 0xb9e5, + RRFa_NNRK = 0xb974, + RRFa_NNGRK = 0xb964, + RRFa_NORK = 0xb976, + RRFa_NOGRK = 0xb966, RRFa_NRK = 0xb9f4, RRFa_NGRK = 0xb9e4, + RRFa_NXRK = 0xb977, + RRFa_NXGRK = 0xb967, + RRFa_OCRK = 0xb975, + RRFa_OCGRK = 0xb965, RRFa_ORK = 0xb9f6, RRFa_OGRK = 0xb9e6, RRFa_SRK = 0xb9f9, @@ -2007,9 +2017,46 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } break; + case INDEX_op_andc_i32: + a0 = args[0], a1 = args[1], a2 = (uint32_t)args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I32, a0, a1); + tgen_andi(s, TCG_TYPE_I32, a0, (uint32_t)~a2); + } else { + tcg_out_insn(s, RRFa, NCRK, a0, a1, a2); + } + break; + case INDEX_op_orc_i32: + a0 = args[0], a1 = args[1], a2 = (uint32_t)args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I32, a0, a1); + tgen_ori(s, a0, (uint32_t)~a2); + } else { + tcg_out_insn(s, RRFa, OCRK, a0, a1, a2); + } + break; + case INDEX_op_eqv_i32: + a0 = args[0], a1 = args[1], a2 = (uint32_t)args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I32, a0, a1); + tcg_out_insn(s, RIL, XILF, a0, ~a2); + } else { + tcg_out_insn(s, RRFa, NXRK, a0, a1, a2); + } + break; + case INDEX_op_nand_i32: + tcg_out_insn(s, RRFa, NNRK, args[0], args[1], args[2]); + break; + case INDEX_op_nor_i32: + tcg_out_insn(s, RRFa, NORK, args[0], args[1], args[2]); + break; + case INDEX_op_neg_i32: tcg_out_insn(s, RR, LCR, args[0], args[1]); break; + case INDEX_op_not_i32: + tcg_out_insn(s, RRFa, NORK, args[0], args[1], args[1]); + break; case INDEX_op_mul_i32: a0 = args[0], a1 = args[1], a2 = (int32_t)args[2]; @@ -2265,9 +2312,46 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } break; + case INDEX_op_andc_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I64, a0, a1); + tgen_andi(s, TCG_TYPE_I64, a0, ~a2); + } else { + tcg_out_insn(s, RRFa, NCGRK, a0, a1, a2); + } + break; + case INDEX_op_orc_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I64, a0, a1); + tgen_ori(s, a0, ~a2); + } else { + tcg_out_insn(s, RRFa, OCGRK, a0, a1, a2); + } + break; + case INDEX_op_eqv_i64: + a0 = args[0], a1 = args[1], a2 = args[2]; + if (const_args[2]) { + tcg_out_mov(s, TCG_TYPE_I64, a0, a1); + tgen_xori(s, a0, ~a2); + } else { + tcg_out_insn(s, RRFa, NXGRK, a0, a1, a2); + } + break; + case INDEX_op_nand_i64: + tcg_out_insn(s, RRFa, NNGRK, args[0], args[1], args[2]); + break; + case INDEX_op_nor_i64: + tcg_out_insn(s, RRFa, NOGRK, args[0], args[1], args[2]); + break; + case INDEX_op_neg_i64: tcg_out_insn(s, RRE, LCGR, args[0], args[1]); break; + case INDEX_op_not_i64: + tcg_out_insn(s, RRFa, NOGRK, args[0], args[1], args[1]); + break; case INDEX_op_bswap64_i64: tcg_out_insn(s, RRE, LRVGR, args[0], args[1]); break; @@ -2945,6 +3029,22 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_xor_i64: return C_O1_I2(r, r, rK); + case INDEX_op_andc_i32: + case INDEX_op_orc_i32: + case INDEX_op_eqv_i32: + return C_O1_I2(r, r, ri); + case INDEX_op_andc_i64: + return C_O1_I2(r, r, rKR); + case INDEX_op_orc_i64: + case INDEX_op_eqv_i64: + return C_O1_I2(r, r, rNK); + + case INDEX_op_nand_i32: + case INDEX_op_nand_i64: + case INDEX_op_nor_i32: + case INDEX_op_nor_i64: + return C_O1_I2(r, r, r); + case INDEX_op_mul_i32: return (HAVE_FACILITY(MISC_INSN_EXT2) ? C_O1_I2(r, r, ri) @@ -2970,6 +3070,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_bswap64_i64: case INDEX_op_neg_i32: case INDEX_op_neg_i64: + case INDEX_op_not_i32: + case INDEX_op_not_i64: case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: case INDEX_op_ext8u_i32: From patchwork Fri Dec 9 02:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632218 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp590726pvb; Thu, 8 Dec 2022 18:12:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zVIb6/NTmvD4w5YmHNoCu0UQmft/XPWM913pHpEVhxB8Qrmz4Ni7Cmy+3rdAlb49u1u2X X-Received: by 2002:ad4:4709:0:b0:4c7:629e:7a70 with SMTP id qb9-20020ad44709000000b004c7629e7a70mr6213217qvb.44.1670551943676; Thu, 08 Dec 2022 18:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551943; cv=none; d=google.com; s=arc-20160816; b=Kar1xPObWVQbdfPt1e82iAoMqnNX2B6q+u2LBFhURXgzwlWJBi11VghgGoWsk9nds5 fESHqA3yz/CIiMwrNn3YpXulZDby5MAjBVMvqojzsfKkBk4SoeshbZvBaTTIANIAo7iC omO7/9KNPvQBh6da5DvCV3Veu4qnvco/YQ2MLbbmfPeJksLX6s8X1ajGoq8LKChDgjOu avXbSC3Cf3PNEkOXMmWQ5tSloIlWW5M7qe7AjEv+v/70K4l05NH0XxueghqzAwOgoHRy JKTng9pGC7r76E2JnkCHRKQNflwYx6FjHDTfCUBIxq/qt+u+YdXuMZibQvtCgxajaEEk uBgg== 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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=AbqjZAaLoBQhSPiJsBQQBG4yWKq/5bIW6lzRm5D8qMXN3uQ9mc0/37ImgeYLC2JGyP NSwty7yXoTkWiNCd/C/ex9Nl3TSeQUQtRd/GyhM0s0WQupPX9c20k6GKJakR5m/hYyNG ggBbAyjVpg1AIZyUmMIUqYIBfsh2+wbma6zFrqSmum7eEITx/+i3XMxNvoKUCeomzcRW +GueNE1F186IhFu85p4iFQfCbLMxp5n88AL17h9INGHp722u3UWkrxFbqlWsEIBrLDmW iYCG1Q3lY7u+VdRZfOj7p5KIvIuZbJConzknHDp00sVxsz30eQBZzDM/49Q5hj5p4WXG KyHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IeikftGK; 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 k27-20020a05620a139b00b006e3fcaa9da4si64880qki.41.2022.12.08.18.12.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:12:23 -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=IeikftGK; 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 1p3Sm7-00063t-A0; Thu, 08 Dec 2022 21:06:07 -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 1p3Sly-00060f-9i for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:58 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slw-0001sD-Lf for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:58 -0500 Received: by mail-oi1-x231.google.com with SMTP id c129so3306889oia.0 for ; Thu, 08 Dec 2022 18:05:56 -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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=IeikftGKxmM+kN5WW2muamkPWmZCrd2qWF5R1W+bymjPgcBXQVQhmKsTdvt5PqfonY JXi+IjuSRUbFS+fiiDkpTEMwqvpIYuAAQVqGhpDtdxAL0uAXpi7jLB+fIRQvSuAVW9Uo fbBsVnboZtaga+s/8f6SxEQDT7oLzPhEr3jnEUvmP7qGnW4/NuaVpwMqODBpcZRHhTfh /GfGQBUh+AfPUsp7z2t0asgxyZ6ChmTU5YgThxm7ONsDH6kXHmL2XIyN9xU0R7iqdB/W l+J6wLreGVWM6h7xjk0vcY7o1Adf7ul2wxhZuKXWw98YP8wHtKZuoH88adqNtKsHnQK4 7dAg== 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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=x38APZ1ZiO11AOOQ4IVP+J7sdbyplTcqs6t8kEFgIW2qvZtZdIKQUZqodo9IcQRFtL XSDTK1yZ6KxGSF6WG0BJ2pOA7Zl0a+3j939T6G5t456hmoxO/uTkgP/OWzccgMrrkxI/ arRfJITXTibwcLI3aw15osn5r3sQ/JlxqJoutYphR8lvMA7nRUrwjtRCzdSufp2UvgeZ tNgnC8zqbI4lxd4Ioggo89jX5pPAVdQ+FnWhJAfaN/G6Hy7viIBTR8y1F2PintHQB1L4 F/v1jJ1FQE8z/7fbiw4UdIaOOAMtK5d1I0xRQ5ODz+92BKe9LWPeFoqLYtY4MqhxfTY3 Hymg== X-Gm-Message-State: ANoB5pkm5pbxxvnUyTH1Dt97jHX6Dx3WAupBzo5+D3bhIwcRJ2BrhIla DO6zmHaztR//+uJjJQPN7KNSEfVwCqPq4gNdsbY= X-Received: by 2002:a05:6808:3009:b0:355:1de9:6546 with SMTP id ay9-20020a056808300900b003551de96546mr2345954oib.40.1670551555966; Thu, 08 Dec 2022 18:05:55 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 20/27] tcg/s390x: Create tgen_cmp2 to simplify movcond Date: Thu, 8 Dec 2022 20:05:23 -0600 Message-Id: <20221209020530.396391-21-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::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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 Return both regular and inverted condition codes from tgen_cmp2. This lets us choose after the fact which comparision we want. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index bab2d679c2..a9e3b4a9b9 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1207,10 +1207,11 @@ static void tgen_xori(TCGContext *s, TCGReg dest, uint64_t val) } } -static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, - TCGArg c2, bool c2const, bool need_carry) +static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, + TCGArg c2, bool c2const, bool need_carry, int *inv_cc) { bool is_unsigned = is_unsigned_cond(c); + TCGCond inv_c = tcg_invert_cond(c); S390Opcode op; if (c2const) { @@ -1221,6 +1222,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, } else { tcg_out_insn(s, RRE, LTGR, r1, r1); } + *inv_cc = tcg_cond_to_ltr_cond[inv_c]; return tcg_cond_to_ltr_cond[c]; } } @@ -1263,9 +1265,17 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, } exit: + *inv_cc = tcg_cond_to_s390_cond[inv_c]; return tcg_cond_to_s390_cond[c]; } +static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, + TCGArg c2, bool c2const, bool need_carry) +{ + int inv_cc; + return tgen_cmp2(s, type, c, r1, c2, c2const, need_carry, &inv_cc); +} + static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, TCGReg dest, TCGReg c1, TCGArg c2, int c2const) { @@ -1348,7 +1358,10 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGReg c1, TCGArg c2, int c2const, TCGArg v3, int v3const) { - int cc = tgen_cmp(s, type, c, c1, c2, c2const, false); + int cc, inv_cc; + + cc = tgen_cmp2(s, type, c, c1, c2, c2const, false, &inv_cc); + if (v3const) { tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); } else { From patchwork Fri Dec 9 02:05:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632210 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589119pvb; Thu, 8 Dec 2022 18:08:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Lnb/Rw8bLHdad2DWv6Mk8E+zj4mxUXgW2De92Bkf5O1IKpTBIV0i8Jjk3t24QOvbfGV+d X-Received: by 2002:a0c:dd84:0:b0:4c7:257:3dab with SMTP id v4-20020a0cdd84000000b004c702573dabmr7196910qvk.38.1670551681977; Thu, 08 Dec 2022 18:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551681; cv=none; d=google.com; s=arc-20160816; b=ZINr2sIpN8NBnfCaV+klp6RR5vIvNTrEdLJKlK6QepaEaQ0HcG2Jx9Skl0Glk0WDiN QmhcZdZeh5uuMWi7PEI60cW+vlVStJXWWRyRCWL5OMbYZEpHYehdy1ikhMeib5/oP3FC BH/hL2yAE/68pgd1QNceoROjMq0IiN1PHpwDrTCCPrER14Bd3S8nijpD6mJ/qjvIovhJ I4Snf2inYmxxWG3PJmDbDuda7mRJpIesEMASzwCbyWpCeyUzwbNsp8BIomDgy8YNuOv1 DYAhp9qjMEue7y9pp/J+vKDzkfQKLYVyYb29bWtwdfUe58bNWCjnLEtzeCd14dUU9eKG DJ4A== 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=Gx7T/PYZU254lwrsHZ56yxEYIpVsjroGfvIVha75a6k=; b=OU8vl3HJRnM5o1OiRP1Db7cRvHHMLJdhVCYX3jTIiADQy3mj2pKb1TfZgfBZfsIjaK mmJENgjXKfiJmTgcblPQQVB7IOXUxN5yPdXlr75fnfgZlitfU1Wo5gnfNuwcXeZfgXZa Q6PZ2hl+t6v3txk30G00B10RoquOitT0fb5aj4yui/oJGH/SHatfn3+9IwO7Cu5qscoV n+NlJuteWc+VHR76BR7xLpab+qtw6KI/e9vh0TG6zWg6uDfWC4LkCaQ4bKZkCcC54krO WI3bhGYsXxulPLO75AWGYRtCGn+KHcyojHZeCBKeACGrE84zK4e5afCk6WLymoqf9fX9 2M/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=atHepb2s; 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 kj27-20020a056214529b00b004c79aae1a74si64230qvb.504.2022.12.08.18.08.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:01 -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=atHepb2s; 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 1p3Sm1-000621-QC; Thu, 08 Dec 2022 21:06:01 -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 1p3Slz-00061g-Tp for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:59 -0500 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sly-0001ym-7d for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:59 -0500 Received: by mail-oi1-x235.google.com with SMTP id c129so3306930oia.0 for ; Thu, 08 Dec 2022 18:05:57 -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=Gx7T/PYZU254lwrsHZ56yxEYIpVsjroGfvIVha75a6k=; b=atHepb2sdz2dv1kFCvduur+6Ht3OG2T33+Bo7R5Qs3j1HR10baLLX/e2gtaMn8/dxo Mq79XgO+yKu6hRjfTyBgSeSB2lEzCxfsZqNHEgtoPVfq6o8rL6o7IpNXiwh4EPgH7Srq cXND6zxpHAS+HzuMQbp3Jh5DV1dKYySaJHNiGfWUw8mWvXjulfPsG7J0usnQ6Ey3ydEo QWIRFP6occNPCzmx/v/k5/M3Z+4y52c1EC0DVb7vnTFfZWnf6TTA5+DaPnMZ+IQA5o/M czHnoSpyn8ye+mSF2LP8hy2zMQtTveaxIe6+bAbb0mlX/657FhAXljj7ZXmzNKT6aAeJ 7Qvw== 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=Gx7T/PYZU254lwrsHZ56yxEYIpVsjroGfvIVha75a6k=; b=T3pb39MXlkJZ9rx/hVHbyMOUBcdJypmApGnaB3ZK8Q3Du7jBVMB3hbdn65iL+QUiDL odlHJwgQifS7lFc1YvooBRUXqQIgvDKoUU7QFNU82uXGLOLgd22FISJaG2urWw/IcpSe e2gOCta/UOP72dzb2vyIaA/v9Zbau8KhwaC5f+/ql9/fuXjfJnZJcyV9H2yu/BqsLHG9 +4H/4mI2Oo13mDIEnBBNpP6/1etm7Nry1tJQafo72tViuAiY/rimbM5u7z/7+b/2wv1h +oVsCc+apKDq+R4xJqd0If5h/fuNEx4miG2k+RmJ3XFxg021ZCux1zlDLqUh0zH6gyNw 7jpw== X-Gm-Message-State: ANoB5pn1SMdV/BpkNVQ+R9hui5yBRa5v4KnxCAS96tpYtzfujHodhKW6 TyWBAimc9Qv7ikDV5NwAh0o7AP1rFqjjqj3fYnY= X-Received: by 2002:aca:dfd6:0:b0:35a:1124:227d with SMTP id w205-20020acadfd6000000b0035a1124227dmr1765777oig.3.1670551557117; Thu, 08 Dec 2022 18:05:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 21/27] tcg/s390x: Generalize movcond implementation Date: Thu, 8 Dec 2022 20:05:24 -0600 Message-Id: <20221209020530.396391-22-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::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.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 Generalize movcond to support pre-computed conditions, and the same set of arguments at all times. This will be assumed by a following patch, which needs to reuse tgen_movcond_int. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 3 +- tcg/s390x/tcg-target.c.inc | 52 ++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index b194ad7f03..8cf8ed4dff 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -33,8 +33,7 @@ C_O1_I2(r, rZ, r) C_O1_I2(v, v, r) 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_O1_I4(r, r, ri, rI, r) C_O2_I2(o, m, 0, r) C_O2_I2(o, m, r, r) C_O2_I3(o, m, 0, 1, r) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index a9e3b4a9b9..30c12052f0 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1354,19 +1354,49 @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, tcg_out_insn(s, RRFc, LOCGR, dest, TCG_TMP0, cc); } +static void tgen_movcond_int(TCGContext *s, TCGType type, TCGReg dest, + TCGArg v3, int v3const, TCGReg v4, + int cc, int inv_cc) +{ + TCGReg src; + + if (v3const) { + if (dest == v4) { + if (HAVE_FACILITY(LOAD_ON_COND2)) { + /* Emit: if (cc) dest = v3. */ + tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); + return; + } + tcg_out_insn(s, RI, LGHI, TCG_TMP0, v3); + src = TCG_TMP0; + } else { + /* LGR+LOCGHI is larger than LGHI+LOCGR. */ + tcg_out_insn(s, RI, LGHI, dest, v3); + cc = inv_cc; + src = v4; + } + } else { + if (dest == v4) { + src = v3; + } else { + tcg_out_mov(s, type, dest, v3); + cc = inv_cc; + src = v4; + } + } + + /* Emit: if (cc) dest = src. */ + tcg_out_insn(s, RRFc, LOCGR, dest, src, cc); +} + static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGReg c1, TCGArg c2, int c2const, - TCGArg v3, int v3const) + TCGArg v3, int v3const, TCGReg v4) { int cc, inv_cc; cc = tgen_cmp2(s, type, c, c1, c2, c2const, false, &inv_cc); - - if (v3const) { - tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); - } else { - tcg_out_insn(s, RRFc, LOCGR, dest, v3, cc); - } + tgen_movcond_int(s, type, dest, v3, v3const, v4, cc, inv_cc); } static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, @@ -2225,7 +2255,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_movcond_i32: tgen_movcond(s, TCG_TYPE_I32, args[5], args[0], args[1], - args[2], const_args[2], args[3], const_args[3]); + args[2], const_args[2], args[3], const_args[3], args[4]); break; case INDEX_op_qemu_ld_i32: @@ -2509,7 +2539,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_movcond_i64: tgen_movcond(s, TCG_TYPE_I64, args[5], args[0], args[1], - args[2], const_args[2], args[3], const_args[3]); + args[2], const_args[2], args[3], const_args[3], args[4]); break; OP_32_64(deposit): @@ -3114,9 +3144,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_movcond_i32: case INDEX_op_movcond_i64: - return (HAVE_FACILITY(LOAD_ON_COND2) - ? C_O1_I4(r, r, ri, rI, 0) - : C_O1_I4(r, r, ri, r, 0)); + return C_O1_I4(r, r, ri, rI, r); case INDEX_op_div2_i32: case INDEX_op_div2_i64: From patchwork Fri Dec 9 02:05:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632207 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp588820pvb; Thu, 8 Dec 2022 18:07:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GqumGMOJBKHDxufcrR7LWBP9zy7tZxQK6oChWBAiJypt3sp3FiJnnPG1UA7ie+5fy9yNu X-Received: by 2002:ac8:490d:0:b0:3a7:e6df:36c2 with SMTP id e13-20020ac8490d000000b003a7e6df36c2mr4382950qtq.56.1670551632205; Thu, 08 Dec 2022 18:07:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551632; cv=none; d=google.com; s=arc-20160816; b=rd8LjkS3iOJacx+VcqaCKZ+qIZxMi7p5HnH+IZZvj6c9QsbChf1552eeM8zomitiDf n4Dt1mKpz57t4UHVMNf/ruTUU+DUvVffAYQcWReEJIr+yXuRHei4De3Ag2ig4cewHi9/ HbRlZ4rXlM7z132r59XUdWqlMAxEpk4GlTw+f9B5bmIUgx0pJtp5LJFzVMmafpHqSDOC 3VFICm5dcyWCsmoTgDoY3u9Xp/wo8lHWr/FFxdkTS7nZukdNa4X4EyKa8z5lP8zfLC94 DrcgGWdDQ69Z5eycpIBQUBD5T5xEoiztBj0JVMB0L+mTeeMW5Pm11HkIT0k2NrzEbAbG CgUw== 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=/xRarcor/wbrlmQ6/1SUQDwNV/2PA1HoUGLA4N0wOFk=; b=ixF4NdmyyiNUh4GxeB1hWkqRMfAkVyy5JepHNLfkOzcA4gZpnx5Jq3yWxSPIMio3Rq COOGYC588JMUOHcsG59NrLE3oOMfscx//0AGyu9qaekAL3QS4EnN+YCQbeQ7cnXH55Vc pG7SZViyDOQYNj+7Rcr1wn0W7/koixm3Qwg4bR8C97i5byVNbHzLuJmLU1HrOV5qIYT+ oAs8jGFIbiLVLva/2+EPNSG7RA5AjW1UnTQhCXddWMpLcN8lT55BzgBgvD85o0/61Hbw O/HezlFT4Crc1IMMXcANw5Wx77FNnf7ArzfwfKqgTTw17N7Usu3fXIm/CkmSSjjluwmE UKDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lxkyvnio; 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 x5-20020ac85385000000b003a58b44591csi28882qtp.132.2022.12.08.18.07.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:07:12 -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=lxkyvnio; 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 1p3Sm8-00064M-Ue; Thu, 08 Dec 2022 21:06:09 -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 1p3Sm2-00062S-8a for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:05 -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 1p3Slz-0001yz-Iv for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:01 -0500 Received: by mail-oi1-x22e.google.com with SMTP id v70so3277544oie.3 for ; Thu, 08 Dec 2022 18:05:59 -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=/xRarcor/wbrlmQ6/1SUQDwNV/2PA1HoUGLA4N0wOFk=; b=lxkyvnioQU5/iwuqGHWagUJT9vWBv/eDRUHk4ZU7ycDBbaldSTWSkGOCwyc6aNCOMo x4+PfnljtkElewLgp+b8TfSIg5QECIt5VG2XGUH4WqUGbfSH83X/NOW6/MADgdV0P846 WnKfNReNPlGpquncdlMnjn15TZyWpmnNZ5yuMP+RFBO97gSwV9v+wUHY8cyc5KfNusjE sb67f4fFPcF2MKAFW0zKd5gCq2GJoMy8CmxgORNxf6uXPtw6b4D6aGQls0c0EdHrJeBF DUt8jH9QbBfiAlwdOiDcCdPVHvwztlEI80ZKHfWElWsk+NO8KIHd1NDjhjJg9AgMTmH3 J5Ig== 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=/xRarcor/wbrlmQ6/1SUQDwNV/2PA1HoUGLA4N0wOFk=; b=hZxTLpBnMD2unSmGB4d8rWovzuoxCHEpN5QmRqOK2VfCyit0CT/e2oi1aMwIaAvl4m 3GQzMraf85VL9i7RvUJclK9/Zqh4tAZjURMEnK0cmYMbtfxQvYGXpXmcZ6DRq4lZvoe4 lDuRwloSum6EiuTe57Ck9sANwGnSd6hNH7V78/svUZSRCBDWITlMqGjGGY5Du0pliMaq /+vD4KDf0x+oI5QQhMvL34PFBMlRex3UCKCOU+fLNO9oLUGyFsafuRw8jEaQ32Hv6+pf UBXBT7q/e88zXVoZGS+TYB56sBsFhhP5o33UXTglbz7DqsU5do+g++Yj1ybzT+peS5iA gQyQ== X-Gm-Message-State: ANoB5pm7eZRfZIa8NWUffWSH5pIVU13sEClscdvy/EELfNzGJroJheve kfCPdG3dfEduaOk2n7BoQ5bOPj65SnEYGnZqmTI= X-Received: by 2002:a05:6808:1b1e:b0:35e:4589:19cf with SMTP id bx30-20020a0568081b1e00b0035e458919cfmr2114298oib.42.1670551558369; Thu, 08 Dec 2022 18:05:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 22/27] tcg/s390x: Support SELGR instruction in movcond Date: Thu, 8 Dec 2022 20:05:25 -0600 Message-Id: <20221209020530.396391-23-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 new select instruction provides two separate register inputs, whereas the old load-on-condition instruction overlaps one of the register inputs with the destination. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 30c12052f0..ab1fb45cc2 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -202,6 +202,8 @@ typedef enum S390Opcode { RRFa_XRK = 0xb9f7, RRFa_XGRK = 0xb9e7, + RRFam_SELGR = 0xb9e3, + RRFc_LOCR = 0xb9f2, RRFc_LOCGR = 0xb9e2, @@ -626,12 +628,20 @@ static void tcg_out_insn_RRE(TCGContext *s, S390Opcode op, tcg_out32(s, (op << 16) | (r1 << 4) | r2); } +/* RRF-a without the m4 field */ static void tcg_out_insn_RRFa(TCGContext *s, S390Opcode op, TCGReg r1, TCGReg r2, TCGReg r3) { tcg_out32(s, (op << 16) | (r3 << 12) | (r1 << 4) | r2); } +/* RRF-a with the m4 field */ +static void tcg_out_insn_RRFam(TCGContext *s, S390Opcode op, + TCGReg r1, TCGReg r2, TCGReg r3, int m4) +{ + tcg_out32(s, (op << 16) | (r3 << 12) | (m4 << 8) | (r1 << 4) | r2); +} + static void tcg_out_insn_RRFc(TCGContext *s, S390Opcode op, TCGReg r1, TCGReg r2, int m3) { @@ -1376,6 +1386,11 @@ static void tgen_movcond_int(TCGContext *s, TCGType type, TCGReg dest, src = v4; } } else { + if (HAVE_FACILITY(MISC_INSN_EXT3)) { + /* Emit: dest = cc ? v3 : v4. */ + tcg_out_insn(s, RRFam, SELGR, dest, v3, v4, cc); + return; + } if (dest == v4) { src = v3; } else { From patchwork Fri Dec 9 02:05:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632212 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589196pvb; Thu, 8 Dec 2022 18:08:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Qu7qLUdwEXz9gd9SYjOoz2Q9SzTTJVCvRzhZSYYM1Q5oYmg9pzJ7oessrEl5/IKCGkQXm X-Received: by 2002:ac8:6988:0:b0:3a5:2644:bcd2 with SMTP id o8-20020ac86988000000b003a52644bcd2mr5100861qtq.8.1670551692282; Thu, 08 Dec 2022 18:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551692; cv=none; d=google.com; s=arc-20160816; b=DnbvM1vKm9abXT5rEDVl1GjEZfsamWZ+7OzrE0mSg8A1ymA1xTD2jDsPi1+tXZwPeV 6d/GA+GtWAnensncDPnfi+H6Hy5a6iRkwDzpzdyT0QCTe6CIxmmResbetCyBOBwOzIoh cKIt9lnk90f1gmGqJFEvFT6VblPBrzhxE6xHUAfaEemNLrdDUElq36vnfx+tzGdrVdtt ldKvGMKrat3wqXRaQzwswmPVnPUkf7jVUvaKpwynTsL2YIGQVdDSsLxCz15YtB1kNT8x 4ggtbaujzhyfcwDPGKr5ceV7Dm2ixMBWUYNPPsVYDNaMizsdW+9qRvV+4B3NGti9CzPB aAFA== 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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=0CVcRWfg6SpLQJ/Vi+pfcyPnBCdorBG+su6V+ZK4DP+GcoSFKrNrer86oZw5kQkHXt K5kWwZA+fpikx9DmqRNQoN64krXPmKFMnM8z4C5AXkQjwlUQQjZbMQPmz1zXNTR/lxBp w9kOv50Kcpno9c65EdNlZRzmp0LZK6uvKjrGcI2PbYekS2A+RhlfrJzA3tCo3I85tw8C FEVfxUvbxWDNKlHfZUqNhY7grTF/KYxuvGYbg9ghW8n3ZnqMP5U8z47wvOKRvjjUdgTZ kuOlVWdsPMv+PCc4/BIARr02ZI4RagRx6OOMN4PGxZ52rrYvqx2I4u4wb0mxlPwY3WWl fDbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LbWX84nc; 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 de38-20020a05620a372600b006ff100d1af4si55702qkb.306.2022.12.08.18.08.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:12 -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=LbWX84nc; 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 1p3SmK-00066B-7s; Thu, 08 Dec 2022 21:06:20 -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 1p3Sm8-000647-JK for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:08 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm0-0001zB-Gq for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:02 -0500 Received: by mail-oi1-x232.google.com with SMTP id h132so3283830oif.2 for ; Thu, 08 Dec 2022 18:06:00 -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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=LbWX84ncUDHd2MaOjUWUgnXe4k+BVgd6DbQwhcmbUBhIYmIoYIVnxv+h9QJ6PvCKyB t2J9DzjgIZ7WdW6e9eKwtZt1A/OulN2PWmHT2M49h7j7sQrqtwpeuPu3MSZHo4fmFvtX CT98MhO/aln4qlXX6YkdpkHPratQaFgKWLK94jITEIKugNW3kF2rg/nL7XcZc6hP4WAY AQlMixl3jhFzIs8UFlz2wVr2+J5s7P+UGCEWd4eOpvvZaQGRcwfFxjML0Fhx83+l8Wi3 mopc2OS3WS1WK5YNimPP0JXe7f9BVa1kwBOnhUO1Q+XtPZD9NaPOPeopeVleaF66vbve NfMA== 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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=DfHVdFnqE6zlBNHD1A7DnW7tT9c0V2QA0fA+9H4RjwCDFQj9egIH3fkD+xx7KUqkEI gaMYFa5hSwFMBzxJRmb4ZULdVfDkmkRAnDWSdNxtu7xVmJkrV7CZPscerB1U+vukVzwT xx6itNEpLEjZ1jpSQladKMA/T7bb4pdDd617RIYsR23rChaZ4VEb4t6f/CKcy38r80oN 7xQnhZ8/uN69lghuTD8gzKmhXqeJG/0vnQWMQ25KDsXkxjd7WJ01F7wtGLJW+3ZPHjOZ fXnwV3rqsQJ0AMY63YrusE7vEtsDDL1wL0rYzOuk/m/UlqQ8AUoAt8Wj+WnjbBgE6zAn +YwA== X-Gm-Message-State: ANoB5pk7kpNCu40FnjBE5Gu84xWAgPDtxIBjbeeIkELvEoBlUIU25psT iY81cOCZIujbZvf7MkTgLNcEZttvTKIng6T4M6A= X-Received: by 2002:a05:6808:98e:b0:35e:5aac:716a with SMTP id a14-20020a056808098e00b0035e5aac716amr23733oic.45.1670551559527; Thu, 08 Dec 2022 18:05:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 23/27] tcg/s390x: Use tgen_movcond_int in tgen_clz Date: Thu, 8 Dec 2022 20:05:26 -0600 Message-Id: <20221209020530.396391-24-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::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 Reuse code from movcond to conditionally copy a2 to dest, based on the condition codes produced by FLOGR. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target.c.inc | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 8cf8ed4dff..baf3bc9037 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -24,6 +24,7 @@ C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, r) C_O1_I2(r, r, ri) +C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) C_O1_I2(r, r, rKR) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index ab1fb45cc2..8254f9f650 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1424,15 +1424,15 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, if (a2const && a2 == 64) { tcg_out_mov(s, TCG_TYPE_I64, dest, TCG_REG_R0); - } else { - if (a2const) { - tcg_out_movi(s, TCG_TYPE_I64, dest, a2); - } else { - tcg_out_mov(s, TCG_TYPE_I64, dest, a2); - } - /* Emit: if (one bit found) dest = r0. */ - tcg_out_insn(s, RRFc, LOCGR, dest, TCG_REG_R0, 2); + return; } + + /* + * Conditions from FLOGR are: + * 2 -> one bit found + * 8 -> no one bit found + */ + tgen_movcond_int(s, TCG_TYPE_I64, dest, a2, a2const, TCG_REG_R0, 8, 2); } static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, @@ -3070,11 +3070,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotl_i64: case INDEX_op_rotr_i32: case INDEX_op_rotr_i64: - case INDEX_op_clz_i64: case INDEX_op_setcond_i32: case INDEX_op_setcond_i64: return C_O1_I2(r, r, ri); + case INDEX_op_clz_i64: + return C_O1_I2(r, r, rI); + case INDEX_op_sub_i32: case INDEX_op_sub_i64: case INDEX_op_and_i32: From patchwork Fri Dec 9 02:05:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632223 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp591580pvb; Thu, 8 Dec 2022 18:15:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf7S8YZ/UjhmFTTImKmv28TxjU7g5zQM3gi0wSRf6ohnqo+d4WSKie4UXSaQT9iZ7sw+r6om X-Received: by 2002:a05:622a:5987:b0:3a7:f7c1:5b65 with SMTP id gb7-20020a05622a598700b003a7f7c15b65mr6269239qtb.40.1670552100102; Thu, 08 Dec 2022 18:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670552100; cv=none; d=google.com; s=arc-20160816; b=hlG66NgETVW3KuKERzXPegjFK8p6FX4mW7dXY8HpeCMlPnbm4C56Vpp2Zt+3Nm5Sk+ MXM/JoiJCeT720C0zmNiDtzppFqtUq+V+XmJG64K6fJLKKbzsQGldgrz4Xl2bewC5UDZ 9ikFIzbDGitVFE5O+enGZH/OxiBzFbhutr0W+ez4DaobXGUlE5S+I0KUBG7HFfMIh8Gi mFHSKH0N0EcLtObUWxjyRJx7/pATsYmAZhmUgaJiF/N8JrHZRd6fs2rVsQk/ypC+lp/u MT3PC457XYrGzrITF9WwdWTBaT0lj20PffL+0SJHg7ookBcwdaehXg+4Z3oFze/Ji3Ci Nzuw== 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=7jUA9/ifCEteEPBnCrvu2FZgUNzc6y0gw3a24gfdjs4=; b=OUJ4namLr6v9XoL/5tZjtsaIRsDlTPNyh1xAqStKjAjyE2iHz2xdtgNaPy6wFoqZJW TY2U81wWG41+wDC2iJmzBH06+9PtVQehXPMTdruKbk6xZuR0MX2rJR5G2q8W9Pm3YRlR qc/U7ZUov1IiWxnZN+VhV9rfKZfx+DWBjp7WHgndrH2DtUC35k2HyTVl66XTcfp6Lbw5 Ajj537qTZMZToOl1ZiN1NPlZcIR7DYSVxkRfmcxUo101wjY3y01cBBbGJczl3hl8bLog gxSM9Dk6I3nerKU9qlCjbjJ09qC/PwwCJTjVvfkpdDKzsK2hVOB6cdWDdZD1LuApu9zH mSHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HxAveCWg; 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 cm17-20020a05622a251100b003a51ba342d4si15213qtb.662.2022.12.08.18.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:15:00 -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=HxAveCWg; 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 1p3SmK-00067h-9V; Thu, 08 Dec 2022 21:06:22 -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 1p3Sm8-000648-Jd for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:08 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm2-0001uN-Bw for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:03 -0500 Received: by mail-ot1-x32b.google.com with SMTP id t19-20020a9d7753000000b0066d77a3d474so1974409otl.10 for ; Thu, 08 Dec 2022 18:06:00 -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=7jUA9/ifCEteEPBnCrvu2FZgUNzc6y0gw3a24gfdjs4=; b=HxAveCWgvQLvuwx7kmTfdN3yu1EjNH74nOXqhBuLg63HFSva9vsVdLlwVv7os42ZQj D/gnwvn/I4HmSkdaCRjNj1sTijskSprI8uVCAfk8+P1ac+Nro4EbZFtxwctXbG/kXCv+ IrbWwFH52y5KuFI/292r0bx7ow62S0xwxlbJN4fUHpbDqXH68yu2Ph+lgTkfefk2uSQr PBDbNt9WH92DLcgbmgpO6tR5Gi85JD+ga6anfsBx0GXmc42+Z6i5/YsgP8xOJDq5g4p/ kueN/GPu7wYipk2GrorhMQ1jstJ8wjovMTTuobi07gP1BPWMGYcOejP41/7FGTp43CSZ q92w== 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=7jUA9/ifCEteEPBnCrvu2FZgUNzc6y0gw3a24gfdjs4=; b=YS/1IBJPrrX+XNONpwBiz4dmiY88onmtFczFyDmnAMCrN+vbyF3yBLbrqSbZcuRKbo 8fcp79m81YAlfIEp5+sNcyVFb9xi4fOUh9qqUOrdziW1D5PlsqZ9wr3d+iaAZvQWzSpe WhWiYdOn1loBQfHa27hLHS2EVoGC57+jnQFSg3SylFeq1Alm52J90eRDZdh2ZlBEJ+jp IQCzbVEgUh25di8wPBDQgpgmmO36OM6uZrMGxs+5Om4iBwZnDbYSd6AJP4ma05Xiz5Sj l5yLqWIHun8/tkC8p/oSOY6NGSUAK/l9Ved7LG7GZBEw+fwDrVfFhJoJ+x97I9hZN6j9 Fxqg== X-Gm-Message-State: ANoB5pnZzk7vF2Xa8qPEWtLLYYRRMZq6V4L8xNXpz2bussbSLU1rLim0 M+f8L5uMa7KlncPjbwO+6dvpld28J6N1XceeZiM= X-Received: by 2002:a05:6830:3809:b0:66e:7670:e684 with SMTP id bh9-20020a056830380900b0066e7670e684mr3294666otb.20.1670551560689; Thu, 08 Dec 2022 18:06:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 24/27] tcg/s390x: Implement ctpop operation Date: Thu, 8 Dec 2022 20:05:27 -0600 Message-Id: <20221209020530.396391-25-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::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.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 There is an older form that produces per-byte results, and a newer form that produces per-register results. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.h | 4 ++-- tcg/s390x/tcg-target.c.inc | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h index dabdae1e84..68dcbc6645 100644 --- a/tcg/s390x/tcg-target.h +++ b/tcg/s390x/tcg-target.h @@ -91,7 +91,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_nor_i32 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_clz_i32 0 #define TCG_TARGET_HAS_ctz_i32 0 -#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_ctpop_i32 1 #define TCG_TARGET_HAS_deposit_i32 1 #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 0 @@ -128,7 +128,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_nor_i64 HAVE_FACILITY(MISC_INSN_EXT3) #define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 0 -#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_ctpop_i64 1 #define TCG_TARGET_HAS_deposit_i64 1 #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 8254f9f650..c0434fa2f8 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -206,6 +206,7 @@ typedef enum S390Opcode { RRFc_LOCR = 0xb9f2, RRFc_LOCGR = 0xb9e2, + RRFc_POPCNT = 0xb9e1, RR_AR = 0x1a, RR_ALR = 0x1e, @@ -1435,6 +1436,32 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, tgen_movcond_int(s, TCG_TYPE_I64, dest, a2, a2const, TCG_REG_R0, 8, 2); } +static void tgen_ctpop(TCGContext *s, TCGType type, TCGReg dest, TCGReg src) +{ + /* With MIE3, and bit 0 of m4 set, we get the complete result. */ + if (HAVE_FACILITY(MISC_INSN_EXT3)) { + if (type == TCG_TYPE_I32) { + tgen_ext32u(s, dest, src); + src = dest; + } + tcg_out_insn(s, RRFc, POPCNT, dest, src, 8); + return; + } + + /* Without MIE3, each byte gets the count of bits for the byte. */ + tcg_out_insn(s, RRFc, POPCNT, dest, src, 0); + + /* Multiply to sum each byte at the top of the word. */ + if (type == TCG_TYPE_I32) { + tcg_out_insn(s, RIL, MSFI, dest, 0x01010101); + tcg_out_sh32(s, RS_SRL, dest, TCG_REG_NONE, 24); + } else { + tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 0x0101010101010101ull); + tcg_out_insn(s, RRE, MSGR, dest, TCG_TMP0); + tcg_out_sh64(s, RSY_SRLG, dest, dest, TCG_REG_NONE, 56); + } +} + static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, int ofs, int len, int z) { @@ -2584,6 +2611,13 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tgen_clz(s, args[0], args[1], args[2], const_args[2]); break; + case INDEX_op_ctpop_i32: + tgen_ctpop(s, TCG_TYPE_I32, args[0], args[1]); + break; + case INDEX_op_ctpop_i64: + tgen_ctpop(s, TCG_TYPE_I64, args[0], args[1]); + break; + case INDEX_op_mb: /* The host memory model is quite strong, we simply need to serialize the instruction stream. */ @@ -3146,6 +3180,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_extu_i32_i64: case INDEX_op_extract_i32: case INDEX_op_extract_i64: + case INDEX_op_ctpop_i32: + case INDEX_op_ctpop_i64: return C_O1_I1(r, r); case INDEX_op_qemu_ld_i32: From patchwork Fri Dec 9 02:05:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632211 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589182pvb; Thu, 8 Dec 2022 18:08:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7dlfahdgomz5vxEZ+r9u9wgMMflhthw8fk7QDhYdr7qu88NZ78gNLNvIIf+NZainR4Uhp2 X-Received: by 2002:ac8:5756:0:b0:3a6:8700:b471 with SMTP id 22-20020ac85756000000b003a68700b471mr8188771qtx.38.1670551690984; Thu, 08 Dec 2022 18:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551690; cv=none; d=google.com; s=arc-20160816; b=qXc6iooK/AwOD9igrrnRuZNN304801wBGBHu6JwU7YG3I9h/SU2UQgzSjoPb0KRHm1 FvYjVCXbLQfrhbhiy2dTZ68pCbTsNWrps7cwfT+dLYF9x4T2sgu+bozk5ht943YXt8sP LtyIKH2Id9qsOe/k9Awev4Lzks71tYqScZwZ2oE98OhDj6BehL3f8xywuslkwEN/fvTT zy8ZD2S6ZQd4Ekv7hQzBEtjMRFuqhHKpd7z+2HeoB9WwIjEoUvWNDNal9pabc+bGutsL bkBqPlHsnTLUPnWPPgnASVz5b+oZiiWRpLeZRyFqnJhccX4UAzuNzDYAB5GTz3N57LVu LIQQ== 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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=TDsJ9+UAbgpG8/LyqAX1OORX/v41ShSbSLYIm/Hj8nKRuBfqZ1TV+z48jrvyg8gc3g b4u4j5083M+ZY6wD8MrYimdzTV0BZXS95V9swWaGoO0G/+8anOy00Bdd/JJ+JxnX3Zi3 gQindmCqZpBm2aCdu5FIokjlu68o+Xs3LCINpWj9p9o2/0UwS0Wjk8lqIc+mNjQugaeZ JhNp9b1X81FoDTbfdSkPX0qh7RTi6n4Gtla5yOX1K6amtS8Xg2g6v+Ke3mJaafDP32He hf2pelMnjAcPIslp+IUdZsDGEEnkis9mJxebfJMV+FEw/9QkB6ksqfAodcemlEC4OHH5 Cosw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FZf4cd5A; 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 h10-20020ac8714a000000b003a689460852si18052qtp.449.2022.12.08.18.08.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:10 -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=FZf4cd5A; 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 1p3Smf-0006RR-Rv; Thu, 08 Dec 2022 21:06:44 -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 1p3SmA-00065E-94 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:10 -0500 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm7-0001zY-6M for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:09 -0500 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-144bd860fdbso4108835fac.0 for ; Thu, 08 Dec 2022 18:06:02 -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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=FZf4cd5A7Ju3h1L1d5KZ+Mial6RHkWgdF/7ffcRASU5oWvRGYRLgRkX22v9uXSJj3u ujIb0pCbFrIi3WOpeQXAmJvdUmlzG3CVHljVR5RUvyZZYZslmxFPJ9hxQQU+MAIR8Wi4 JJPPk+Pr2+JjQGVaI7R+wQx9dV0e7z06+ThDN4k/pooyLX+bOCSyjJGm1s8ipHy4UMdU CsrvItBnxWK/AYSaPIEjhMtZ0EZ4qA4pCfO5ZoENi3rSeSkl9DI4dv12nL3PxEHR5MjN pFNmOVL8Qkdzp6bbLOgUOe/6/d/kMgPHGffuFYUDo/Tya/iDlWrUKcb4CZPTG4uxxnMr gY/Q== 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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=ttnw+T/XryvJWIp+lSmeTl2ihb3jO4X6vizQSenXdX70CNft9IeBKnAlwFMJ92vUef XzL/Ov0oy4Y53IrlvVlxRdeLAJfLfOr0xa29+0qSBItLCwuEKBYEXgcY3qqH8+NMdOwQ EH617u8BEFnTXQODvT0AL/J5AhOqO4hiy0BWYMBgZB2XVf8TrE2KMsN8Y57uXpYjBehS yXmCXDQin4qxZdLFcdo0FzJ65WleGFqKV5KqVdyFe+iKwYlG5pNYR8HIPtpCUKHWi/xt jqLqGqy+L1eOopRfCyEH1ZhekpGVadb03s+QhJQAgSsjgj9037E7Kjkeh1winzhp6Uw9 Ui+w== X-Gm-Message-State: ANoB5pmXOSDnwlSLBCu9+U1rLc+BW2y9oJhtbVfsW/f0j847dll6+E+E J5Jqok6p2brFWmbtDg0cW8m6riKGGx6Oggb8M4g= X-Received: by 2002:a05:6870:3c13:b0:144:ebb9:9ea with SMTP id gk19-20020a0568703c1300b00144ebb909eamr1811846oab.48.1670551561868; Thu, 08 Dec 2022 18:06:01 -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.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 25/27] tcg/s390x: Tighten constraints for 64-bit compare Date: Thu, 8 Dec 2022 20:05:28 -0600 Message-Id: <20221209020530.396391-26-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=2001:4860:4864:20::2f; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2f.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 Give 64-bit comparison second operand a signed 33-bit immediate. This is the smallest superset of uint32_t and int32_t, as used by CLGFI and CGFI respectively. The rest of the 33-bit space can be loaded into TCG_TMP0. Drop use of the constant pool. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target-con-set.h | 3 +++ tcg/s390x/tcg-target.c.inc | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index baf3bc9037..15f1c55103 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -13,6 +13,7 @@ C_O0_I1(r) C_O0_I2(L, L) C_O0_I2(r, r) C_O0_I2(r, ri) +C_O0_I2(r, rA) C_O0_I2(v, r) C_O1_I1(r, L) C_O1_I1(r, r) @@ -24,6 +25,7 @@ C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, r) C_O1_I2(r, r, ri) +C_O1_I2(r, r, rA) C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) @@ -35,6 +37,7 @@ C_O1_I2(v, v, r) C_O1_I2(v, v, v) C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, rI, r) +C_O1_I4(r, r, rA, rI, r) C_O2_I2(o, m, 0, r) C_O2_I2(o, m, r, r) C_O2_I3(o, m, 0, 1, r) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index c0434fa2f8..4d113139e5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1249,22 +1249,20 @@ static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, tcg_out_insn_RIL(s, op, r1, c2); goto exit; } + + /* + * Constraints are for a signed 33-bit operand, which is a + * convenient superset of this signed/unsigned test. + */ if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); tcg_out_insn_RIL(s, op, r1, c2); goto exit; } - /* Use the constant pool, but not for small constants. */ - if (maybe_out_small_movi(s, type, TCG_TMP0, c2)) { - c2 = TCG_TMP0; - /* fall through to reg-reg */ - } else { - op = (is_unsigned ? RIL_CLGRL : RIL_CGRL); - tcg_out_insn_RIL(s, op, r1, 0); - new_pool_label(s, c2, R_390_PC32DBL, s->code_ptr - 2, 2); - goto exit; - } + /* Load everything else into a register. */ + tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, c2); + c2 = TCG_TMP0; } if (type == TCG_TYPE_I32) { @@ -3105,8 +3103,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotr_i32: case INDEX_op_rotr_i64: case INDEX_op_setcond_i32: - case INDEX_op_setcond_i64: return C_O1_I2(r, r, ri); + case INDEX_op_setcond_i64: + return C_O1_I2(r, r, rA); case INDEX_op_clz_i64: return C_O1_I2(r, r, rI); @@ -3154,8 +3153,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, r, ri); case INDEX_op_brcond_i32: - case INDEX_op_brcond_i64: return C_O0_I2(r, ri); + case INDEX_op_brcond_i64: + return C_O0_I2(r, rA); case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: @@ -3196,8 +3196,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, rZ, r); case INDEX_op_movcond_i32: - case INDEX_op_movcond_i64: return C_O1_I4(r, r, ri, rI, r); + case INDEX_op_movcond_i64: + return C_O1_I4(r, r, rA, rI, r); case INDEX_op_div2_i32: case INDEX_op_div2_i64: From patchwork Fri Dec 9 02:05:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632215 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589542pvb; Thu, 8 Dec 2022 18:09:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BVXHdSfQfSxOJ5cCrmZ0/xvEE8UEewLYw/uKVyEUbC26dTJw8VhNev6aQSkatWJzkBJon X-Received: by 2002:a05:6214:5149:b0:4c7:7878:1f31 with SMTP id kh9-20020a056214514900b004c778781f31mr5584588qvb.51.1670551741579; Thu, 08 Dec 2022 18:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551741; cv=none; d=google.com; s=arc-20160816; b=uwOgnWt8VBp0dXIVTV5kpEKXg8qMsmRSm/Iqg5ri/DEN57gOmGUGcWrecQqRVc1VDX BprtsZKRxQOmzoODcC3KGMTqg1NjguCqkUXxHuQ6pp7qlfopwhCCkQ4Jdf/37MsLIWR2 mg5Vkibz6GLlgk6c0r8+BsH/2zWICZ3ssPifj7xVvC8aA2LnIvm6Gw7rzNGXjO8afgVw rhQLfjfTTaBxIP5YmB3kGEtq5jhmsAidJ7cUkEuXkOAofzoopbT5Tf1FWNxk/ZdlDCPM ZgXkKsqR8OVu5ZRbVuP0icssIb90rAqB+cAb58/bbiFxciLmDFpC7CpD2HmMY2NnkzUc 18UQ== 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=21p9NPEj/nCmkIem3oytkyW4EvI66hYE8FrtmQQPev4=; b=p2GWIQ4y9cnwCF4Ps1fGvTBDHUq1lQqyOjjtR/RsCzhXzgqXjxcOry2DhISHaa+gfA RJHizd6Uic0uyL8VwTGtyxSxpZJ0PSjwBkANSIMvxbg4VmiZasNGID12OLBiCdN8hwc2 YW/4L4gKfCtbzjDmWlyFbE9qd8yqF6RDhSsp/JSWC5u/O9PaKpK9pLOhbHjIVqicDzNM utST353rK3tQv+KW3omQDMh2ZVAkFIj1AXh78xVP3wqkthPRctaZwp01/aK1AhsHD/EZ V4Sa22oIEI0djv0KtMqPWcmDMBUYj2nmnYBXXfaaF5fI6Gd/col1D14zYapWxOL9rVE7 6ftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vl4lxRPD; 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 d67-20020ae9ef46000000b006fda6cdf527si58228qkg.236.2022.12.08.18.09.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:09:01 -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=vl4lxRPD; 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 1p3Smk-0006So-RR; Thu, 08 Dec 2022 21:06:46 -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 1p3SmB-00067j-FC for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:20 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm7-0001xU-CB for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:11 -0500 Received: by mail-ot1-x32c.google.com with SMTP id p24-20020a0568301d5800b0066e6dc09be5so1982183oth.8 for ; Thu, 08 Dec 2022 18:06:03 -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=21p9NPEj/nCmkIem3oytkyW4EvI66hYE8FrtmQQPev4=; b=vl4lxRPDVxcZNhuMmwrorD+eXKw9mgdpiSMGExHtOyAoEIhmzudaCiQMp4TUlTp/99 Kfc5QTntw/IYl1i0mxAlnbyurFJ+zUh8Fg4V65YUMYWVwQJrTYYxq96TmSvRCxEvSLE0 jo7U+9tsxvSY8GHdImGW6u4q0GdRkFQgcOAznBL/0+w5M76RalPmAXPEl01gkKGKp0ao h72mQvtMOSNrFheAAjfa+f+q6oHpoqUBagVTcyFjrl1U80spVSqRNlZRu5sEaraQOwN9 gnVOl/k+tFNCPRMEIO+VGMEy+rXtvQG9FBfZuP1sCDiEnNbchxHAZEPlF0UPOA+J7D5d 3bWQ== 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=21p9NPEj/nCmkIem3oytkyW4EvI66hYE8FrtmQQPev4=; b=WfUFcEkfm8iKJJrWl1ZlQzfmmjDy/82uVwaavB5sD/3rfDtdDRxGIMf/GB+YgdEZBJ BIQGCfcHJAgbk3Tk5EFEpJTL9wYsh5l43IB4YGbdYGgbRSEgYe6UIScljXxNQS2zeobf oM/b0T/PYD7cjqoQk3dpUmUGEVYwSuY5aN6J92xSnYy4+qy6xIiAG63cKF8g1oH2cidp BpEPDjghBvfdMbu5lVx9c+9/i3bVAtLsQ/N03B+vWF+VHekQzRnfbPDJmNN6Q8OobhdE WWK/ZIfUAH7rRReXxLEhO5wuX9w2w/WkikyHcjo3tR/JVrmLFmHkb8lcTW0f2IHIQZfm EPzg== X-Gm-Message-State: ANoB5pkjov3FQjtxp4T/Td5jPCkEt02zbM0dwCsa/liZ/EN+igBXAmuy zwVSPmnGyJnEMIMqItS5/o+6b6NzrH0Ve6b5qkk= X-Received: by 2002:a05:6830:1517:b0:670:69ac:bb49 with SMTP id k23-20020a056830151700b0067069acbb49mr1952676otp.15.1670551563011; Thu, 08 Dec 2022 18:06:03 -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.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 26/27] tcg/s390x: Cleanup tcg_out_movi Date: Thu, 8 Dec 2022 20:05:29 -0600 Message-Id: <20221209020530.396391-27-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::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 Merge maybe_out_small_movi, as it no longer has additional users. Use is_const_p{16,32}. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 52 ++++++++++++-------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 4d113139e5..b72c43e4aa 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -874,14 +874,19 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src) return true; } -static const S390Opcode lli_insns[4] = { +static const S390Opcode li_insns[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; +static const S390Opcode lif_insns[2] = { + RIL_LLILF, RIL_LLIHF, +}; -static bool maybe_out_small_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long sval) +/* load a register with an immediate value */ +static void tcg_out_movi(TCGContext *s, TCGType type, + TCGReg ret, tcg_target_long sval) { tcg_target_ulong uval = sval; + ptrdiff_t pc_off; int i; if (type == TCG_TYPE_I32) { @@ -892,36 +897,13 @@ static bool maybe_out_small_movi(TCGContext *s, TCGType type, /* Try all 32-bit insns that can load it in one go. */ if (sval >= -0x8000 && sval < 0x8000) { tcg_out_insn(s, RI, LGHI, ret, sval); - return true; - } - - for (i = 0; i < 4; i++) { - tcg_target_long mask = 0xffffull << i * 16; - if ((uval & mask) == uval) { - tcg_out_insn_RI(s, lli_insns[i], ret, uval >> i * 16); - return true; - } - } - - return false; -} - -/* load a register with an immediate value */ -static void tcg_out_movi(TCGContext *s, TCGType type, - TCGReg ret, tcg_target_long sval) -{ - tcg_target_ulong uval; - ptrdiff_t pc_off; - - /* Try all 32-bit insns that can load it in one go. */ - if (maybe_out_small_movi(s, type, ret, sval)) { return; } - uval = sval; - if (type == TCG_TYPE_I32) { - uval = (uint32_t)sval; - sval = (int32_t)sval; + i = is_const_p16(uval); + if (i >= 0) { + tcg_out_insn_RI(s, li_insns[i], ret, uval >> (i * 16)); + return; } /* Try all 48-bit insns that can load it in one go. */ @@ -929,12 +911,10 @@ static void tcg_out_movi(TCGContext *s, TCGType type, tcg_out_insn(s, RIL, LGFI, ret, sval); return; } - if (uval <= 0xffffffff) { - tcg_out_insn(s, RIL, LLILF, ret, uval); - return; - } - if ((uval & 0xffffffff) == 0) { - tcg_out_insn(s, RIL, LLIHF, ret, uval >> 32); + + i = is_const_p32(uval); + if (i >= 0) { + tcg_out_insn_RIL(s, lif_insns[i], ret, uval >> (i * 32)); return; } From patchwork Fri Dec 9 02:05:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632219 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp590784pvb; Thu, 8 Dec 2022 18:12:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf65K4LVSBkgtOuInP04JWpGNXB86uMkhgU/vuyslWdXaD94HwpcHabiAbpd4uBrSdLiKvmu X-Received: by 2002:a05:622a:18a1:b0:3a7:f669:4599 with SMTP id v33-20020a05622a18a100b003a7f6694599mr9253167qtc.62.1670551956391; Thu, 08 Dec 2022 18:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551956; cv=none; d=google.com; s=arc-20160816; b=X1EqWtnTyU/cN2AwUqVRjGHF3ag6PP4DMOUXxNpt+sWZ6yvbc5ipewhRIW1JVzP96E fonRHN/ED5G5lIcoMtyavuLTRNdji1hWz/W4LMainkDMeqlE+ua+1fXSU5TZhBSTabeS Bl/zOusymH7JkpSpkesTkRP19e9LhnU/CBaIX7k/0Kq4F5AJ3Mqmb04kdszhbrSQSAOH PZ14MtkyniOY7WpxyMw4LgNcb9tc6/Fh93vgQMRsF8fGkKByjXHfm8KUiK+0OLQi0nLb 1N0GdLdYt+yG9HByR/1DtuZroS3Nl084SLoGoGLvOp1VFKSo2lce+iPmbhfsHGcaqqg5 spkA== 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=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=bOB+JD+bNHW7dpa/Mrs7PQdwg2VMxjXbAOVmgPj2aXplHSzCXGhHP5kH0nFT8zhNGZ htap/8A+8/0ZLaIgLh7viIZJwQ4lJeUCpDGwTADJcVKcQ+2tgOIaIpl5td5BCG7VJ+8Y 53+OOgcvzXn1kb2K+gI2TJqeZz5nq81Wwy3n8/MPqcdzuV/e9FFPaqNt7JlU8UE22ziC JsNzIv0bXePEzM1j7/GRVt4li+pbDS97PyYWq0MmYVwVGrx0ZDJcN9xQCUg2IIZciIgy CbLNdXKBIubH54MC8AzxiLx/f4fqUzDEHFLefbpTP52bMWmlZXbkeRpmUK7o0FraYoei SSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJ5YvJqG; 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 l13-20020ac84a8d000000b0039a2d64c513si25734qtq.337.2022.12.08.18.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:12:36 -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=HJ5YvJqG; 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 1p3Smj-0006Rz-6Q; Thu, 08 Dec 2022 21:06:45 -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 1p3SmC-00068X-VN for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:20 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm8-0001zm-CP for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:12 -0500 Received: by mail-ot1-x333.google.com with SMTP id q18-20020a056830441200b006704633f258so2011840otv.0 for ; Thu, 08 Dec 2022 18:06:04 -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=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=HJ5YvJqGLjFLD/6ZGyQihLm/5qvBw6odv+8g6Z8xs2qngJpoqlE26rHN9pf3cKWTxD fINCCXlxZi4CpugIrng4Yyl/osWAH3ToL0zh4lfB8h98fF5/VRDf0a5Z5k7X2SiJHexx WVQRzQpBjU7sf2XUf3ykeEEdZbRHPYqsKh46RvT/Ydogre+sE1gR0+5zsVchHCJTElBo CQGLSSb1BVYVsA5ZhoLryDGGUkz72Qcbl5T+M6DHUF/GqDsoIvIP+5hkmSqzyW2FhjAa 8ILs3yoaMwygnbwW6DeUgxzvBcUVgnuBKv93Pz0fqMCGr8yFyQePIMD0YY4Hu4gFvL2F 3oew== 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=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=SBrXQEO7Cf9EWSdlq3lPKlavPcAM2bMUQpyDNYSsutHZXDEcGOlCZpEFsFpfz7X98q +/x3dAR+dIs3fJKmRkLad8PORWj7zSp7Cm1oo+50IbPAfZNKj9aBG7YG+yVC6ewlNQuw p6nhHYAQYhswjjftsrRjejeNMA7GFLOtj62pZjQZZS848XzhGrlbsAOksSnyMdhCkHix ZhQGAHOY8qx+DOgccAa8Kleizzo4JoFKgorQT4QTV9tmJlVkU5Q48r5f+coQ+5JFYmqZ M+nkE5Mq7xmZp9eJR0g8kD//eXwy63wpsxO0v3L2S3bhZmb8mS1N47gCOogNzQ/uCzbQ mPRQ== X-Gm-Message-State: ANoB5pnGDcstvD+I4OmoHLLviB1yqNG1kAF4oyYiqW1vdt0RrSoxMWlz L5I1BEB5N9AnI1wbkN9GPpAdTP4VXQfW0S063kQ= X-Received: by 2002:a9d:1987:0:b0:661:dfeb:ee91 with SMTP id k7-20020a9d1987000000b00661dfebee91mr2128811otk.11.1670551564122; Thu, 08 Dec 2022 18:06:04 -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.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 27/27] tcg/s390x: Avoid the constant pool in tcg_out_movi Date: Thu, 8 Dec 2022 20:05:30 -0600 Message-Id: <20221209020530.396391-28-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::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 Load constants in no more than two insns, which turns out to be faster than using the constant pool. Suggested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index b72c43e4aa..2b38fd991d 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -877,6 +877,9 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src) static const S390Opcode li_insns[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; +static const S390Opcode oi_insns[4] = { + RI_OILL, RI_OILH, RI_OIHL, RI_OIHH +}; static const S390Opcode lif_insns[2] = { RIL_LLILF, RIL_LLIHF, }; @@ -928,9 +931,20 @@ static void tcg_out_movi(TCGContext *s, TCGType type, return; } - /* Otherwise, stuff it in the constant pool. */ - tcg_out_insn(s, RIL, LGRL, ret, 0); - new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); + /* Otherwise, load it by parts. */ + i = is_const_p16((uint32_t)uval); + if (i >= 0) { + tcg_out_insn_RI(s, li_insns[i], ret, uval >> (i * 16)); + } else { + tcg_out_insn(s, RIL, LLILF, ret, uval); + } + uval >>= 32; + i = is_const_p16(uval); + if (i >= 0) { + tcg_out_insn_RI(s, oi_insns[i + 2], ret, uval >> (i * 16)); + } else { + tcg_out_insn(s, RIL, OIHF, ret, uval); + } } /* Emit a load/store type instruction. Inputs are: @@ -1160,9 +1174,6 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) static void tgen_ori(TCGContext *s, TCGReg dest, uint64_t val) { - static const S390Opcode oi_insns[4] = { - RI_OILL, RI_OILH, RI_OIHL, RI_OIHH - }; static const S390Opcode oif_insns[2] = { RIL_OILF, RIL_OIHF };