From patchwork Mon Oct 23 18:12:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737263 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1663961wrl; Mon, 23 Oct 2023 11:14:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1z73lMqxS0KGJiuJNLmOVnrAZ7mCm/pMqB6RhrXS6x4K+cAz4Kauoxdh9h8SfPFaMeW13 X-Received: by 2002:ac8:5bd1:0:b0:419:9463:529d with SMTP id b17-20020ac85bd1000000b004199463529dmr13641771qtb.1.1698084848703; Mon, 23 Oct 2023 11:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084848; cv=none; d=google.com; s=arc-20160816; b=0h/BAUWrre1c8ZQpYHLGwSUWdcLb97nyp2bkHXBDiPGzmL50AIt3GXNqsHxEhdZT/2 lus0j3v1pU3IXzlli+0yhrjrvLXwyvTvWgfwDMVsXT7PqdH8CWIJgnlzdB6SdZrc2qok 0y+e1zX5dDhtA/3c2bGNFd8+avYBo03wB5tAck6vouaxiDwGQJIrQIiVxTwct5ablVa9 TkUNbq7+C2SR7cZSkhJ85eCdTCFSnf52rvxLhP6VBjiigA+8wK9ojqHyOU5nUinAXqjD Juuld0JKSBcIkAB814ZThkQuM17ExiMfTfo1MeCPbBhq5bIIZhIcH4QnenU5c43RqVnb iT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=L5Wa+u2Y/Ud1p0qsqt8NWsmY+YDNoNxkXsQOQ1XNAzcGjEjjsgDIscvr7kh0HQffmj Ym/UwiQzQUA3OmQIccBuxRM5SPUVrnNH2yrB0ux0Y6/OgCViShsCNwDp/d60hLUN5ApU cBdiQxl9R08ES83KlW9ZLkD7dVKQJjz6eUUhMj1WHMphxjAz2tK235aWD3wJbBNQIwQz 1Nbi1/5METq8ptdvj1BAdg7Cya3EK+Nz02LIkn8D1aE5xh/Pf2E8c8VU+h4kblGJQvNC 2WbsqVbB5lvO90fqmGf+5scIQ+g6PJ+G1RRzoTgwXKuDOYqZVaPw3lPo4pFbuF6+e9Of MaKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7A1RbUM; 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 m20-20020a05622a055400b0041cbb5e5291si6174167qtx.731.2023.10.23.11.14.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7A1RbUM; 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 1quzQt-0005UO-Bb; Mon, 23 Oct 2023 14:13:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQq-0005Tb-5v for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:40 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQk-00084r-ML for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:39 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5842c251d7cso1760725eaf.1 for ; Mon, 23 Oct 2023 11:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084812; x=1698689612; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; b=F7A1RbUMV/uPK4zcLlGQw9iEv54WZHHHMcmPA6G2ov8QZT3gjsqT67b/NNhmL/BArp 0vPFdWMddjr0Oyh/nz2J+e9S/G7z6qAEiX94hm9RXrHLztlyPYOBcysp2s3zuTwDPFKo Abhom6Ew3dANGzjSIOy6R1fVqcdj+P8S8malI6n0dExmouYHcnCo0foNEmCFrWGAviq+ mq0+8mqp58w/L/wnfBa7s4MV3MOfPMJbbRaaRQLoKt9CQZeoT939VfazyNt82/Fjg5Rh 8vpWinWXDSkvPrBaNw0hYb0LOstPuqFns2jk5yINvKkGyt4ulqck1CYGQKRY9RAcX8JP JB8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084812; x=1698689612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AA7L0NLzkIrOUcDjlwriga27ooiuuZ7zo9pLt3rHark=; b=I+NcaAsizoZWOL9yExLyInFKFyDNo3M/E45W1ODLfLiVVOW/R6S+1WBcdPE7S8ZrS8 L2O4WJrK949Z7jH1RSP5ryOGpDr4ph8bKnEMZFir5Pv/VNjjgAJjEysTkvS5vwLuiJS1 jtdEqtHrx1d5DkkbF3oa+yfWUqFXw2T4ftoZCspbDVC8KS71uKPDSgRoXs40OHwwZhSP lpBWIqA/kH/3BgUgIqouAHHubDdCTBmT2nzzq/26FgfvE2EI6QIvXIZbxiG0ISmhOncJ nEBMgd2s54y9BX4mBHbwVbWGwARDdtd8E/moF6oH5sqaqo+R2ym+PztGhtOhshU9wHPB drXw== X-Gm-Message-State: AOJu0Yzg6TvspiiDu1BtHROtvLzg2yiBwY6O6Pb1ORmjeBLepnsFDB7R PJJnVSu/nCsSs6rOHwc07O56fYCKrl5An0E/ft4= X-Received: by 2002:a05:6358:15c6:b0:168:e1d3:adf2 with SMTP id t6-20020a05635815c600b00168e1d3adf2mr3127812rwh.2.1698084812243; Mon, 23 Oct 2023 11:13:32 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 01/38] tcg/ppc: Untabify tcg-target.c.inc Date: Mon, 23 Oct 2023 11:12:52 -0700 Message-Id: <20231023181329.171490-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c36; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc36.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 Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 5c873b2161..5cecc6ed95 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -221,7 +221,7 @@ static inline bool in_range_b(tcg_target_long target) } static uint32_t reloc_pc24_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp = tcg_ptr_byte_diff(target, pc); tcg_debug_assert(in_range_b(disp)); @@ -241,7 +241,7 @@ static bool reloc_pc24(tcg_insn_unit *src_rw, const tcg_insn_unit *target) } static uint16_t reloc_pc14_val(const tcg_insn_unit *pc, - const tcg_insn_unit *target) + const tcg_insn_unit *target) { ptrdiff_t disp = tcg_ptr_byte_diff(target, pc); tcg_debug_assert(disp == (int16_t) disp); @@ -3645,7 +3645,7 @@ static void expand_vec_mul(TCGType type, unsigned vece, TCGv_vec v0, tcgv_vec_arg(t1), tcgv_vec_arg(t2)); vec_gen_3(INDEX_op_ppc_pkum_vec, type, vece, tcgv_vec_arg(v0), tcgv_vec_arg(v0), tcgv_vec_arg(t1)); - break; + break; case MO_32: tcg_debug_assert(!have_isa_2_07); From patchwork Mon Oct 23 18:12:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737300 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665993wrl; Mon, 23 Oct 2023 11:18:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcBFQQBaLl4zs+a0TeL1Ee8sTGm5oNfWraKB7ODL9tJjR72E3fFNqe8FSvSeotnmXJS4wM X-Received: by 2002:a05:6214:2a8b:b0:656:2ac8:d89a with SMTP id jr11-20020a0562142a8b00b006562ac8d89amr13043326qvb.22.1698085127221; Mon, 23 Oct 2023 11:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085127; cv=none; d=google.com; s=arc-20160816; b=wYv4KPstEDFcGvTu3gn1I7GWZRLyz9rL3Jddv2S+ladZ89YedddaqKs4ie0NPfOFQ6 SyIljD8pMZu+h9XehawamI4i1jmCF4RAq6SQF1DyNbrkdCr3G/rb+0PZScXPqYQgZDyb KTE8RucGbXFV+WVhIrvkrzB803w/sEqaQoQp8GYZI0GhXJcPJaeJlM6emJXjZ0bHs0jv EvHQvEci/Y2IhUESKgrp1sl0IyU99j7ZfFjOyRbKj/YllqF08MZyrPJgSMk6LB4zywm0 jAC37AK0sGS9OgXKsU2l2YPNChAANATQCRsopd5LJXtP0hzVXkDpPvqf6YvFuw8AG7w1 Psbg== 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=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; fh=o1FzCaEAYG4VwCHNWCaZIuDmCIpwE3zCfwcgLY4wMqw=; b=c8ZEIzXBy5TeFDCMtLrAGdI8snc5K7xk2WphnHF3Vd/Ksy8XUJ/sks5psF/h1dC7iA hKIaX+94gK1+DnJEDCf0qyagyERkjsakEgWquRdY0wjXQHH1+TQWRSkigL8e7rRfE4fl 292DcPQgNNGla9DCUbdFcDfGEP4XfnZzwt6nw/eI3OjMSzmnFl21wF11TAFFk8VMNJ2z QmD/G7u4oSxeUUFAkbszqcIzQTVyQuYgDVmILAzhBXsD7OL8jzpAwJnnU7CinckYClYW OXZhjcwioRN8Z38/jkZTIO2/bpBgYD3EwtrZzu51AVp2W6rovPIKqWX3osNxbu9y3ZRk JlZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHaPp5Sc; 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 12-20020a0562140d6c00b0066d1215446esi6253473qvs.218.2023.10.23.11.18.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHaPp5Sc; 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 1quzQv-0005VT-5P; Mon, 23 Oct 2023 14:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQq-0005Ti-DI for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:40 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQk-000854-KF for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:40 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5a1d89ff4b9so1869125a12.0 for ; Mon, 23 Oct 2023 11:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084813; x=1698689613; darn=nongnu.org; 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=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; b=mHaPp5Sc8KUo2G09Y6mouormtju1BZf6HjGq1pX+3BL2AV6k8dtaHDML4wQcfOewfj OfDfJ0kfsLKf2Q9+lBUoHmp4VxirE7ejZD89pvsUMcCNjReeGaViaYYa/D6KmaKiFbUQ 658RNPCqQlMyQfstnJY+JPTXIJBbKdL1kj6PQ2fkcwC8duvIW/JW9G/a8cp32Uq709Ek gspVn5GZT+1bv+SFZZfEgHR6dFWqpqSzIKRBJwQh4ilCvYRZ+oywWmRg8r7Jgk7lDlYy 0Dja1/sCNLvp2oNSQ89ns0LW2PVXlQSZbX6dRSz1oOgLCyLVmthx3qmCCsqnblBgY1Y0 VWcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084813; x=1698689613; 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=kPve6f7zLeYUZnfvyB8rknIVGRQNk3b6m8Mg7HCCt/Y=; b=wXJB5HFtPefa5zwu5fpbaa8jInVmH3DVGBrjoCt1Y1SXZ5Zgv2vp63UKOWz6oDN4AC 7hE2StB3SrM05t5f2sVQJCs3IIU+Rv9Fz4VqbN/tSamonNFsC8KE1jiAngya7incOvN5 vV9l4sqvVtu6EWs08K8NNnxKASar7TxeQZEpMHLRV0rb6o5R92YrI4Ll4nQ2/cuICSWH d5VAIhAwsnyKUoPTXVdCfH0QS9k+nlSVmKekkZrki2GMKRXb2+uUSF1LIpP1wMxr/v3b wWfQcaDfKB2IFXvFAUqwzxktkmWygNxcXwyEcznGTNCYKtm/rFBebrpr0HwK3hDi9KDQ Gxlg== X-Gm-Message-State: AOJu0YxTNm1f/KmzUGxV5MlNe7jP/azPt6M7FiHSfBocRxQq2rz51NoX g/RarimFNyslCPIqhIgHe/ahzxudcpCxodv7W2g= X-Received: by 2002:a05:6a20:54a6:b0:14c:a53c:498e with SMTP id i38-20020a056a2054a600b0014ca53c498emr354664pzk.42.1698084813052; Mon, 23 Oct 2023 11:13:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jordan Niethe Subject: [PULL v3 02/38] tcg/ppc: Enable direct branching tcg_out_goto_tb with TCG_REG_TB Date: Mon, 23 Oct 2023 11:12:53 -0700 Message-Id: <20231023181329.171490-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 From: Jordan Niethe Direct branch patching was disabled when using TCG_REG_TB in commit 736a1588c1 ("tcg/ppc: Fix race in goto_tb implementation"). The issue with direct branch patching with TCG_REG_TB is the lack of synchronization between the new TCG_REG_TB being established and the direct branch being patched in. If each translation block is responsible for establishing its own TCG_REG_TB then there can be no synchronization issue. Make each translation block begin by setting up its own TCG_REG_TB. Use the preferred 'bcl 20,31,$+4' sequence. Signed-off-by: Jordan Niethe [rth: Split out tcg_out_tb_start, power9 addpcis] Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 48 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 5cecc6ed95..9197cfd6c6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2509,9 +2509,6 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out32(s, MTSPR | RS(tcg_target_call_iarg_regs[1]) | CTR); - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, tcg_target_call_iarg_regs[1]); - } tcg_out32(s, BCCTR | BO_ALWAYS); /* Epilogue */ @@ -2529,7 +2526,13 @@ static void tcg_target_qemu_prologue(TCGContext *s) static void tcg_out_tb_start(TCGContext *s) { - /* nothing to do */ + /* Load TCG_REG_TB. */ + if (USE_REG_TB) { + /* bcl 20,31,$+4 (preferred form for getting nia) */ + tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); + tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, -4)); + } } static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg) @@ -2542,32 +2545,22 @@ static void tcg_out_goto_tb(TCGContext *s, int which) { uintptr_t ptr = get_jmp_target_addr(s, which); + /* Direct branch will be patched by tb_target_set_jmp_target. */ + set_jmp_insn_offset(s, which); + tcg_out32(s, NOP); + + /* When branch is out of range, fall through to indirect. */ if (USE_REG_TB) { ptrdiff_t offset = tcg_tbrel_diff(s, (void *)ptr); - tcg_out_mem_long(s, LD, LDX, TCG_REG_TB, TCG_REG_TB, offset); - - /* TODO: Use direct branches when possible. */ - set_jmp_insn_offset(s, which); - tcg_out32(s, MTSPR | RS(TCG_REG_TB) | CTR); - - tcg_out32(s, BCCTR | BO_ALWAYS); - - /* For the unlinked case, need to reset TCG_REG_TB. */ - set_jmp_reset_offset(s, which); - tcg_out_mem_long(s, ADDI, ADD, TCG_REG_TB, TCG_REG_TB, - -tcg_current_code_size(s)); + tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); } else { - /* Direct branch will be patched by tb_target_set_jmp_target. */ - set_jmp_insn_offset(s, which); - tcg_out32(s, NOP); - - /* When branch is out of range, fall through to indirect. */ tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - (int16_t)ptr); tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, (int16_t)ptr); - tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); - tcg_out32(s, BCCTR | BO_ALWAYS); - set_jmp_reset_offset(s, which); } + + tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); + tcg_out32(s, BCCTR | BO_ALWAYS); + set_jmp_reset_offset(s, which); } void tb_target_set_jmp_target(const TranslationBlock *tb, int n, @@ -2577,10 +2570,6 @@ void tb_target_set_jmp_target(const TranslationBlock *tb, int n, intptr_t diff = addr - jmp_rx; tcg_insn_unit insn; - if (USE_REG_TB) { - return; - } - if (in_range_b(diff)) { insn = B | (diff & 0x3fffffc); } else { @@ -2600,9 +2589,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_ptr: tcg_out32(s, MTSPR | RS(args[0]) | CTR); - if (USE_REG_TB) { - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, args[0]); - } tcg_out32(s, ADDI | TAI(TCG_REG_R3, 0, 0)); tcg_out32(s, BCCTR | BO_ALWAYS); break; From patchwork Mon Oct 23 18:12:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737299 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665985wrl; Mon, 23 Oct 2023 11:18:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEPg6QC/FefFqUGHEgBE4AlmPvVK6ayslYEvsQswxeI4K0WXubhd4FAEJ7WNQPc1rZaNs/ X-Received: by 2002:a05:620a:219b:b0:767:1d7e:ec40 with SMTP id g27-20020a05620a219b00b007671d7eec40mr9917574qka.1.1698085125579; Mon, 23 Oct 2023 11:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085125; cv=none; d=google.com; s=arc-20160816; b=zViriqjmwoGIh4+EW59qZnYs5/BwD/n+fGN/sOyGP67N4HyHe2GDMMzFhqEAXF7o/F VYOogAOoNR0/bh/34Mpz4kBFtGe0xz4SuEg6nLKXaD3RGA2CgvvjZV6x8mAw4GXiF7ff 5ikGi7VHRGgJl/oPbzy7e4578Sq/IFLKuxfkZY4f64hvk6wcVE22TLcPUBI9XpXaOJSA 2X3765GWmRp86pjb1d81GtYoCGpX6aHBZ5rhyV/eW/SS22mjXzn3wvzNfTnqcKA30e6H NUpLWB9mB7+MrUrVLElc+9kp3WJpeeqGYtU65h6MaVY+TjqE96Z3gL5tZWPmIvtdTiVQ d46g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bfEPROwPknMm0Zm10o07B7yy9fZRdxL4lPObCyJ5noK7t5gkM7C+mxbYUvfjYhSL9V BDZpCLRBTkBTtRq0+QIqynTmPh+U5okvlkjJzBGT4TU2IM3rRInrrs14Akk4CsgpklQb YvAD0WdBFxngl1A2E74fgDcsJC0djRhttXfRN7JOWTLGFVPqwPYx8ps3rg1MH4KolSOR 2b36ONQKpP8sGJGJfNVcslPfmloCAh3JJFm222qJ5DgCugLpsi6FnJYKLEyr3TgF9PcA +o3ffS5t6lcD3HANekIghMl3fLcKN6RXRMkRUn5AASX7IcIl6A9F6sOQL0hgfKGjqvVy h0pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z6xUgsqy; 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 p9-20020a05620a22a900b0076f39f669desi5949167qkh.51.2023.10.23.11.18.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z6xUgsqy; 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 1quzQu-0005VV-Ua; Mon, 23 Oct 2023 14:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQr-0005Tw-Dn for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:41 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQl-000857-45 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:41 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-5845213c583so1032466eaf.0 for ; Mon, 23 Oct 2023 11:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084814; x=1698689614; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; b=Z6xUgsqyg/YSo2mtmN81hn4f9jkjDkOnnYjxjptmIfVKsNGs+J6lZVTgXgSteB0rGo 5YpWTttqgfykuIXrj98RvMHRjm+0DlucedArR99+nY1zaQ00pj6I6qyBwERifTiuZkxb y0U1VFcU9tpNLE28Gm8f/r32Q08FTAD4sY931w+KHVPJBhKSsyGN9Q5cA8/DWQmVtt6V tmIeGnztE0S/wGnwJuH6wjgBEhIEafR5EM6Swf4WmMhPDm62bHVNuYWxRrBT0e+/ocQV 33Uk/7LHTJWQBgDXfPq5ofdDkUl2GPqssdqXR6HZMgVWdGz++11BcalvGwAPJPDIPa+g 9NeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084814; x=1698689614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3KCQIgln5kN/33Jyz8B+r1A500q3A4Jm4TEcmcp8vS8=; b=g/OSI5vtrJTHjFrVV/36ODJ9k8G0bWB+rFgae7+vWKP2BR5rdMLr9QK6Z2DEuXMKPC S5B9Js7Mef0DVsTCVQsrnZ/tGqX826WRW/6hF7wCuXuebVweR1IW8giQ4ZFHYOKjzyJc 2JHHawJoaHopgUrOv3aRmTnbia2RvCsolT4U0IRUA6PjaRo28ufMyrZXf3xWXeUd1c4Y jMA7SVKIbidyuU3OxDouEhIVrjO+s25hmeoFMZboW/P/G8uY9W3Uh6qLsnDJ4QV5Rtvg pliVUTgTK5RAtNVQejMVRnoRxMWueDEGadWbEZYoEBsioxIbeNhsVgJbMMQm8l2cixY3 V5ZQ== X-Gm-Message-State: AOJu0YwvwdMp2+u0PFseVNaWK5LBbF9OdnIUcihAhi1jmoA/zhttI916 YhPQf3CXoXMFLImkEqSHrtiP53DpELxmpkO4PYc= X-Received: by 2002:a05:6359:4289:b0:168:d0d4:d8e6 with SMTP id kp9-20020a056359428900b00168d0d4d8e6mr7666134rwb.16.1698084813892; Mon, 23 Oct 2023 11:13:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 03/38] tcg/ppc: Reinterpret tb-relative to TB+4 Date: Mon, 23 Oct 2023 11:12:54 -0700 Message-Id: <20231023181329.171490-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.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 It saves one insn to load the address of TB+4 instead of TB. Adjust all of the indexing to match. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 9197cfd6c6..aafbf2db4e 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -215,6 +215,12 @@ static const int tcg_target_callee_save_regs[] = { TCG_REG_R31 }; +/* For PPC, we use TB+4 instead of TB as the base. */ +static inline ptrdiff_t ppc_tbrel_diff(TCGContext *s, const void *target) +{ + return tcg_tbrel_diff(s, target) - 4; +} + static inline bool in_range_b(tcg_target_long target) { return target == sextract64(target, 0, 26); @@ -991,7 +997,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } /* Load addresses within the TB with one insn. */ - tb_diff = tcg_tbrel_diff(s, (void *)arg); + tb_diff = ppc_tbrel_diff(s, (void *)arg); if (!in_prologue && USE_REG_TB && tb_diff == (int16_t)tb_diff) { tcg_out32(s, ADDI | TAI(ret, TCG_REG_TB, tb_diff)); return; @@ -1044,7 +1050,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, /* Use the constant pool, if possible. */ if (!in_prologue && USE_REG_TB) { new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr, - tcg_tbrel_diff(s, NULL)); + ppc_tbrel_diff(s, NULL)); tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } @@ -1104,7 +1110,7 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, */ if (USE_REG_TB) { rel = R_PPC_ADDR16; - add = tcg_tbrel_diff(s, NULL); + add = ppc_tbrel_diff(s, NULL); } else { rel = R_PPC_ADDR32; add = 0; @@ -2531,7 +2537,6 @@ static void tcg_out_tb_start(TCGContext *s) /* bcl 20,31,$+4 (preferred form for getting nia) */ tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); - tcg_out32(s, ADDI | TAI(TCG_REG_TB, TCG_REG_TB, -4)); } } @@ -2551,7 +2556,7 @@ static void tcg_out_goto_tb(TCGContext *s, int which) /* When branch is out of range, fall through to indirect. */ if (USE_REG_TB) { - ptrdiff_t offset = tcg_tbrel_diff(s, (void *)ptr); + ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); } else { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - (int16_t)ptr); From patchwork Mon Oct 23 18:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737297 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665956wrl; Mon, 23 Oct 2023 11:18:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJp/xFTMf09fmXNLk7uU9IF/x7Z6JT86AROErOnQQ2yepjEjtA6eF4MZnFh3kcN0gpF07E X-Received: by 2002:a05:620a:29d2:b0:779:ab34:abdc with SMTP id s18-20020a05620a29d200b00779ab34abdcmr6724668qkp.51.1698085121717; Mon, 23 Oct 2023 11:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085121; cv=none; d=google.com; s=arc-20160816; b=vvnsnN/UV+12cLzsWnvaZkvk7GVo1+D0HSDu2js7QN5Qa1iAGYazOcFYiloGAWxwVp cONKo/TnszszE4wD+Eam5C4lhiTVzjG12ZK2cEMwZGNnk60mn0iggiqbZC2ATdiJKR1P mi5NQ6AiPVHIoXL8oqZ22pM7w65tKQKTa8LUMtHo3tTPUx6UiaMgLnREC/eKkiVG9GAt ttNUKnwZnQGjhKD9hFOFOkqyGuWG/QnE3jmwY16/YyMkOwzy1l4jG6wptYLgTajzZNG8 dbQqYpM8AoNDQ6tRdwQzMUGAkM8g7gw4ZCTJXG1Znrkh+yw6PvRpUfoOmQiyBGtfoVD8 VT9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=uH6SkYrJIl1xdMh78XFomZ7rzlPupB86H2tcJ23aBopbywVSNo51LvU0KrDhoj2faQ l2mbiVxkMBoueyW/kpZgDLHVoHTRnVOH6CzbWNczRng/GnkaBq3pAapOEJO4jpCfEY7J eOnxi5m+Ns66IrO/dTCw5HItgBzAc3ROLnyUHvPE5rE0rjsYMJUnB8KnKHHKXWls3RnX k3RCygFlV6GxblzgSKsKVw7uUXe7cz444HgLknpz24o1D/1EHAOsSpSWxdhnq7SK+hw7 CgwtV2Hf4zV76DKg1pKSQRK5iNb+XbjHV1KuU7f4MNb/5TNzfFFPe4UfQZrOedcoiZ5z d3Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rAPdpyop; 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 bl3-20020a05620a1a8300b0076d9dc0bc9esi3846449qkb.230.2023.10.23.11.18.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rAPdpyop; 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 1quzQu-0005VF-Jt; Mon, 23 Oct 2023 14:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQr-0005UG-U2 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:42 -0400 Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQl-00085D-Pq for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:41 -0400 Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-584042a01eeso2273662eaf.2 for ; Mon, 23 Oct 2023 11:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084814; x=1698689614; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=rAPdpyopiZmJ2FUfdY8NebQOYujXwtkbtENSi+g55xn509DqYjRhcx9quHBf1DYA2B KAHdOe2yk7c3NbE67xcpVR81ZZZEBSu0tGWkpDg8phP2kZRo8fjPiMAEobBCRKFHJl6q oqu/qNu2nbL15m6v4YolLLxws+01mmvcXGTbWhXbUd0eB5oSMzmtkN1JyEzET3s8w01K W1RvLigr26T1hVOvGD6V7YB00s/RBx4CVoJmhdXJvH8HXQ/igiKm5NSnidlO4Ex4Z+3l fC/Sul2cVoMiLTSiW8E5p2h+77F6XywbeKTmjmg5e2EUWLC/dxuFKEuEunuIq79TA+St r3hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084814; x=1698689614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ll1AHH/tNyWuM8OWYdUz/S/zYn03mj8222BJRAroDbQ=; b=CJ7iJr/TRmUv/Sy+wO2wNNsjNcZH/V13zvUbm3wysButhC3VD/zxV4EyrXsIevAuvJ FN90bXVAFe03CHX3eAgYNI5xGet746eAj+jIsVla2bIs5abVAYeD7ZXM4AZ/lpf5rqS/ d5pvWKV26JgxVaw+Mttzipnmh41/jHJYy42WMR9wyT1mgWTmpsSrdAYKy6+0nhe9G/v/ Y/eZH/JsZ9iOZMEn8ujCo90lSVLBpbEfMw30zvK9DhAZ39Iyw4HLBkps1pMWjoeGFZJk J7375p7coUHT2sQoWJ+koKlCTcyvrRiZ1X3ert1H4u88NrD66Iw5KBVqoNiyZT3hgJ0B bw2g== X-Gm-Message-State: AOJu0Yy97Fx+Fz0QCwdWS0DkT6c1FOVlVJGgPkUoA5CwepkiCyunnosI ES988kv2Xn68xRjCQaZjnQRq1ykm4y8I/6eYYA0= X-Received: by 2002:a05:6358:3517:b0:168:ba46:d9dd with SMTP id m23-20020a056358351700b00168ba46d9ddmr8966192rwd.17.1698084814586; Mon, 23 Oct 2023 11:13:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 04/38] tcg/ppc: Use ADDPCIS in tcg_out_tb_start Date: Mon, 23 Oct 2023 11:12:55 -0700 Message-Id: <20231023181329.171490-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c35; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc35.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 With ISA v3.0, we can use ADDPCIS instead of BCL+MFLR to load NIA. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index aafbf2db4e..b0b8cd2390 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -362,6 +362,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) #define CRNAND XO19(225) #define CROR XO19(449) #define CRNOR XO19( 33) +#define ADDPCIS XO19( 2) #define EXTSB XO31(954) #define EXTSH XO31(922) @@ -859,6 +860,19 @@ static inline void tcg_out_sari64(TCGContext *s, TCGReg dst, TCGReg src, int c) tcg_out32(s, SRADI | RA(dst) | RS(src) | SH(c & 0x1f) | ((c >> 4) & 2)); } +static void tcg_out_addpcis(TCGContext *s, TCGReg dst, intptr_t imm) +{ + uint32_t d0, d1, d2; + + tcg_debug_assert((imm & 0xffff) == 0); + tcg_debug_assert(imm == (int32_t)imm); + + d2 = extract32(imm, 16, 1); + d1 = extract32(imm, 17, 5); + d0 = extract32(imm, 22, 10); + tcg_out32(s, ADDPCIS | RT(dst) | (d1 << 16) | (d0 << 6) | d2); +} + static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags) { TCGReg tmp = dst == src ? TCG_REG_R0 : dst; @@ -2534,9 +2548,14 @@ static void tcg_out_tb_start(TCGContext *s) { /* Load TCG_REG_TB. */ if (USE_REG_TB) { - /* bcl 20,31,$+4 (preferred form for getting nia) */ - tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); - tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + if (have_isa_3_00) { + /* lnia REG_TB */ + tcg_out_addpcis(s, TCG_REG_TB, 0); + } else { + /* bcl 20,31,$+4 (preferred form for getting nia) */ + tcg_out32(s, BC | BO_ALWAYS | BI(7, CR_SO) | 0x4 | LK); + tcg_out32(s, MFSPR | RT(TCG_REG_TB) | LR); + } } } From patchwork Mon Oct 23 18:12:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737287 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665139wrl; Mon, 23 Oct 2023 11:16:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHM9wwAJiPT+zlZrjg/yIWE8w+q2NPhkTDIE74k78x6DyKonkKndZ9XtgR21hGVfr6Is3k/ X-Received: by 2002:a05:6808:3b0:b0:3ab:929e:c5e1 with SMTP id n16-20020a05680803b000b003ab929ec5e1mr9789232oie.39.1698085014352; Mon, 23 Oct 2023 11:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085014; cv=none; d=google.com; s=arc-20160816; b=arUOIrPHFx7OIEHcXdbZ9gE4Xc1UI/t7H+jp6IfuqVCRdOli3laKEX6Ek91RJSXXE7 /ReL/G57+BESbTNKmEBf0S4Vz2EGT+dpZRzOXHBq2woqU1/65+xoB0+La8eO04ZbNBxR SxeJTx/YlYLM+jHq68/pHC/JiKA6wy7ar62PKWs0lCRBFgfOvZrpFYiLHAAPiAGKj8b5 p3YmPjTQgd9sZ9bm0ajHT4Z2phjuw7cBy2QhRiNofTEIzwzWFyv/DdkSss4ftbbJ4z2J hcTYRbJ7GKyYf2LbXHGHQmJPljGMvD8t4CdKigz7c9cilnbYIV8ixnKffxwgHcNq9Qg+ nInw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=pColIg90skWcsYxhdRta4Iy4j8trka1y5LcJF5JnDNT58SzYaNl4P+6TuQ2k6X+ML3 nPWyxE4dITPOS2vcoFbMxkqviQKy61F1bP/vxrFwFnWfVSflI70Gt8tCl7wkzyn1DP9M k8FSIvNiNI481oNFhZpDTOFgLUIxBniyGF6G5f9/7wBAE36XI9iUaPxrpa/6kZ49mQgr GY9rXr3TuFdyxzNC9BXmeGGpZHr+ftBogvb441Ux7/35fH30iQ43uu0CYGtos50SSLZG VICyT6DbZ0ydv7PFFc6yBK3bQkiKSyAM/8xHR1Ly+D1yk3cos/lv2fNea6LhPbTlbfxu D+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=one66qpi; 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 bo2-20020a05621414a200b0066d0f75bd1esi5735481qvb.80.2023.10.23.11.16.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=one66qpi; 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 1quzQy-0005X8-4O; Mon, 23 Oct 2023 14:13:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQs-0005UN-DL for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:42 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQm-00085H-Cq for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:41 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5842c251d7cso1760757eaf.1 for ; Mon, 23 Oct 2023 11:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084815; x=1698689615; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; b=one66qpi95XCTW+FH9knVwkLj8dYV74LKPb15HOGn4Z5OwzkaJC8QeXbQGZtJqL9jo tVVzUZMuZo6oxxz4edWDIo2zjfQPkomEZErtT7aClnEv3+1PC757rrhieM6GZPnke23g zndSSKS8OtiiQw3amCjKIz0drEPa87MIPjwmN4ARyFGmNpetB257XYX3XMNII/t6PUDY QzUaIHEgzlFE6JhJU8vICRg8EiyQXTXTix7b9dBugeqRUR1GcXMHiYdk0DZ2ZlkNe9z5 pm8PDYrRIhxQ0hyeLhuLNNws+3baLUlpm58KyxhLswshMXH+9kvXZYESgRwoZH2vXs9+ pnQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084815; x=1698689615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kj+TKk2K3WfpkaNPPr/v3KoLmzqb4EREhy9sjMrwx20=; b=YNKMA+PAkEinXuNcB/hqMAQzntnXQtPrzJFe1DRWK5rVVLS3EEndH7qDiIJzY9jUFF QdJts7ijyfmzOly9HPjTX1FMQLsQFVSulg7mGIno1kOR5ljKkhTZB2w9WJVHkhdyjotL RVG0SQs6DOtGi2HM6cYp173ZuxoN9YE68DIojlgKweByjyuk7qOU4A5OSCX6N/whrPlf g2i+6ZP99tPXj+iWFFJ8GcIxZeMYt5lJU7ElTWUu7WLq8YxbxFWmVd2fIwgWEUwtUgoX /aBZ90hEXw1ZXDN8Z2ajU7MGESwGqgj/NGyqaUEBNF+wpJx9Oq+DcXK2MkOHOOp7Dqws rdfw== X-Gm-Message-State: AOJu0YzcqDmAwiO5MgeOOmjfNWW55Wfqmix7EEmkr+T8cfOgqX4cj+KV qFV7jICcuHKOb6s7zmw7pgbUn6uFYFSu++NJbpw= X-Received: by 2002:a05:6358:6e93:b0:168:e592:f8d2 with SMTP id q19-20020a0563586e9300b00168e592f8d2mr2405493rwm.25.1698084815312; Mon, 23 Oct 2023 11:13:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 05/38] tcg/ppc: Use ADDPCIS in tcg_out_movi_int Date: Mon, 23 Oct 2023 11:12:56 -0700 Message-Id: <20231023181329.171490-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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 Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index b0b8cd2390..226b5598ac 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1055,6 +1055,19 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* Load addresses within 2GB with 2 insns. */ + if (have_isa_3_00) { + intptr_t hi = tcg_pcrel_diff(s, (void *)arg) - 4; + int16_t lo = hi; + + hi -= lo; + if (hi == (int32_t)hi) { + tcg_out_addpcis(s, TCG_REG_TMP2, hi); + tcg_out32(s, ADDI | TAI(ret, TCG_REG_TMP2, lo)); + return; + } + } + /* Load addresses within 2GB of TB with 2 (or rarely 3) insns. */ if (!in_prologue && USE_REG_TB && tb_diff == (int32_t)tb_diff) { tcg_out_mem_long(s, ADDI, ADD, ret, TCG_REG_TB, tb_diff); From patchwork Mon Oct 23 18:12:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737301 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665998wrl; Mon, 23 Oct 2023 11:18:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnHGWTbLPACqVGMQkLyU1t/hLZNsRCpk0vTkPlBPBRNZ8j6LHRNJwhY8zQjEgjkUwbGf6M X-Received: by 2002:a05:6808:2c7:b0:3ab:8e86:fc26 with SMTP id a7-20020a05680802c700b003ab8e86fc26mr11140732oid.46.1698085127900; Mon, 23 Oct 2023 11:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085127; cv=none; d=google.com; s=arc-20160816; b=JreOMic3qc1RybHpbT/BZk2q150oCYlzbk8d7zMG7uvhcHDMVWrIoWax2ktZqrXkaL t+5IyT6hjrplOyWlBPRY8PoXvRucUYKwdmmmgVPlZVhYvXKpC+oYftkPauaRW7CKit+V LKuECYs05sljgxwGZbR/qdewI9RNdn41ifnVln+/cQeDiZt0P/qLKXuetHGFL4j+un40 UW0xOLE0rgkzmTeMZ6Q6UGtlMwFe5sOrUmsUtXBtJc0PGKnae/7zXKyPMCZC1Uk73BeG uqo2ZNqEVfvfvqGT/qgXXETgrNlUJFkYS70PuayeWfUFmAEbQWcvZQ0iZjxgWe1+nbVI //2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JTUALL5dubLCZJB7kyl7FUK//RsJJcfyjuY0akZgFBFCuPvyQYQr/UNflokSMylCHK HEjWPN8kyFq8PnErk7dxdjxr5bcfsDP0h7Rh0tge0GfinuwitceqIoL3arAczyfYQWG/ CPw2ekFB8RukfbZaI8GVrh9Kk2kYc3hUF4hYEUOAQt7sCF77jvwXTa4TjekThvet0RlD aWZ2XBB4y5pNOUuA715wbvGXMWmsPVCXHsbcotNQMIDQtK+X/b0Bs4nxALqIynWlZeg7 Z25C9+PDZGOkHg1H1FHsNnlB4AGIWt8fxflbJmmbH+Xp4k8iHA3KncdY55s2CEZnS+Cp 4iLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KT8nIXk9; 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 cu17-20020a05621417d100b0066d19d6a761si5890264qvb.279.2023.10.23.11.18.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KT8nIXk9; 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 1quzQv-0005Vw-P1; Mon, 23 Oct 2023 14:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQu-0005VE-If for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQo-00085N-6z for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3573fa82923so15267695ab.1 for ; Mon, 23 Oct 2023 11:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084816; x=1698689616; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; b=KT8nIXk9/7SCVUgvFn09JM33M23yUDID5vqfoYlexNHWSR1rulVuxUpN84RzkWdAwF HYTMmosPi1KEDX6/MLxxCixPodxZ/Y9hyKbU1vS0g1LIFHhVzmHSzExie+g2Sbe388rH WOe0oCeRRtQnUHbm5kvRRP6odjtYxSEHYxwOnqhSmoFidC3DfP+JNd3qftZ7FDLaA8Uj AobW37IZ3T2Ok067ZrbdiyP/SWRYFBP0+bzKHA5XT87VzxALnyL3zgewo/FF9t2ETiXX lq40SVtPgJhoYgT3c18wwjJXrAuqEBxDxhM/TK3zym9/1rwOLB/8jEsnyOz8fKtvb/cP lccg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084816; x=1698689616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8BGO0/K3CdguLDzJsds4aGoMbgLTr4W7qQjeN+mh4IQ=; b=Ftuz05nyQFeB9kmRXrr57f5+I30MgbjMbyO+glnPAAJN5819QcnUC28XUCcjwj6zUP q21gTNIHQWZMW7kLh7Dvy2xaQpH46nhRoIHYof4yoxirTH9/Nuu+Bta6KuGjlhB0FQqi oO3bWyxsnxWb7W1GEwfuSqeICULTJ8iWgv1YfXdkRzT6ePlUSm5Kzreoh+JFdpdVPs+t GnjGV74qA82CoPVW/+jvXa7AuHUaihjgM5313Whx+IRX8/ODs/StN/GOL2ajs/Ko0eZK gJ3Yx4dWXJ5Q/LY85ih3amqOYoXuHgT4bMpXOAIbRAHDXB8CHMmgkHvSIqDC7mVLMf/c YdKw== X-Gm-Message-State: AOJu0Yz/+a2MLObtWdwXM1sxX6RBFH9crZ1LP/JydCQnko2z/be/Nqkk /weirOBAbJjg9zt+bchpiOri1i+TXBRD5e/puFE= X-Received: by 2002:a05:6e02:548:b0:357:a25a:572a with SMTP id i8-20020a056e02054800b00357a25a572amr11610530ils.21.1698084816120; Mon, 23 Oct 2023 11:13:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 06/38] tcg/ppc: Use ADDPCIS for the constant pool Date: Mon, 23 Oct 2023 11:12:57 -0700 Message-Id: <20231023181329.171490-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::135; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x135.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 Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 226b5598ac..720f92ff33 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1081,6 +1081,12 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } + if (have_isa_3_00) { + tcg_out_addpcis(s, TCG_REG_TMP2, 0); + new_pool_label(s, arg, R_PPC_REL14, s->code_ptr, 0); + tcg_out32(s, LD | TAI(ret, TCG_REG_TMP2, 0)); + return; + } tmp = arg >> 31 >> 1; tcg_out_movi(s, TCG_TYPE_I32, ret, tmp); @@ -1138,6 +1144,10 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { rel = R_PPC_ADDR16; add = ppc_tbrel_diff(s, NULL); + } else if (have_isa_3_00) { + tcg_out_addpcis(s, TCG_REG_TMP1, 0); + rel = R_PPC_REL14; + add = 0; } else { rel = R_PPC_ADDR32; add = 0; @@ -1164,6 +1174,8 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, 0, 0)); load_insn |= RA(TCG_REG_TB); + } else if (have_isa_3_00) { + tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, TCG_REG_TMP1, 0)); } else { tcg_out32(s, ADDIS | TAI(TCG_REG_TMP1, 0, 0)); tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, TCG_REG_TMP1, 0)); From patchwork Mon Oct 23 18:12:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737290 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665294wrl; Mon, 23 Oct 2023 11:17:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6jXUoFmnDxOy9UjgmVegO3mMzUxJRFaTmbcvb2Y10aurMHo88pqtJvlys4zeHVkJPExXH X-Received: by 2002:ac8:5906:0:b0:41c:bd6f:e77f with SMTP id 6-20020ac85906000000b0041cbd6fe77fmr10445777qty.55.1698085033245; Mon, 23 Oct 2023 11:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085033; cv=none; d=google.com; s=arc-20160816; b=mNLUTQwS7U5nYnG6lYoZykbbexGtFtMEkrFqS8yjXWjA4ie7esoJKGao2O0dljDD/y B60Ao25e8LUT51UJro7sdtWzCoexHgieuqFiUEKxG2FvARbS+NY9C2sGcuwNNr6u6dcd FOXDozBpeM2DP+cYg/4/zVzSYq87H0HdD/+vY6aV6H2z8+Nu/BAI3sIpR8gAu1ibMxJV Wgl/ezw6voTRz/83ARSSkZrl1KzO7pK/MxE6i0gHyZzvh9U1N88Mw752wuvrw3ANrazy S/o9UTWl0r9suuhnUHFNQDEHVY9liE15Lagwp/acmF40C//OEXsDdOMYFx6jZgExQdvx lvSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=IU0VedkYVS4YdQAz5yfcWsCxKndqgDryAMr/4OqAq5W7x7KyBE3+YYrEDRGINqx/8e 7tw3idLXu7oPRvmZjDHlfl+ENnrQtb07cZYrqqV+/HDAFsr1I6R1Gx4dIEoNRadGdNzn SJhN3SfXOYeTi2zKtbIqsRsxNkn6IlX4rg+Gy7AqpXy1OmHESi5/b2kzDztxuqkgSLWT FnqvUZ7WFHlpuqpG+T+iNLUkiDtcNTkR7k33vGG1C4PfG3OcMdJgpo5Itp2+bpRpXmyg CSc3bH+WArJRTfTTDF/pboE7gBaEjDW/Jew6OstzhpMaV53luSlCfcAWiJ41usxzl8r8 i2bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SNmNGQrN; 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 u13-20020ac858cd000000b004108a7e5ef6si5938740qta.126.2023.10.23.11.17.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SNmNGQrN; 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 1quzQy-0005Xn-SI; Mon, 23 Oct 2023 14:13:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQt-0005Uv-TE for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQn-00085V-TC for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:42 -0400 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3574f99d260so13874505ab.3 for ; Mon, 23 Oct 2023 11:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084817; x=1698689617; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; b=SNmNGQrN2g5O35Es58hxTzmOLL9q2hKtJA0yIwINGZ2l0ovBLQPGFm45yygM5XJuxC 845d7CINs+EX2B8iWes8TCWMfGJ9yb6HlJFCreSzKjIpL6wQLb6ga0EEZ6yAsFhVhR+C l4HLIfmjumx0lOPmTgmGIaRzzvVD9H8DAK9Ouw8ZcRVHAb71X+yKNh51u+9cWdZhzB/n tf8M8zhAIRwN+hNffxmkO9HbRDz/AspF4y+ZDTEDSIYYU6Sxqpqw4d/5iN2kFeS5clv8 kSzSBdlyy43rxNCaK5r5oHttULYtF4G2jKurDrliBt1honO4y3hMeqRRqt+pueca35z7 jMVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084817; x=1698689617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O6ypWKYmP3E0vSS+zdR/mRhAnNRJOT7ENlr0UKfEKr4=; b=q+58CLdO07+risDag70Tepy2Q73qLRiFkDM2iMDhh4G8AFPBYwnT/g3leyEBmetm57 4aBiwHNjeFjthA4KH6VLQVAVK1AVJiJuw6JPP/nKgpYeiFvTD2dPzgfV5ytVKK0gxBVr tX9NkOUkkp6vdxD4VVXT9Udib9Q8TP41vWe9qCI4E40MjSQiV761+PEAt6WsItXKNuCr 0OOVpx00/MoPDRes0RpuKRxk+uBI3HdZxoHWucHbYkrYI5jJHxmNdBa90QjA2AkUdavD FGHnSEFkP+ouBi7dKTCXkBjK2ZWM+h/ZtRUUY/X4hFzGKwiEBEtFe07VUI1QVpD5Xv3D d5RA== X-Gm-Message-State: AOJu0Yx1zurbVXbhW9XnJvpGf57WQxQEq1JqTS21eivTfERr5IRDOq0g XaZI8jq9H4AM8mzOG0day14Ektq/A/buBNAL6Vc= X-Received: by 2002:a92:c248:0:b0:351:b22:af5c with SMTP id k8-20020a92c248000000b003510b22af5cmr12775741ilo.32.1698084816853; Mon, 23 Oct 2023 11:13:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 07/38] tcg/ppc: Use ADDPCIS in tcg_out_goto_tb Date: Mon, 23 Oct 2023 11:12:58 -0700 Message-Id: <20231023181329.171490-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12a.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 Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 720f92ff33..6337b1e8be 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2593,6 +2593,7 @@ static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg) static void tcg_out_goto_tb(TCGContext *s, int which) { uintptr_t ptr = get_jmp_target_addr(s, which); + int16_t lo; /* Direct branch will be patched by tb_target_set_jmp_target. */ set_jmp_insn_offset(s, which); @@ -2602,9 +2603,15 @@ static void tcg_out_goto_tb(TCGContext *s, int which) if (USE_REG_TB) { ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); + } else if (have_isa_3_00) { + ptrdiff_t offset = tcg_pcrel_diff(s, (void *)ptr) - 4; + lo = offset; + tcg_out_addpcis(s, TCG_REG_TMP1, offset - lo); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, lo); } else { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - (int16_t)ptr); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, (int16_t)ptr); + lo = ptr; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP1, ptr - lo); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, lo); } tcg_out32(s, MTSPR | RS(TCG_REG_TMP1) | CTR); From patchwork Mon Oct 23 18:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737296 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665920wrl; Mon, 23 Oct 2023 11:18:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOylgrH/90JY8Hed+HK1Dgk5FLwG3BM9Q2DBlr2rj5aAnjUBLWL5yopyvMTmycbDX60m71 X-Received: by 2002:a05:6214:20ad:b0:66d:2852:6f17 with SMTP id 13-20020a05621420ad00b0066d28526f17mr10510048qvd.14.1698085117083; Mon, 23 Oct 2023 11:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085117; cv=none; d=google.com; s=arc-20160816; b=WsEb25+HuuLpjK3KhZzeJJYjcnx2erVldR8a+LHv3mIIfeNsXO82BfJZqynncsma2U EMOJQRAXzsasv/lJYUZ6RSmhEw5DKkA3+j5fMNWsgB7VoGmVw137Kc0Lb8ie7vW1NeHF Nf9rsqbbln4ZqFrGee23EdiIxFqorC0UiKfXInh5J7OIQL6udNbwOoird9VJWuYGhKHL 4y+jsMvEwNdrw67VY5jt95tor36pCjW8WPHYGLl2UVE04bV40hwZ0u6SbF2eJOh2KqcJ m9FXFMy9BZm/CXAZvLR7qlZtpcnYAvfFMWPJ4EuPnuip9J+BB7d4qVw74jqnPtNNGEbn Nijw== 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=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; fh=o1FzCaEAYG4VwCHNWCaZIuDmCIpwE3zCfwcgLY4wMqw=; b=Vzo0v+iaLDSJVcLs0d44rsqn6sWCRaz0XyusnOUtWmuTVOvo+ebcmSVxFasWuIM7lT 96LTmvLdJYKmICUjYcCZjc8NFOj4wUCuk0jIu8egkTl24d/tctH6UV9R4jO1lq1/NJi8 Jn1a/GHpxBXu5wYBRVgUe7OVUQZBfxO45uVTh6qk1boORgbRqA2MHf5HlhjFUpMB6CdO 5LKuG1PPCxoNjx8d0S4b1DlNovTccaM2f9CS7lWo/uu87a+MgjOGJEr2TIYFV5qJCFJr voZLY4fO39GKspN/Jg8ye5jCLsZZKzhBjenfH4k9ofSx/ejj0AF+bYXilvI7pgqT04xB ZP/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQkW5tIj; 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 el17-20020ad459d1000000b0066d045aa0ffsi5858168qvb.543.2023.10.23.11.18.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQkW5tIj; 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 1quzQw-0005WD-A3; Mon, 23 Oct 2023 14:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQu-0005VA-Gn for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQp-00085c-M9 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5849fc56c62so740927eaf.3 for ; Mon, 23 Oct 2023 11:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084818; x=1698689618; darn=nongnu.org; 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=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; b=mQkW5tIj3yWQgjTi6C0WcCpCINt/dwAoqOEYlN4ID+EapZBwBhZMFty8iekGzZyory tCV66mSb2nmFBgLg1sdZe9hb1Jn5OEizVlP/wfibCvEE4GaWYOonTkUoQfbHz3j/VSi9 fVZGGJbzzMyFTgfDCyM6TIYVEbWMD1jf9zGjmf6CDViEyVlO1koEJxM3yeOwkhZY0GHH 7xJ/KbC/ghfkT3s0mwIqi8ciSKU4YUerhQr7lzc9lFKLJH0gsXtCKRnEpS+Ox4s9RPar rY2N/j6p2s0tSLM9SKLYUggCgVleJqOkdKykYltVDPF20sDoxkpJMdyaYvXbSnYicG2M +g/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084818; x=1698689618; 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=IcT+t2NWvvAgl7ag7U9fcr97JnnF4drB4JEVTRDmT40=; b=wXpAHVSnj3p/GGsGGgAUEHqRMdhEPLiBDlnB6YZ7GSkIzPVCl0P8cT36epqStCv6xA 8x7q4TCe7CsUiGCIw1ZGo4BdF1QCaQVzblHmoCmhX0ZGjYtLWlHkXwLanX41pgZhJO9c ZRroJJC0xrwpIZDd5fMTqwHRHHRsYfHeB5Q/Y8H98TdlX7cMlVBgwuPuZiLRlCHqVaXb IRNEnMDAS4fSf8GFp9u9A8DosMG/1ya/7PqhL6t2nhFJ+htdpMjlltWYdiwbACYupiHG CW2XNIs1mC6fa5+5CNfXmlbsdCyr3zGnsAZ4TZhCNyVtN2WAVjE+jnoirDwBAhS54nbk XYtg== X-Gm-Message-State: AOJu0YyV7lD9Ikj2EgZYUuh1eBGrlN8ULaNOtSiioS4z2nSF5QuHLb/s on8gVhCdbFaPSghUVtOdu0VxzbjvuPlkJqYrVN8= X-Received: by 2002:a05:6358:810c:b0:168:d6cd:7b2e with SMTP id p12-20020a056358810c00b00168d6cd7b2emr5661037rwk.29.1698084817955; Mon, 23 Oct 2023 11:13:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jordan Niethe Subject: [PULL v3 08/38] tcg/ppc: Use PADDI in tcg_out_movi Date: Mon, 23 Oct 2023 11:12:59 -0700 Message-Id: <20231023181329.171490-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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 PADDI can load 34-bit immediates and 34-bit pc-relative addresses. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 6337b1e8be..f4235383c6 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -719,6 +719,38 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, return true; } +/* Ensure that the prefixed instruction does not cross a 64-byte boundary. */ +static bool tcg_out_need_prefix_align(TCGContext *s) +{ + return ((uintptr_t)s->code_ptr & 0x3f) == 0x3c; +} + +static void tcg_out_prefix_align(TCGContext *s) +{ + if (tcg_out_need_prefix_align(s)) { + tcg_out32(s, NOP); + } +} + +static ptrdiff_t tcg_pcrel_diff_for_prefix(TCGContext *s, const void *target) +{ + return tcg_pcrel_diff(s, target) - (tcg_out_need_prefix_align(s) ? 4 : 0); +} + +/* Output Type 10 Prefix - Modified Load/Store Form (MLS:D) */ +static void tcg_out_mls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, + unsigned ra, tcg_target_long imm, bool r) +{ + tcg_insn_unit p, i; + + p = OPCD(1) | (2 << 24) | (r << 20) | ((imm >> 16) & 0x3ffff); + i = opc | TAI(rt, ra, imm); + + tcg_out_prefix_align(s); + tcg_out32(s, p); + tcg_out32(s, i); +} + static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, TCGReg base, tcg_target_long offset); @@ -1017,6 +1049,25 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* + * Load values up to 34 bits, and pc-relative addresses, + * with one prefixed insn. + */ + if (have_isa_3_10) { + if (arg == sextract64(arg, 0, 34)) { + /* pli ret,value = paddi ret,0,value,0 */ + tcg_out_mls_d(s, ADDI, ret, 0, arg, 0); + return; + } + + tmp = tcg_pcrel_diff_for_prefix(s, (void *)arg); + if (tmp == sextract64(tmp, 0, 34)) { + /* pla ret,value = paddi ret,0,value,1 */ + tcg_out_mls_d(s, ADDI, ret, 0, tmp, 1); + return; + } + } + /* Load 32-bit immediates with two insns. Note that we've already eliminated bare ADDIS, so we know both insns are required. */ if (TCG_TARGET_REG_BITS == 32 || arg == (int32_t)arg) { From patchwork Mon Oct 23 18:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737291 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665377wrl; Mon, 23 Oct 2023 11:17:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFi8AU2bQB+EiIcCDJ5ujwVXGUryM39RT09WkLTnNKPfCcoTrCjAnQJyLdcC6OC3KH//z0k X-Received: by 2002:a05:622a:144c:b0:419:5721:de43 with SMTP id v12-20020a05622a144c00b004195721de43mr11773974qtx.54.1698085043244; Mon, 23 Oct 2023 11:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085043; cv=none; d=google.com; s=arc-20160816; b=X3OYAKCa384t2T5U1/2k1IoeSrfK46IeGOui4JYHb/sf3r7Cj8jP/xALCmhxtygbNb K2YhOBi8HGdKZbKsPi5xSFi8mwE8CO1LrxiQsUXPmWsZUDX9c5md7KovWwfQKmUErSby O4/gvo5vg0nDdq7TH/xaRzaMRfV9conSHVJcGam+5ETKIi33mS8WTmYGBl8GOU40XiWQ IxHcer6TXaBwRuKHAt39t+Jkh7mnBtBss8eijtKcatWG+L3SaGM2yioLB7u9MkVmIsz4 UQOrfxnTE/dEZ5O/3Qlk0YfAhhvg3V6lkZb6kdSMANGtG2yGJJvhEP2HDQi+vpgpUxhN 5/cg== 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=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; fh=o1FzCaEAYG4VwCHNWCaZIuDmCIpwE3zCfwcgLY4wMqw=; b=hyBGWSfZjaKVjngMMuj66JlbKYnj3AxnUT72YtIAOWnzZ3F/as59ak12oNKvTP2dzm M9dbB1Su17NkzUg8V2KnovHZhqKPcEH+hixggB/CPnL0QopSEBsivll6LU18oONzKq9P 5vlQsqUDCFzoSjsu9xCl22Xw3thJMKzsb+FFQ8YmLW7uiAyZCNDWXcaYrPOos9T8vWRc XV2/iOGWRSaf9Y28tDr5uHflr4FdE1HTpuy4Set+/VCojjBPgSk/ruyKX7bdwrBuMkft OzHNnCAWuy2/PerBywDAeEtByTfIVHIeYPez8yBkjZXssqGCm55Z582pjfeIqM4SUTq8 9jHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ScwISToG; 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 13-20020ac8594d000000b0041cc2bffe29si5738839qtz.329.2023.10.23.11.17.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ScwISToG; 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 1quzQw-0005WT-FG; Mon, 23 Oct 2023 14:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQv-0005Ve-3M for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:45 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQq-00085j-4H for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:44 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-564b6276941so2818456a12.3 for ; Mon, 23 Oct 2023 11:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084819; x=1698689619; darn=nongnu.org; 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=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; b=ScwISToGSRjtHeh2hnmZ5HHNKpOhBJkM31Yqfv5Jt6Ig/6nPR7Xe1pCK+5ARc0OGNY veADuNnB7VLi4i1vq9ERnBTlWMG6nL7SWiyclPgMf9j1ND7aNjH9/zu6GYYV+mdsM/A1 w04DNFouMmwzNlycuqCQkG48ZkpTRty2cDO73v9lDgaOcHcGYBoj9lqI2BAHq5cpK4M/ 01mTMEefTiYvDRCUZ8uNDobU4SNbofg3NQrPnu3/5UQY0Rozi/4F9aNKieg5yWxs0G+6 deHycCo8IOTuHfWyKBtflhV1X2pqQTUY+H7TRiZYiN3OU9DMTqOvuL/YIN0XXERuGp6r 1prw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084819; x=1698689619; 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=CnIEHz3YbyZLNAezqFGknAR6TwEjyjNQhE5DMYmjFw8=; b=vb9i9tMJxDzwU5kpm8KfikvxUbg/Ab6ovmEMRF9n2FVnomGpOguP6+cbxWAXA9RikD 51AoK0/CiZJnmdDJ7x4FbYwAeUxhM4wGGtV3/HYNpNTMbLhWJ2exnyDTKlhiwxKrX550 NXr8QRx4+HELxmMs/rrB+qSGR1kQoGrWkK7+V2oR0Qg9+kY2vozsus71lV1E02YzsdqT 9BkX2LBARQTySDyuUGKRaA5rxeBBarlpALj/QaeejF/Lsc9j/fFOn1D4bNQ6MgVNutkH 8m9SJ+Gu8cP07Eo1e2HRkXIWteUszdOTOqYK4PDPuHw8us32IooPDx3h1QBSJR31GZjK tCiQ== X-Gm-Message-State: AOJu0YzSC+q+2UzLM340K99eT4G426YeqR1dU9xY6MkGnxLHA6P2FBuv G0p5Q1MyFw1RqNzpdi89MbD1UK0t25l81zccAr0= X-Received: by 2002:a05:6a20:da88:b0:17e:2afd:407f with SMTP id iy8-20020a056a20da8800b0017e2afd407fmr499358pzb.9.1698084818831; Mon, 23 Oct 2023 11:13:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Jordan Niethe Subject: [PULL v3 09/38] tcg/ppc: Use prefixed instructions in tcg_out_mem_long Date: Mon, 23 Oct 2023 11:13:00 -0700 Message-Id: <20231023181329.171490-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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 When the offset is out of range of the non-prefixed insn, but fits the 34-bit immediate of the prefixed insn, use that. Reviewed-by: Jordan Niethe Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index f4235383c6..34df9144cc 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -329,6 +329,15 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) #define STDX XO31(149) #define STQ XO62( 2) +#define PLWA OPCD( 41) +#define PLD OPCD( 57) +#define PLXSD OPCD( 42) +#define PLXV OPCD(25 * 2 + 1) /* force tx=1 */ + +#define PSTD OPCD( 61) +#define PSTXSD OPCD( 46) +#define PSTXV OPCD(27 * 2 + 1) /* force sx=1 */ + #define ADDIC OPCD( 12) #define ADDI OPCD( 14) #define ADDIS OPCD( 15) @@ -737,6 +746,20 @@ static ptrdiff_t tcg_pcrel_diff_for_prefix(TCGContext *s, const void *target) return tcg_pcrel_diff(s, target) - (tcg_out_need_prefix_align(s) ? 4 : 0); } +/* Output Type 00 Prefix - 8-Byte Load/Store Form (8LS:D) */ +static void tcg_out_8ls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, + unsigned ra, tcg_target_long imm, bool r) +{ + tcg_insn_unit p, i; + + p = OPCD(1) | (r << 20) | ((imm >> 16) & 0x3ffff); + i = opc | TAI(rt, ra, imm); + + tcg_out_prefix_align(s); + tcg_out32(s, p); + tcg_out32(s, i); +} + /* Output Type 10 Prefix - Modified Load/Store Form (MLS:D) */ static void tcg_out_mls_d(TCGContext *s, tcg_insn_unit opc, unsigned rt, unsigned ra, tcg_target_long imm, bool r) @@ -1418,6 +1441,49 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, break; } + /* For unaligned or large offsets, use the prefixed form. */ + if (have_isa_3_10 + && (offset != (int16_t)offset || (offset & align)) + && offset == sextract64(offset, 0, 34)) { + /* + * Note that the MLS:D insns retain their un-prefixed opcode, + * while the 8LS:D insns use a different opcode space. + */ + switch (opi) { + case LBZ: + case LHZ: + case LHA: + case LWZ: + case STB: + case STH: + case STW: + case ADDI: + tcg_out_mls_d(s, opi, rt, base, offset, 0); + return; + case LWA: + tcg_out_8ls_d(s, PLWA, rt, base, offset, 0); + return; + case LD: + tcg_out_8ls_d(s, PLD, rt, base, offset, 0); + return; + case STD: + tcg_out_8ls_d(s, PSTD, rt, base, offset, 0); + return; + case LXSD: + tcg_out_8ls_d(s, PLXSD, rt & 31, base, offset, 0); + return; + case STXSD: + tcg_out_8ls_d(s, PSTXSD, rt & 31, base, offset, 0); + return; + case LXV: + tcg_out_8ls_d(s, PLXV, rt & 31, base, offset, 0); + return; + case STXV: + tcg_out_8ls_d(s, PSTXV, rt & 31, base, offset, 0); + return; + } + } + /* For unaligned, or very large offsets, use the indexed form. */ if (offset & align || offset != (int32_t)offset || opi == 0) { if (rs == base) { From patchwork Mon Oct 23 18:13:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737289 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665175wrl; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzXmcnML8l1Hcwno0bZ4kRVCVMRQqj7yuEUyZw3fzJhlnxMTCLKPru03jhg8VolxhmIoKs X-Received: by 2002:a05:6214:568d:b0:63f:8839:658 with SMTP id qm13-20020a056214568d00b0063f88390658mr20357107qvb.1.1698085017705; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085017; cv=none; d=google.com; s=arc-20160816; b=Clqi1JMGPkaqNvMMdF75EBRmTe9woaZLtSYMqiLiPK8ISG+K658NDKRHIIvg4861B8 jn70R/xH8bfGH5n1vYYupqVG5iZbsi7hvY+9dnU+kzBUIDWHItoxgrvSUxExDMTNY4C9 sN3zHBgCukOKG+LDDS8F7Lh4xa8ZUOtWc3w18O0soci1jLkuvtNaQ5Qg5vUsYWq8p/ok bDXaNbokfg1ZSY4CFRAym1nmh6tmF+svqvaZ3U7fydvwu0koX9tT62fbKMBqf5W4UbGr 3xTsv2610BN7R4GkZFWaFJoU0EKnO1JCyZvc0JxVdRTKy64nXTn4G7oVir1PJ9OhJaEq 1xfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NgCE3ebTS3b3TVy5tttXFO6gfSXTK4KKuotx+77gjdFMYOCayfiLFkEu94Kt/RzpZo PkYvROP03qm8bfEXtiKxNeHD7iB1MF6DGAiZLzL0zwUREvWSI8W/KOwnSZRwHBNPStpl ChNx0muZWA9XOj3SUeQgRiF+IAPTlybMLUJp/DP6BaYOhMcMJiDnrtqxNeEVgkGg6I/8 N60kjZeU2Mzs2IsQkyPtaZsAZs/mk+vpI5cBoE+CZMldsY2qPOzn8r+fwiBo0kLI/TNM Fcoi2VcCK6hWMO7MDwLIBBirArr+V+KWHvWUGfX3zUdsm9bBwPoMsuCkDaSjwlGyw7B7 AV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKMmiCpl; 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 dl12-20020ad44e0c000000b0065afb72d696si5992693qvb.454.2023.10.23.11.16.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QKMmiCpl; 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 1quzQx-0005X6-Id; Mon, 23 Oct 2023 14:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQv-0005Vv-Ki for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:45 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQr-00086O-6o for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:45 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6bd73395bceso2610056b3a.0 for ; Mon, 23 Oct 2023 11:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084819; x=1698689619; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=QKMmiCplK/iJXS1XYv4o+C3ELvZmOsait1wOf3MykKISkFtO8GEMpp1b7FPcSp40LI 6IHkgSIfGwdfzyNuypLWjT73y5ToTUo4wr1ZNpzDrr9rhvhjM0VBXzxQSUESa5xPacDn v1SmRiph9W/NuhMLlenkMbJg1K1x7Pf+MJ7P6GSTCW93BS9C+IhgHcfv+YuPG8YdEbRy Hkwj+pb4t3oShSiwBvoG4+mq/pTKBnOdRyugfFeQPNC+lfyvFuXyv96C0VpkUSiVwglY 2x3FC4PBMnQyv5W2MW+ODJ0ek1FW8jl1E55tPSMr61CUHXZPPn7DLjGR5rsGj9WWRMYj F5Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084819; x=1698689619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4gXGK6fIVAMAIDlPSRafHxXOFGChnJBeeF+QM2JUpio=; b=EJlDCWHuRrOw/RqAVD2w4WVuhHli4LKDJIpAJtpHx9SdV8KtZF19lmSpQiBS1GsRgA RuZeOidkwDQi05Zy3XSk9SmRzI8fwAI3sA4GWS/GDgilAfUPp8c7vnWSCHQTpMie//Fh nVp4R3cZ/YnoPHOl8JpIm95fpDrxTSWK/7+wnq7uktdy9vMi5xS0vcSF62JiLdJE1BNv BrlW0BZitLYJlB51iCxPPeTow4AyHXdMIz0n+ZsVYzO7sS39Qj0HcPGa2Xe4tq0+uybm Iauq0Y/RMjoUfQI5xWAkeysgXAe4Fbmnlk68ezNHqABx8JLYxWciyBdOtJ2cE25mc6FR MBtw== X-Gm-Message-State: AOJu0Yy13vvblHKRvCN1RWePMRdEtcGwRQ5w5nhmkysnwzLEE6wrmYnf mlhVwugLxf+Nnr3ZTV1IFwXSinC0BV4SqbCVm3s= X-Received: by 2002:a62:f246:0:b0:691:27b:15b4 with SMTP id y6-20020a62f246000000b00691027b15b4mr16940176pfl.5.1698084819628; Mon, 23 Oct 2023 11:13:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 10/38] tcg/ppc: Use PLD in tcg_out_movi for constant pool Date: Mon, 23 Oct 2023 11:13:01 -0700 Message-Id: <20231023181329.171490-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 prefixed instruction has a pc-relative form to use here. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 34df9144cc..79e82d2f94 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -101,6 +101,10 @@ #define ALL_GENERAL_REGS 0xffffffffu #define ALL_VECTOR_REGS 0xffffffff00000000ull +#ifndef R_PPC64_PCREL34 +#define R_PPC64_PCREL34 132 +#endif + #define have_isel (cpuinfo & CPUINFO_ISEL) #ifndef CONFIG_SOFTMMU @@ -266,6 +270,19 @@ static bool reloc_pc14(tcg_insn_unit *src_rw, const tcg_insn_unit *target) return false; } +static bool reloc_pc34(tcg_insn_unit *src_rw, const tcg_insn_unit *target) +{ + const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); + ptrdiff_t disp = tcg_ptr_byte_diff(target, src_rx); + + if (disp == sextract64(disp, 0, 34)) { + src_rw[0] = (src_rw[0] & ~0x3ffff) | ((disp >> 16) & 0x3ffff); + src_rw[1] = (src_rw[1] & ~0xffff) | (disp & 0xffff); + return true; + } + return false; +} + /* test if a constant matches the constraint */ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) { @@ -696,6 +713,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, return reloc_pc14(code_ptr, target); case R_PPC_REL24: return reloc_pc24(code_ptr, target); + case R_PPC64_PCREL34: + return reloc_pc34(code_ptr, target); case R_PPC_ADDR16: /* * We are (slightly) abusing this relocation type. In particular, @@ -1155,6 +1174,11 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0)); return; } + if (have_isa_3_10) { + tcg_out_8ls_d(s, PLD, ret, 0, 0, 1); + new_pool_label(s, arg, R_PPC64_PCREL34, s->code_ptr - 2, 0); + return; + } if (have_isa_3_00) { tcg_out_addpcis(s, TCG_REG_TMP2, 0); new_pool_label(s, arg, R_PPC_REL14, s->code_ptr, 0); From patchwork Mon Oct 23 18:13:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737298 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665982wrl; Mon, 23 Oct 2023 11:18:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzb4g0hVcLh5/fE5zN7TPCNeJlsCeIPagqy7Xsj7vz9HCvePyZIfmv+8ZggqIVbqZTTEAa X-Received: by 2002:a05:620a:371a:b0:777:6c53:c090 with SMTP id de26-20020a05620a371a00b007776c53c090mr18797660qkb.24.1698085125030; Mon, 23 Oct 2023 11:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085125; cv=none; d=google.com; s=arc-20160816; b=AwDP2iIqLtnSICVM0GX8yt5VZvMyWx3fYUHk3yI1uuaDZQJ6iUFglre5T3YfL+/7Bw tTTAkcY9zcxjsrXKcJ1/WXSUJoWLvcruxu60gRTNPEKDsMTV9FvaToecs7tpPenUx3Nu RpWEuZ9RKIhVmu1n8FtNmetcG3GzoVlUcux9SRv1PWn9Ub/hmAr1KXGmebMryNoFX8tS dewl/YzHGzfIVU+WBeR/jUvQZpuk25Ut8Y9gaTO0bxofsysOvCmKqjdx6ziI/7AgLRkv cbgTy8+9pkHVqGwcKUM0XM6EVfFyE6S9uB0/0QTULE6TmdzGWCPqieRLYJ1WOGzz4Ukz 4QfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=F26bxUIQxkgWV1E1qWOesqhhe9aOqRjfrMzGNB91t/gQHj5bZuCuY9P8yu5qgC5yAE cPBfkEqd532owAOitjBdJeCsu5mMF2Bg5qCgt3jdgcremTNES293RrR7DBrPBd5EOEsa zo2DFUAu8hpXUjCBphgTXXgLeRJoaH0IGekwQcmuDDZcDEpVgPlevGvcLqv82Hgwv/Jt WXlTid+kb5Rss2t4IFiJNXd3iRpd1JfiHiCN77zpORl62JL3QvnLE66QfIbVYjBs5I5R a6xU2qcyERsr/9WsKv8Fj/L78twc24CPcSuEHJBJrej2OPgo8nc9vx2hujBwSLe5MD4H zY3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+XHAD7g; 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 ma12-20020a0562145b0c00b0066d1a15d84csi6266442qvb.414.2023.10.23.11.18.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+XHAD7g; 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 1quzQy-0005X7-40; Mon, 23 Oct 2023 14:13:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQw-0005Wo-Rt for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:46 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQs-00087Z-6B for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:46 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b44befac59so3379131b3a.0 for ; Mon, 23 Oct 2023 11:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084820; x=1698689620; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; b=H+XHAD7gxLwoPx27mxzQf3mtryZs+gXiGf2F39aXqpMBeFwqbwPDYBRLhTpyasWrKN dOtmA72Q//PBXgu+I5mdV3Xxr4n26h2wLsDUjjRrH7x1CCKR3xtDQGlAtXaBGupKGRM3 J1xMhgzItaLU0Tsp3nIcK535DaoBjE4EZustQ4aSzwySo6aBf9gNVUyyQNGhoVFiUhJp p4yS7ES4jV6fLZXIOtJoYvm1xht+aOZUvExIjtRG1IDFxvpGSzN2cP7iatGLvd+V6OR4 JSG30X22z2CpPRTXWkrAhIdB2VJhCUJq5JIFA0SsotK4RIDSEzxz7erkJDJXfmSA1jF0 ZPqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084820; x=1698689620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eJDwvSu5y6aQI1FUpLq82z/uiGp428KQX4VVdh13eIw=; b=JtA7Dasg8bdm4Ig5ggoy78uySmDwRjUcHv6wjta+33lESgwL880x9A77l2TCs6LRAL S5Ml55PWR8Nxbvowkyk54Vz0TEI1XzeAWodIiB7+t5roY4tVu3+VikBju7Q7+35TGM1c 7n2h8RFYeZ0tdSbzbFK2/m0C7b7q3DHtfvhyc/grIQFsBb+A8yWODH/xplMmixql6ej9 TngoPodM7AhQ+ShJqnu4uaf4II6p28tAvHdhJPrMw1KKmVvyQKlVJF6k8325vVWDMXCL aoBVrKbeafYpsin/IUst6/dmGJkYyO1gIO1vE/Rfxqfhr/nCWkhl9JgByTmgJnLdtcA7 DjMQ== X-Gm-Message-State: AOJu0YxSdjV5Brps5bbuN6GB5W/Cz65RpAmqUSw/rR3ILE/cDLm9Uejx SyBW8MbO0itnnmLxCcC1noHWpQq4eadbn9HTNfs= X-Received: by 2002:a05:6a00:35cd:b0:6b1:5d1a:bd0c with SMTP id dc13-20020a056a0035cd00b006b15d1abd0cmr17804558pfb.16.1698084820431; Mon, 23 Oct 2023 11:13:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 11/38] tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec Date: Mon, 23 Oct 2023 11:13:02 -0700 Message-Id: <20231023181329.171490-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 prefixed instructions have a pc-relative form to use here. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 79e82d2f94..db3212083b 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1242,6 +1242,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, if (USE_REG_TB) { rel = R_PPC_ADDR16; add = ppc_tbrel_diff(s, NULL); + } else if (have_isa_3_10) { + if (type == TCG_TYPE_V64) { + tcg_out_8ls_d(s, PLXSD, ret & 31, 0, 0, 1); + new_pool_label(s, val, R_PPC64_PCREL34, s->code_ptr - 2, 0); + } else { + tcg_out_8ls_d(s, PLXV, ret & 31, 0, 0, 1); + new_pool_l2(s, R_PPC64_PCREL34, s->code_ptr - 2, 0, val, val); + } + return; } else if (have_isa_3_00) { tcg_out_addpcis(s, TCG_REG_TMP1, 0); rel = R_PPC_REL14; From patchwork Mon Oct 23 18:13:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737282 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664907wrl; Mon, 23 Oct 2023 11:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMYyBQFkqkVt95xQHUhzKH2rW7wH7Ef7gxN462KUi92XhfHCTx92e5RJTvMguBPa6Kb+fI X-Received: by 2002:a05:6214:4119:b0:66d:4b22:f54b with SMTP id kc25-20020a056214411900b0066d4b22f54bmr13448815qvb.50.1698084980267; Mon, 23 Oct 2023 11:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084980; cv=none; d=google.com; s=arc-20160816; b=VPeu1XtUr4wnzSXpHEqgBS8b5u3ElaACUkWvljaakzC5CsEQFe/K4dORe1r75nI8W5 IUAd7rUsijRxrkQCQ0Il//xh9mmFFnevaJ2dlsk8zR2meXtNA4a/M5AUEzgsil++Bm++ 4Y/U5TiOzrYu4bdHuyeYjYjkJCOJVaMqS4CKfsHSQDvarFJeB24CeryrRVnC49pyHVJq Ox6IWSSagBMZ5ibHyRIKdcrt3Kujvnl4afWfzG1G6n+Hl1V4CtM0ayTn2hin16tjWSOS tUw1WX4e2ZKW9yr4XgmzSg3L816ViIc31UVcuFAelENgRSk+m/AlLaKsJ6huCgiIbfyp OvGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Hhb0elNUm9t5pbTXs3twl2xruqMvs4RX72JjJCBd63oqa9GjPJGbKRcdsU/8z5Q/q/ rAE31y9zqxhkcR13oOsebV0FLh2xfVu6nZ/gtoeKuKvD1mAB2a7nQlKhjRvreYWfvfLr vDbDAbstE528W+z+ihdkng483ckbhvxpFwHaJT4N/ZFd6ROyXp1T5kjNRvownCw4Ucs8 VCe/+v3DdJOzGcU7JxYaMJszFCoKaPZQ5rEx0siyJ8b2jexwbJ+zkZWBhb6YmB478/Vl eO5gvBkrZ6AUaiwdx5ujw2zAmH76Of0rPaeXNqr/P84ZiWN2EI0ebBpp+yofIvavQklx sPvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tt3QZt7C; 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 y12-20020ad445ac000000b0066d7ec3340asi5754990qvu.63.2023.10.23.11.16.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tt3QZt7C; 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 1quzQw-0005Wp-WD; Mon, 23 Oct 2023 14:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQw-0005WP-Am for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:46 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQt-00088I-4Z for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:46 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-581b6b93bd1so2157588eaf.1 for ; Mon, 23 Oct 2023 11:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084821; x=1698689621; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; b=tt3QZt7CI+2BW59gM8id5UbnrfraBt9KnC6AIfrHCZyhh/eEa09tL8LkRtiHuTgaEH XrjoGfH2N7puWXKrGrmmQPsvVU85YGYLwr3VuVqwGoVTd3FgtHxkMWJuhqnGzuTHZFbI +xW1wycHFPpJsBu7atQu4cQDnnByKRsOKZUqASE6kfmS8K+CyjNJF+55LKqCZQBkQl2o 6GqmNlL9IxgW6kdSz8VJ2t890TeybloAwXzFh7UQevM/t/YvCQZQHQbNBGpWEreF6S6g 0ufnR7UepzToRtFadLYSt6o1oRH3Krz/qaUwsiopWvqUObOQebvR9dPDNnRU97/GUr1c WJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084821; x=1698689621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Sq2XuaUgq1WVJLtCb9vCiBQv+e4IAv+CN8pWqHj0rc=; b=POzj/7zlLUpHsLCTS4ZzhfPqPIMFjH5vNQwFJQ0yKb0WYB5Rbn0exqE6pJQgeXXI8H 19u22bvmRDBZa9f8qa+iUllTNaZ6iAizLVC8N2W+c5MubzvX8wUkgrRIKE7vtn+lZLAe hDmCnxWWeZ7BCltQRNSK6gEpN2F+xgIHcFBraZusmKVxqUgiDbvJz+U42kP0JyqLOE8A DM1G7ZOUnSZgiOOwr+Rwh7WwE5bmb+MUNQZBxIEMdpnaYeM1ISMYvACsK6KwP9bL2f0v l/jdO8GEwexhaszIw6AaQCgYBuDszMFqk6oEwcrYy2sZ3QlPmm2zS0muaKwmu/HrMdSK Glbw== X-Gm-Message-State: AOJu0YyadwMzefvEtPnPeoMvw+vz85uKxqTGjBk+9Qx+Anu2TJz7u8NR V1tmIYmoUCRPu9j+oiJS7SeW1wQOV3ongvpu7nI= X-Received: by 2002:a05:6359:28c5:b0:168:cf01:8232 with SMTP id qb5-20020a05635928c500b00168cf018232mr5227032rwb.9.1698084821254; Mon, 23 Oct 2023 11:13:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 12/38] tcg/ppc: Use PLD in tcg_out_goto_tb Date: Mon, 23 Oct 2023 11:13:03 -0700 Message-Id: <20231023181329.171490-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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 Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index db3212083b..6496f76e41 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2753,6 +2753,9 @@ static void tcg_out_goto_tb(TCGContext *s, int which) if (USE_REG_TB) { ptrdiff_t offset = ppc_tbrel_diff(s, (void *)ptr); tcg_out_mem_long(s, LD, LDX, TCG_REG_TMP1, TCG_REG_TB, offset); + } else if (have_isa_3_10) { + ptrdiff_t offset = tcg_pcrel_diff_for_prefix(s, (void *)ptr); + tcg_out_8ls_d(s, PLD, TCG_REG_TMP1, 0, offset, 1); } else if (have_isa_3_00) { ptrdiff_t offset = tcg_pcrel_diff(s, (void *)ptr) - 4; lo = offset; From patchwork Mon Oct 23 18:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737277 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664810wrl; Mon, 23 Oct 2023 11:16:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENP65NF8yJdIuAz2SQHUH2Irewm3+kuQvw1pRFFS6Q/O3IWdPZBuMqXKgzz6aOwYIggWvR X-Received: by 2002:a05:622a:549:b0:419:573c:59a4 with SMTP id m9-20020a05622a054900b00419573c59a4mr15486531qtx.20.1698084966743; Mon, 23 Oct 2023 11:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084966; cv=none; d=google.com; s=arc-20160816; b=nJ8CKZnqTveuZ/dhxwXpQgmmNLiTYsQ+niCA3jELnGyn69bUgo47uqch2263dtX6u/ g/WPwvf+G26QL8WMDPSWmEDEZFSEHQIeOZZhMl4v6r7RrJmXY2zyWWCS6v4rTKeAofwU WXyqgJQCU0bi9anVIaRvO80vlcFXjEw9d2jp07/7xvzauGes3hL5ORXxpQbBz8zAMcsp kcjD0QZXbZNmcJE1ySEuoa1MAkOmzS8sxHXvXIsM2z3v4cV9qFGbVa8p0lQnZKbPuNpz nMJI+aPF5WGEzitZ9jdLi1A4Zsgr/PN+3Hx/pHRF0nXAIZ8UuJs0xCv5otTlqOEJ1RU+ GGqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lQQGqyFz4pYd0VGMK/d+OsDfZ2H159N4+ipYoxj5gf7FEsU7CNqOC0kXuwuE2cJPns pyWH7OtKtlvpAcIMP79ciUzn6AtpZxjYEL9u9CVVHZlXub5d5inijuQoQa0uI4C369H0 vAoyZsRjp8nCQmtSDaTJRlVkuvuv1r7YI8PnDcEAIqWCk/3FPm1+CWF7GsLklEobSVQ9 nvYRvvnK5aw/Jv5mIoOpfxJuk87w+r9M01/MSQ3pIjowXeaE/5pmkS+duFA9t56ALv5V bMvUQ3v8Oc4BgYonJ3buO5VSU5XUeuKl60hnjd9Ntm7mWlY8TOFtuPyGYAoFY3RF44xi 7oSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nuCWpYmX; 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 y6-20020a05622a120600b004128bd63451si6130892qtx.493.2023.10.23.11.16.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nuCWpYmX; 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 1quzR1-0005as-Qh; Mon, 23 Oct 2023 14:13:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR0-0005aU-Mi for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:50 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQt-00088l-M4 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:49 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6ba172c5f3dso2921250b3a.0 for ; Mon, 23 Oct 2023 11:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084822; x=1698689622; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; b=nuCWpYmXQ0Xa0byrZ6nhUREJCWoA3pbyLyP9W5uAVK8HcxTa4t5hE6NV8Ysqc4DHnB C0PkTisvoLSAnzAGq/37S8Q2hqcP3Dx7KRD+Y3y0OYfPbiJPwtode7n+cxTGYbctB9T0 4O+cxC/EZVei6swC/b70WNXlAGao0lweicPcgi831S/pVOnFdXq0qvLwBk/08ZYiHZ37 C4znF6mPRYErPeJoPNtPKuXDJZsOiORzLUX7kOQ1/K5/d7VC1WqGTF3HSs7+i4aqyUKj mWJ0ypPqQWYBsgMvqPmX0bLm6QWgm9IcSSEDORSjytBFx0CtMFYNd7kCfZFhlKhCow2s s7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084822; x=1698689622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wgo3sS5iUyrU0Dzdzk24htDnmRxHdeX5tUMGq3kg/oc=; b=A0lZpWptNEkhESgx0LVGaKUM6/SuhmpGfIgrqy1AtWS/kovsqE55eMP43X5nXnXOWn r96AP2j4hLKd0PY29b4QuZFni2LVPlEmGXPDBxnrGa2Arbsfw6Y9xrRQj0j68vWsT9cB 2ZFJzEQbc0mCyDrlnab4Ef/o5Ffco6TwIrc0ulG1CNsLZoe8wkmDhWJkXs+cZhNcI8jT GN4jPGy6f5cCQQ21e4ovkY+5hVwPGB48jsyt2Ozneq4Nt9wS4CQ68VSx6UhZ7LMYZN0/ Y1A1n1ypTCNvOm0egLwoVapc/yNNNay6dlRKor530I806npHDk52uOBTy3WVQUnuAUmt 0Xsg== X-Gm-Message-State: AOJu0Yw6HELxzxNPpGZouuWFf2m9sOH1xc7LnPprJ8SBOt1512yO97d1 S/RvOzeq37kE4vzwrnoYB34QohFYoRpZt6wurr4= X-Received: by 2002:a05:6a00:1a09:b0:6be:2dce:cf5a with SMTP id g9-20020a056a001a0900b006be2dcecf5amr7563022pfv.26.1698084822051; Mon, 23 Oct 2023 11:13:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 13/38] tcg/ppc: Disable TCG_REG_TB for Power9/Power10 Date: Mon, 23 Oct 2023 11:13:04 -0700 Message-Id: <20231023181329.171490-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 appears to slightly improve performance on power9/10. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 6496f76e41..c31da4da9d 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -83,7 +83,7 @@ #define TCG_VEC_TMP2 TCG_REG_V1 #define TCG_REG_TB TCG_REG_R31 -#define USE_REG_TB (TCG_TARGET_REG_BITS == 64) +#define USE_REG_TB (TCG_TARGET_REG_BITS == 64 && !have_isa_3_00) /* Shorthand for size of a pointer. Avoid promotion to unsigned. */ #define SZP ((int)sizeof(void *)) From patchwork Mon Oct 23 18:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737292 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665436wrl; Mon, 23 Oct 2023 11:17:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7PmFn2YwcpCa7V1kfyJD+DddG4d+D/nBHlezGE+suWVRGkA9Q5FRfpJ8AiNox2eagsNKu X-Received: by 2002:a05:6870:d08:b0:1e9:ae68:fda1 with SMTP id mk8-20020a0568700d0800b001e9ae68fda1mr10375275oab.1.1698085053719; Mon, 23 Oct 2023 11:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085053; cv=none; d=google.com; s=arc-20160816; b=fe3kshwP719pyhtIYAxEWSFTC+VgMBoIk1oWHM9cs2pFCt3vc4K/CzgN1eWJff7smj UDg+qf9IiZ6AwkFhTzLkc+P/yhHu5H45UqJhqdi1DziTQZ1viwI4c06B+K+LNU5ANdaq HqkPScPEuWsz3u45Hm6ltYc/mGnLEQ4SJxEEX5X4d5pElaquylh/s8vL3Un/AtPQapmo p3WKMS9GA5xDIumdprnKhFcDjMpKDIQsMqD6SLaTgwgvx/6bc3NAbtuEa8kbjtUDjc2Y RnzX+EoTgFNFvXEHWpxjnzsIpp0xYti2QNqFJfTO2u82hs3QGEDFH+Kx89ANf6pe0XJB BOLw== 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=VXDCPRqwkNHEWZB52f+OeRGLQD3oaL6U6LhW5ET5dXA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=M8bQ1AvrfYyVpyjwwl6JcQmtvygF46S8gg+KP8jY96harnSwQY7URNntlu/q16OlyR KruTW1z5LuQI6HYl0ILsJNrYebgmXhmBGomCqEZZaDLc79beQcaFXoNzQh+fx/t7nMry IciZlzbD+/RtKcnuh6J5FEE+PwVLHr1bD2nAqH8BhrV0WZMfEw3FqgPtXBumg8r5Df98 4Vs7dqTFl285qi5P8+C3bakiCii6upLce6U/Dj96vo3JJHicZBfk56Hl787sMmppbnxz 3L5+9nxCd2dlrTrnqEYTU1xGp3D9gna4bp2JfIFC5duxiU1DvG3FRGXfVHQXhQ+phUqL 257Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wIEsZnsl; 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 b17-20020ac85bd1000000b00419783cf7ebsi5945241qtb.532.2023.10.23.11.17.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wIEsZnsl; 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 1quzR0-0005aT-MR; Mon, 23 Oct 2023 14:13:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQx-0005Wx-3J for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:47 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQu-000892-8Q for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:46 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so2707269b3a.3 for ; Mon, 23 Oct 2023 11:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084823; x=1698689623; darn=nongnu.org; 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=VXDCPRqwkNHEWZB52f+OeRGLQD3oaL6U6LhW5ET5dXA=; b=wIEsZnslbevgiZPW+B53hhSGs4BF7V+7425Qi69BAK91QkZfmF6t+Aks1QQG/QMT7+ cCBckyUCQUXmHD6Zn1GC8pBnfNnwYxIAdhLDaWMT6csTTjf8HyZq5PbmOwYLfzK9qTCl Sgw80RcZDfUBMK2LdI8/shry2B1vrJ7cyyPM2OgE+qkoymZdJj50LKOrVKqBLYSTcE6/ 5Js+4zYRKSv0IF9f2YLx2ujCxaw4B1E+br+smnAdla6nEdSexRLVfIVipmZoiH76HXKi gaLp/TeZtCuMqtEahgyJ+z4Kq+GH5OFpaEdlQzjxTPo6BwGRP//lbGW8YiLkOorIq2I1 S1AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084823; x=1698689623; 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=VXDCPRqwkNHEWZB52f+OeRGLQD3oaL6U6LhW5ET5dXA=; b=r8mk/aFgxm0HFUmVTL8B3w3vPEQRRFMTjLQBGFR4BjDwObBEjj/rwdg11zYTux3DoF +WqKGfLuwnObhRHDw9C/i9Qt7Yyqa4zowVksp9Ry8vugNiIrDS/RUNuY0/lS6Jfxbpcg BysYCSAmk26Rt8unYQazJW9ijuOZpQ2rNpHCrGKiGxyNG+bjr/NVgW5a/Qb/4eSoxv46 tiz2asbPs+4wNPxAipeH9Q+JxR4wvbnRL/2NwQkFMBBalccJjXJAa4GDuPqNU3xIq12y KPYAujNTdL4zcgZsnn4pAi3hN4E4OEbdAd4lNg1XiD5OxcuvBqjS8QIfDIeaCqzhTOm8 jIvA== X-Gm-Message-State: AOJu0Yz7fnWNK4PuCykT6UOQ/JLuJHrpH6UG6EeptylvcCSsh2tE1b2s lub4qCUqrq+xJK1QxyPtTzohIyXWON4TK2sL8/c= X-Received: by 2002:a05:6a00:1881:b0:691:2d4:23b2 with SMTP id x1-20020a056a00188100b0069102d423b2mr8381417pfh.15.1698084822865; Mon, 23 Oct 2023 11:13:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 14/38] tcg: Introduce tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:05 -0700 Message-Id: <20231023181329.171490-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Begin disconnecting CONFIG_SOFTMMU from !CONFIG_USER_ONLY. Introduce a variable which can be set at startup to select one method or another for user-only. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 8 ++++++-- tcg/tcg-op-ldst.c | 14 +++++++------- tcg/tcg.c | 9 ++++++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 680ff00722..a9282cdcc6 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -488,11 +488,9 @@ struct TCGContext { int nb_ops; TCGType addr_type; /* TCG_TYPE_I32 or TCG_TYPE_I64 */ -#ifdef CONFIG_SOFTMMU int page_mask; uint8_t page_bits; uint8_t tlb_dyn_max_bits; -#endif uint8_t insn_start_words; TCGBar guest_mo; @@ -573,6 +571,12 @@ static inline bool temp_readonly(TCGTemp *ts) return ts->kind >= TEMP_FIXED; } +#ifdef CONFIG_USER_ONLY +extern bool tcg_use_softmmu; +#else +#define tcg_use_softmmu true +#endif + extern __thread TCGContext *tcg_ctx; extern const void *tcg_code_gen_epilogue; extern uintptr_t tcg_splitwx_diff; diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index df4f22c427..2b96687699 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -34,13 +34,13 @@ static void check_max_alignment(unsigned a_bits) { -#if defined(CONFIG_SOFTMMU) /* * The requested alignment cannot overlap the TLB flags. * FIXME: Must keep the count up-to-date with "exec/cpu-all.h". */ - tcg_debug_assert(a_bits + 5 <= tcg_ctx->page_bits); -#endif + if (tcg_use_softmmu) { + tcg_debug_assert(a_bits + 5 <= tcg_ctx->page_bits); + } } static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st) @@ -411,10 +411,11 @@ void tcg_gen_qemu_st_i64_chk(TCGv_i64 val, TCGTemp *addr, TCGArg idx, */ static bool use_two_i64_for_i128(MemOp mop) { -#ifdef CONFIG_SOFTMMU /* Two softmmu tlb lookups is larger than one function call. */ - return false; -#else + if (tcg_use_softmmu) { + return false; + } + /* * For user-only, two 64-bit operations may well be smaller than a call. * Determine if that would be legal for the requested atomicity. @@ -432,7 +433,6 @@ static bool use_two_i64_for_i128(MemOp mop) default: g_assert_not_reached(); } -#endif } static void canonicalize_memop_i128_as_i64(MemOp ret[2], MemOp orig) diff --git a/tcg/tcg.c b/tcg/tcg.c index 637b9e6870..d3a4a17ef2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -226,6 +226,10 @@ static TCGAtomAlign atom_and_align_for_opc(TCGContext *s, MemOp opc, MemOp host_atom, bool allow_two_ops) __attribute__((unused)); +#ifdef CONFIG_USER_ONLY +bool tcg_use_softmmu; +#endif + TCGContext tcg_init_ctx; __thread TCGContext *tcg_ctx; @@ -404,13 +408,12 @@ static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which) return (uintptr_t)tcg_splitwx_to_rx(&s->gen_tb->jmp_target_addr[which]); } -#if defined(CONFIG_SOFTMMU) && !defined(CONFIG_TCG_INTERPRETER) -static int tlb_mask_table_ofs(TCGContext *s, int which) +static int __attribute__((unused)) +tlb_mask_table_ofs(TCGContext *s, int which) { return (offsetof(CPUNegativeOffsetState, tlb.f[which]) - sizeof(CPUNegativeOffsetState)); } -#endif /* Signal overflow, starting over with fewer guest insns. */ static G_NORETURN From patchwork Mon Oct 23 18:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737285 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665115wrl; Mon, 23 Oct 2023 11:16:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuVQ3CT/LVrnEPmStInGAko1jZOkwuNpzRjLRjcdNSWF+SGDKGKJimR2NJpzSQ3cI6iuwa X-Received: by 2002:a05:620a:628f:b0:76c:ba25:a8f1 with SMTP id ov15-20020a05620a628f00b0076cba25a8f1mr11000580qkn.42.1698085011874; Mon, 23 Oct 2023 11:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085011; cv=none; d=google.com; s=arc-20160816; b=fdMSJGcG1ls+aga97xOzQu23GlNvfcsV3SIJY6hDpWqXNUiX95RiwHsc6MDdZ8DjGC au3trVr+lExpICOV+UJuJN9dR0XMS2zGz2LVAdkdYFRKGbPZ7yyzAskHFN1+PHWV3vAV LsOOSFdtqCFWaKtao206M5oJg9JsKviFvW8Bn9xj0sW9Pyy7+U0u3pLKK0PH0nCP3uZo 0jiWewvm0yTFN37bbKCZrtVa2n4x/AiDluvxq+yjhOK5mDEav04JiMo69joUNW6YW/Fn 4FGElnANsJfaBWdVBSnPXGXRZahqj9XZO4mPbmbYancZgwImdZsIsR7UYy9XDfT0dMac TAtA== 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=YGlbtLg90LV1uY25eQEYhNteHi+RQnuiWgmb0RTVS6Y=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=wKNfsO136v6viF6PxPFSZ/wcn+l8gCXkD4Q0/CYKxRJb4FEsmoCu/Zc3cRbmDdH3is /bEKES8PxjWiDORHkdZYSx8nO3CGzrpoMKi5cKeNZuNpS8nXpb8FE7UJAThl9CNOhhed +ts5/WarrcQ9CoeXZfTCx7j28zwOk3x6pdBFBkG6Va77mDV3IteN6v5GcF6txtwLbAed GFLoUK8DMI+oz0DQORYKbOL67fslCStK1WkNnVAEj9smVcU8GLDiZmDn1iePCtw7WlPo 9k6l25myRY+TQ15Oe8vqxTEPOQOV3YlknT+iHLXr/FIld7Cg36UbC8o4eAAO0vX2OjRC fDgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yo8Quzg4; 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 z19-20020a05620a101300b0076719299daasi5910537qkj.574.2023.10.23.11.16.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yo8Quzg4; 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 1quzRE-0005jt-E8; Mon, 23 Oct 2023 14:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR6-0005cO-MB for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:57 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQw-00089r-9o for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:55 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b20a48522fso2904354b3a.1 for ; Mon, 23 Oct 2023 11:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084824; x=1698689624; darn=nongnu.org; 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=YGlbtLg90LV1uY25eQEYhNteHi+RQnuiWgmb0RTVS6Y=; b=yo8Quzg4fhJuqGKXoXmb1KcezsIoY1RzKzhroa4fEjgaq4+hMqVCRPo/yWV7ynNSkf baY8ylj3lHKvEqakH1dMeNlgl9N/olXGDbnSPRGUjVkpb1jG+4GqnTU6d21KJjZ/nXC0 Dn0wCFg3x7dSI5tP3uXT80yEDyKqoYyjpb8BmIRQqngq6BFjIgsUtxEDDfEnal1njXee 1bUBax1R95Nfn+23PT9re2YLvcthlTxwrVfM4uX7IW73t5EQJnRs5ABRjNYF+lgykIzr QciyrrF2Vunp1vvcqganwwmJNrFp9NF7SlFyjJsfi/0D2YKj2KPg1IAl4mEni15WEkBY kqSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084824; x=1698689624; 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=YGlbtLg90LV1uY25eQEYhNteHi+RQnuiWgmb0RTVS6Y=; b=LDP+pIWYSM9oUOlnZp+bJz8ek3JP/+BpEtQ+NgkWTmdBPyeehA1+O+OF2aaKWWCKg1 PAlg5rzDYXyRdbDRjarCGwSUzMR+qqTN+nCgoPhmFPBJ10ZVA6+mhjAHKCby2iZtyXhD xTGqNEgZZfpNwJBSqU+V0hi3eR5KSIIP0nftXIcvEqESCInBllFMOUqwM4HCSPv38EzL xsPuD/9hPFfcGr9JAwdnrKZPi6Kbk7A1EW5UAh33748H7IAdr6UCMF9ar/oUJFMj9ifM JLI2ees1xKJOiYQk9Ts57qEMtqdgwCoxXTbxFKyi8LUdO5qlprD5NVDTjF0+198irkIV gs+A== X-Gm-Message-State: AOJu0Yy+24Qrmq3XS++Z1VEvaXsSNbksgTTU3EYVsC0f9htvFfNyPgdY Bz7CrFdkvSOS5KGncfnbmAW1O6p4LabEU867OTE= X-Received: by 2002:a05:6a20:3956:b0:15d:c274:2eb1 with SMTP id r22-20020a056a20395600b0015dc2742eb1mr476907pzg.10.1698084823859; Mon, 23 Oct 2023 11:13:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 15/38] tcg: Provide guest_base fallback for system mode Date: Mon, 23 Oct 2023 11:13:06 -0700 Message-Id: <20231023181329.171490-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Provide a define to allow !tcg_use_softmmu code paths to compile in system mode, but require elimination. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index d3a4a17ef2..35158a0846 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -178,6 +178,10 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece); static int tcg_out_ldst_finalize(TCGContext *s); #endif +#ifndef CONFIG_USER_ONLY +#define guest_base ({ qemu_build_not_reached(); (uintptr_t)0; }) +#endif + typedef struct TCGLdstHelperParam { TCGReg (*ra_gen)(TCGContext *s, const TCGLabelQemuLdst *l, int arg_reg); unsigned ntmp; From patchwork Mon Oct 23 18:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737264 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664042wrl; Mon, 23 Oct 2023 11:14:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeoTuVxYCVkLuCStlOdyI8kkVAEgF61/3Dg0kyxVTyusqxH4t2v3pUOJSy07nOqt4G7u3d X-Received: by 2002:a05:6214:2121:b0:66d:48e4:9928 with SMTP id r1-20020a056214212100b0066d48e49928mr14350957qvc.12.1698084859136; Mon, 23 Oct 2023 11:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084859; cv=none; d=google.com; s=arc-20160816; b=BI/YPHY1kNZWcMy9NNvw3vWn63zDBLe0BQujaqXuHSuhJ0xWpaQ8oiUvv4rO2JZvXO ZnzUB0Zy8x6rfwyfrqdUaSO7wbjFz+y9VK0qQHdjUoeOo1mp+T6HnYusvnW8MWXX9tn4 T8Dd7cxabE556DJbZx4m58uqlSN/Ti4GUTiueEbcf/DA8GR481hI92Qz+7nn2GLjCmMN K5YMBcv+wLpd7phGJ8/wlZPcOBgt2i4ZXfGpsbHdHRM3/5vTJDA+icV4RJEOFdJ34v9F QWIERdmc6o1Oj8o7zepR6S4oBdQj3T3R5j9zY5l/5UBA5v6nQUVhWVzeCOulbnMO0xJb osbw== 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=Z5Y3YpkqSuB++PQnHqXwQCPjLyzdqqH8F+jPD48ZrG4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=Bf+PfBPmmHAtKUyV9xsnRtuwqazWoIC5Nl4wgxfOfVEkpkzN4ecD2oktHXsU2hubgb Ar+3Y/P9NGS3gHuEyV4XBDBizXDH31rX7hTuap5SQdGlvTLCrSFCpol6NOEvhNSvg378 JPG51xum+WbW6TmJkS4E9cC1DG0777Y82nsEsLsU31oXesCKa6hlDpl37XTM/EmVLcfg kugEOAa5sP3m6oDbhmXrUVMHvf+QvPjDQ7/sQPNyaqw7kJWTC1auNAi4jjdH1HSp0932 deFI/cBVvHIA0qSE6dnYnuYiM7eKjgs4eIDKl4Il/FYZ4uilRdCql+cjoqV7Sz5/VnRN erKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KSl/5A2X"; 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 k13-20020a05621414ed00b0066ae8d61642si5866969qvw.435.2023.10.23.11.14.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KSl/5A2X"; 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 1quzR9-0005cq-Na; Mon, 23 Oct 2023 14:14:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQy-0005XE-FJ for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:48 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQw-0008AX-8M for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:48 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6bd96cfb99cso2758396b3a.2 for ; Mon, 23 Oct 2023 11:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084825; x=1698689625; darn=nongnu.org; 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=Z5Y3YpkqSuB++PQnHqXwQCPjLyzdqqH8F+jPD48ZrG4=; b=KSl/5A2X39xFAh5l8Zb1xCIFq3vaBnkR4+5+IzIWlIgXRXzphx68bCoHStU6iGXFs7 b0oNg106pKI2VRndYP1YaoKZBUDYguXmCHcdDd+tGghIsU4JQbxgpLd9gn2hzC6c2Xvl TeL0SFg4FAOa1F08rmTEhQBYSqPpsf5d7At8RloPTcmQRcEK+SWWDU5hudOk193Cb4nl Xk36gH0yq//SvjaaXiuyMXYBEmUv0j6/Mv9kkBuFKEvujmCHc2iPSS6Hr+M7P3Xi3T0T SM1YAkTdqHrxNt0+cZGmecGHy0FIKAlegJuC4tzgFGMKhytoda7kz2daRLcQg+VtF9Df +jCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084825; x=1698689625; 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=Z5Y3YpkqSuB++PQnHqXwQCPjLyzdqqH8F+jPD48ZrG4=; b=IuzYWYARebp7XR9Is8eaOM6e0AMne+LY0mX5MsS31AK5/1aSmWUp22oZ6lU1wVDtIz SnYabhLqqwbKxPss9jhyDyVexxHxyaWNd89dQ9HjiEOqhuf4OgbUzR328GwuDzSdyHfO t/OSJ3QjILp65kw22Lf68iCjnCo2yMHsJzLU9vXV5sjdny64BKQO86gQXpqhtLPn3mTG EkHAtECQk2D8wzUtuud4nk3VXoHJMYWIGLdomiLFku0oovOmNARt/bIBhxCAsWyc3mmg nQMaOwgRXKh8Uzb4QOkKTZpIxas4UQRXppx6/9IB1iaEhQyQaAtVxSezYewYY4MrW46S BaHA== X-Gm-Message-State: AOJu0YzFtrmhtq6OrL4gpCdp+VCojte3ox3GgJOcAvLjj7rWLASu1yCy Ef7k3TNet+YBo2qGRpp3Aazg9EapsH36QRpi3Ns= X-Received: by 2002:a05:6a21:7787:b0:171:c88a:8927 with SMTP id bd7-20020a056a21778700b00171c88a8927mr361584pzc.29.1698084824756; Mon, 23 Oct 2023 11:13:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 16/38] tcg/arm: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:07 -0700 Message-Id: <20231023181329.171490-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 203 +++++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 106 deletions(-) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 0d9c2d157b..fc78566494 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -89,9 +89,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) #define TCG_REG_TMP TCG_REG_R12 #define TCG_VEC_TMP TCG_REG_Q15 -#ifndef CONFIG_SOFTMMU #define TCG_REG_GUEST_BASE TCG_REG_R11 -#endif typedef enum { COND_EQ = 0x0, @@ -356,14 +354,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, * r0-r3 will be overwritten when reading the tlb entry (system-mode only); * r14 will be overwritten by the BLNE branching to the slow path. */ -#ifdef CONFIG_SOFTMMU #define ALL_QLDST_REGS \ - (ALL_GENERAL_REGS & ~((1 << TCG_REG_R0) | (1 << TCG_REG_R1) | \ - (1 << TCG_REG_R2) | (1 << TCG_REG_R3) | \ - (1 << TCG_REG_R14))) -#else -#define ALL_QLDST_REGS (ALL_GENERAL_REGS & ~(1 << TCG_REG_R14)) -#endif + (ALL_GENERAL_REGS & ~((tcg_use_softmmu ? 0xf : 0) | (1 << TCG_REG_R14))) /* * ARM immediates for ALU instructions are made of an unsigned 8-bit @@ -1387,113 +1379,115 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, MemOp opc = get_memop(oi); unsigned a_mask; -#ifdef CONFIG_SOFTMMU - *h = (HostAddress){ - .cond = COND_AL, - .base = addrlo, - .index = TCG_REG_R1, - .index_scratch = true, - }; -#else - *h = (HostAddress){ - .cond = COND_AL, - .base = addrlo, - .index = guest_base ? TCG_REG_GUEST_BASE : -1, - .index_scratch = false, - }; -#endif + if (tcg_use_softmmu) { + *h = (HostAddress){ + .cond = COND_AL, + .base = addrlo, + .index = TCG_REG_R1, + .index_scratch = true, + }; + } else { + *h = (HostAddress){ + .cond = COND_AL, + .base = addrlo, + .index = guest_base ? TCG_REG_GUEST_BASE : -1, + .index_scratch = false, + }; + } h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false); a_mask = (1 << h->aa.align) - 1; -#ifdef CONFIG_SOFTMMU - int mem_index = get_mmuidx(oi); - int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write); - int fast_off = tlb_mask_table_ofs(s, mem_index); - unsigned s_mask = (1 << (opc & MO_SIZE)) - 1; - TCGReg t_addr; + if (tcg_use_softmmu) { + int mem_index = get_mmuidx(oi); + int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write); + int fast_off = tlb_mask_table_ofs(s, mem_index); + unsigned s_mask = (1 << (opc & MO_SIZE)) - 1; + TCGReg t_addr; - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addrlo; - ldst->addrhi_reg = addrhi; + ldst = new_ldst_label(s); + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addrlo; + ldst->addrhi_reg = addrhi; - /* Load cpu->neg.tlb.f[mmu_idx].{mask,table} into {r0,r1}. */ - QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, mask) != 0); - QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, table) != 4); - tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_AREG0, fast_off); + /* Load cpu->neg.tlb.f[mmu_idx].{mask,table} into {r0,r1}. */ + QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, mask) != 0); + QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, table) != 4); + tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_AREG0, fast_off); - /* Extract the tlb index from the address into R0. */ - tcg_out_dat_reg(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R0, addrlo, - SHIFT_IMM_LSR(s->page_bits - CPU_TLB_ENTRY_BITS)); + /* Extract the tlb index from the address into R0. */ + tcg_out_dat_reg(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R0, addrlo, + SHIFT_IMM_LSR(s->page_bits - CPU_TLB_ENTRY_BITS)); - /* - * Add the tlb_table pointer, creating the CPUTLBEntry address in R1. - * Load the tlb comparator into R2/R3 and the fast path addend into R1. - */ - QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); - if (cmp_off == 0) { - if (s->addr_type == TCG_TYPE_I32) { - tcg_out_ld32_rwb(s, COND_AL, TCG_REG_R2, TCG_REG_R1, TCG_REG_R0); + /* + * Add the tlb_table pointer, creating the CPUTLBEntry address in R1. + * Load the tlb comparator into R2/R3 and the fast path addend into R1. + */ + QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); + if (cmp_off == 0) { + if (s->addr_type == TCG_TYPE_I32) { + tcg_out_ld32_rwb(s, COND_AL, TCG_REG_R2, + TCG_REG_R1, TCG_REG_R0); + } else { + tcg_out_ldrd_rwb(s, COND_AL, TCG_REG_R2, + TCG_REG_R1, TCG_REG_R0); + } } else { - tcg_out_ldrd_rwb(s, COND_AL, TCG_REG_R2, TCG_REG_R1, TCG_REG_R0); + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, + TCG_REG_R1, TCG_REG_R1, TCG_REG_R0, 0); + if (s->addr_type == TCG_TYPE_I32) { + tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + } else { + tcg_out_ldrd_8(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + } } - } else { - tcg_out_dat_reg(s, COND_AL, ARITH_ADD, - TCG_REG_R1, TCG_REG_R1, TCG_REG_R0, 0); - if (s->addr_type == TCG_TYPE_I32) { - tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + + /* Load the tlb addend. */ + tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R1, + offsetof(CPUTLBEntry, addend)); + + /* + * Check alignment, check comparators. + * Do this in 2-4 insns. Use MOVW for v7, if possible, + * to reduce the number of sequential conditional instructions. + * Almost all guests have at least 4k pages, which means that we need + * to clear at least 9 bits even for an 8-byte memory, which means it + * isn't worth checking for an immediate operand for BIC. + * + * For unaligned accesses, test the page of the last unit of alignment. + * This leaves the least significant alignment bits unchanged, and of + * course must be zero. + */ + t_addr = addrlo; + if (a_mask < s_mask) { + t_addr = TCG_REG_R0; + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, t_addr, + addrlo, s_mask - a_mask); + } + if (use_armv7_instructions && s->page_bits <= 16) { + tcg_out_movi32(s, COND_AL, TCG_REG_TMP, ~(s->page_mask | a_mask)); + tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, + t_addr, TCG_REG_TMP, 0); + tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, + TCG_REG_R2, TCG_REG_TMP, 0); } else { - tcg_out_ldrd_8(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + if (a_mask) { + tcg_debug_assert(a_mask <= 0xff); + tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, a_mask); + } + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, t_addr, + SHIFT_IMM_LSR(s->page_bits)); + tcg_out_dat_reg(s, (a_mask ? COND_EQ : COND_AL), ARITH_CMP, + 0, TCG_REG_R2, TCG_REG_TMP, + SHIFT_IMM_LSL(s->page_bits)); } - } - /* Load the tlb addend. */ - tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R1, - offsetof(CPUTLBEntry, addend)); - - /* - * Check alignment, check comparators. - * Do this in 2-4 insns. Use MOVW for v7, if possible, - * to reduce the number of sequential conditional instructions. - * Almost all guests have at least 4k pages, which means that we need - * to clear at least 9 bits even for an 8-byte memory, which means it - * isn't worth checking for an immediate operand for BIC. - * - * For unaligned accesses, test the page of the last unit of alignment. - * This leaves the least significant alignment bits unchanged, and of - * course must be zero. - */ - t_addr = addrlo; - if (a_mask < s_mask) { - t_addr = TCG_REG_R0; - tcg_out_dat_imm(s, COND_AL, ARITH_ADD, t_addr, - addrlo, s_mask - a_mask); - } - if (use_armv7_instructions && s->page_bits <= 16) { - tcg_out_movi32(s, COND_AL, TCG_REG_TMP, ~(s->page_mask | a_mask)); - tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, - t_addr, TCG_REG_TMP, 0); - tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R2, TCG_REG_TMP, 0); - } else { - if (a_mask) { - tcg_debug_assert(a_mask <= 0xff); - tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, a_mask); + if (s->addr_type != TCG_TYPE_I32) { + tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R3, addrhi, 0); } - tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, t_addr, - SHIFT_IMM_LSR(s->page_bits)); - tcg_out_dat_reg(s, (a_mask ? COND_EQ : COND_AL), ARITH_CMP, - 0, TCG_REG_R2, TCG_REG_TMP, - SHIFT_IMM_LSL(s->page_bits)); - } - - if (s->addr_type != TCG_TYPE_I32) { - tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R3, addrhi, 0); - } -#else - if (a_mask) { + } else if (a_mask) { ldst = new_ldst_label(s); ldst->is_ld = is_ld; ldst->oi = oi; @@ -1505,7 +1499,6 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, /* tst addr, #mask */ tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, a_mask); } -#endif return ldst; } @@ -2931,12 +2924,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); -#ifndef CONFIG_SOFTMMU - if (guest_base) { + if (!tcg_use_softmmu && guest_base) { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, guest_base); tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE); } -#endif tcg_out_b_reg(s, COND_AL, tcg_target_call_iarg_regs[1]); From patchwork Mon Oct 23 18:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737274 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664594wrl; Mon, 23 Oct 2023 11:15:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpowwLNqrtqDE6MIlFSFiNymda82EYxyii6QJqtSoMbneBGVEOdDDUdM2PqDKB9ZUpIbTE X-Received: by 2002:a67:c095:0:b0:452:80b7:a09c with SMTP id x21-20020a67c095000000b0045280b7a09cmr6638449vsi.19.1698084939997; Mon, 23 Oct 2023 11:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084939; cv=none; d=google.com; s=arc-20160816; b=hVN5D3VZuFAybtIKY1GDpkm3AbtQ6xmeK6oRc6CrhWQSOXsNgiD3dIBAJCT142Qb+C +ZucNJUaEQz6HawYI0R6vFl30T9L2hObzhUH825OJdZ7XZ8dNc92B9ssNWLa7nYEa7Uq vItOciktQMDRgvzC2qfUXZQI83mfAcYy1n8Zqs6UNpdnctJGTV4jNeeiuHml5ZaHX2JV EJZqhfsMqlDyMGiPae1cVjSFWh48Knf4Wtg7k401E8Rb0S8NNEH5neFlr+paiR/M2Lga mLIjHZdGNdnSi6gjqfjQHGSRqPubvy18kZzMtPkq9PaUM0bXbs3Fup7CPGPY6JiYpu9+ fBQQ== 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=H+PnCNXxM75sZlgHHFx2OEqwx4bspJhNCS0HMsehl/Y=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=dPBRsGcp+uSfnLrw2fp4W12n07PgPJl+zp/VfLqLcan1qEkQgOS9ENHn7EaXwz4NYW ypEBPcqh3M6Or01EFJNOFmDpzUE1NqfS+c0rf9gPX1NDqjlb0cXSVi7vrGLjAwUUYKcZ QfvxON8AO+xcH6Rs50e2Pu04Pf7shWZueecHZ4FN1WaFNge0dFXzKiV6d5syRNgMbkj7 PU/4sk6dvl4dfhOF6v18qRnRDolBON9TakvsSlY1GzhaRbxSE8JYpaLL2WeoACfPby6d Xivts+Cn41p8CMo+6809AO1ycCUogbLUis23vfFwHOLccRF0VJw0MzoCh/bs1i5uGu5h moJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tDRknbAV; 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 b5-20020a05620a118500b0076da9a05a45si5964352qkk.134.2023.10.23.11.15.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tDRknbAV; 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 1quzRA-0005fb-AR; Mon, 23 Oct 2023 14:14:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQz-0005Y8-2N for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:49 -0400 Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQx-0008B6-4t for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:48 -0400 Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-583552eafd3so1945340eaf.0 for ; Mon, 23 Oct 2023 11:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084826; x=1698689626; darn=nongnu.org; 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=H+PnCNXxM75sZlgHHFx2OEqwx4bspJhNCS0HMsehl/Y=; b=tDRknbAVpuAijBJZ3ciFzBLOBG0Szsk0s2BPO+NemsfHakJrfodj4jlTbZwxzPirdJ lw7kF1RXqFmXXZ+y5g265NYJenV+1MBFdVQhOQaOY+CVCIb1Ld7SvvHgdHxzwr4ehRh2 sTslmD9f4NPYiyidS/Y9680y70oj+6ymUL75DsYK0z1aDowHmqUwYULsP7NeJode3YUr 3lCUjTZtKzcmB8CSu9PRNg2DgJ1s9ddbLtOYUOvRdUJPPGrX8UK+PqehEI7y1b/tMOuX eieKQAAiMkl3QP/9E3iuvV0d2OFgBBTDOnIO2lAhKVqQfb9Xvka5cRKWOGvP0pLsCa9W U7WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084826; x=1698689626; 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=H+PnCNXxM75sZlgHHFx2OEqwx4bspJhNCS0HMsehl/Y=; b=tKSAzXb5Qa9F1Ia3VGwi9py8nuF2YO908XzNShg2DmwbDT/A0zJ6Q3iEn18WpP8H57 eFBN6PEOumzqcMCYwYUNfLb/B/VHMUKfzhVFQ+KFq+DkgBfhC0Nfxq8uV930IUFCHabL ABTyt+v3q8a51gMoLro1MTAf/NbP/EmXlmRNivKMDurSSiEW4MpJLmwLVeRihCRhkfXC d/eInxkvgrjaXToekBYnGNtTFz4sp+/05jeYxGMuYz0aL7oIGaj/7qE1T/S/2f+qsI5I tBcOYauhm8skc6hSZSv9WfQHK/bRHEVApBwCebsnAo6Z+7Nex+sqQVyEa30EoYjPavkJ hU5A== X-Gm-Message-State: AOJu0YwVGqJew4TqdfqgdKiEhwEoLbvxY/rWVC9WoUUoMcZ0YKu1L/IY x77GWGpE6ylkLlerXTTxfGChJNlgsBU3GwHWwhw= X-Received: by 2002:a05:6359:6a2:b0:168:ec55:d164 with SMTP id ei34-20020a05635906a200b00168ec55d164mr1028207rwb.25.1698084825796; Mon, 23 Oct 2023 11:13:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 17/38] tcg/aarch64: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:08 -0700 Message-Id: <20231023181329.171490-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c35; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc35.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 177 +++++++++++++++++------------------ 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 3afb896a3a..a3efa1e67a 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -77,9 +77,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) #define TCG_REG_TMP2 TCG_REG_X30 #define TCG_VEC_TMP0 TCG_REG_V31 -#ifndef CONFIG_SOFTMMU #define TCG_REG_GUEST_BASE TCG_REG_X28 -#endif static bool reloc_pc26(tcg_insn_unit *src_rw, const tcg_insn_unit *target) { @@ -1664,97 +1662,98 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; -#ifdef CONFIG_SOFTMMU - unsigned s_mask = (1u << s_bits) - 1; - unsigned mem_index = get_mmuidx(oi); - TCGReg addr_adj; - TCGType mask_type; - uint64_t compare_mask; + if (tcg_use_softmmu) { + unsigned s_mask = (1u << s_bits) - 1; + unsigned mem_index = get_mmuidx(oi); + TCGReg addr_adj; + TCGType mask_type; + uint64_t compare_mask; - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addr_reg; - - mask_type = (s->page_bits + s->tlb_dyn_max_bits > 32 - ? TCG_TYPE_I64 : TCG_TYPE_I32); - - /* Load cpu->neg.tlb.f[mmu_idx].{mask,table} into {tmp0,tmp1}. */ - QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, mask) != 0); - QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, table) != 8); - tcg_out_insn(s, 3314, LDP, TCG_REG_TMP0, TCG_REG_TMP1, TCG_AREG0, - tlb_mask_table_ofs(s, mem_index), 1, 0); - - /* Extract the TLB index from the address into X0. */ - tcg_out_insn(s, 3502S, AND_LSR, mask_type == TCG_TYPE_I64, - TCG_REG_TMP0, TCG_REG_TMP0, addr_reg, - s->page_bits - CPU_TLB_ENTRY_BITS); - - /* Add the tlb_table pointer, forming the CPUTLBEntry address in TMP1. */ - tcg_out_insn(s, 3502, ADD, 1, TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP0); - - /* Load the tlb comparator into TMP0, and the fast path addend into TMP1. */ - QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); - tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP1, - is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write)); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, - offsetof(CPUTLBEntry, addend)); - - /* - * For aligned accesses, we check the first byte and include the alignment - * bits within the address. For unaligned access, we check that we don't - * cross pages using the address of the last byte of the access. - */ - if (a_mask >= s_mask) { - addr_adj = addr_reg; - } else { - addr_adj = TCG_REG_TMP2; - tcg_out_insn(s, 3401, ADDI, addr_type, - addr_adj, addr_reg, s_mask - a_mask); - } - compare_mask = (uint64_t)s->page_mask | a_mask; - - /* Store the page mask part of the address into TMP2. */ - tcg_out_logicali(s, I3404_ANDI, addr_type, TCG_REG_TMP2, - addr_adj, compare_mask); - - /* Perform the address comparison. */ - tcg_out_cmp(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, 0); - - /* If not equal, we jump to the slow path. */ - ldst->label_ptr[0] = s->code_ptr; - tcg_out_insn(s, 3202, B_C, TCG_COND_NE, 0); - - h->base = TCG_REG_TMP1; - h->index = addr_reg; - h->index_ext = addr_type; -#else - if (a_mask) { ldst = new_ldst_label(s); - ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addr_reg; - /* tst addr, #mask */ - tcg_out_logicali(s, I3404_ANDSI, 0, TCG_REG_XZR, addr_reg, a_mask); + mask_type = (s->page_bits + s->tlb_dyn_max_bits > 32 + ? TCG_TYPE_I64 : TCG_TYPE_I32); - /* b.ne slow_path */ + /* Load cpu->neg.tlb.f[mmu_idx].{mask,table} into {tmp0,tmp1}. */ + QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, mask) != 0); + QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, table) != 8); + tcg_out_insn(s, 3314, LDP, TCG_REG_TMP0, TCG_REG_TMP1, TCG_AREG0, + tlb_mask_table_ofs(s, mem_index), 1, 0); + + /* Extract the TLB index from the address into X0. */ + tcg_out_insn(s, 3502S, AND_LSR, mask_type == TCG_TYPE_I64, + TCG_REG_TMP0, TCG_REG_TMP0, addr_reg, + s->page_bits - CPU_TLB_ENTRY_BITS); + + /* Add the tlb_table pointer, forming the CPUTLBEntry address. */ + tcg_out_insn(s, 3502, ADD, 1, TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP0); + + /* Load the tlb comparator into TMP0, and the fast path addend. */ + QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); + tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP1, + is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write)); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, + offsetof(CPUTLBEntry, addend)); + + /* + * For aligned accesses, we check the first byte and include + * the alignment bits within the address. For unaligned access, + * we check that we don't cross pages using the address of the + * last byte of the access. + */ + if (a_mask >= s_mask) { + addr_adj = addr_reg; + } else { + addr_adj = TCG_REG_TMP2; + tcg_out_insn(s, 3401, ADDI, addr_type, + addr_adj, addr_reg, s_mask - a_mask); + } + compare_mask = (uint64_t)s->page_mask | a_mask; + + /* Store the page mask part of the address into TMP2. */ + tcg_out_logicali(s, I3404_ANDI, addr_type, TCG_REG_TMP2, + addr_adj, compare_mask); + + /* Perform the address comparison. */ + tcg_out_cmp(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, 0); + + /* If not equal, we jump to the slow path. */ ldst->label_ptr[0] = s->code_ptr; tcg_out_insn(s, 3202, B_C, TCG_COND_NE, 0); - } - if (guest_base || addr_type == TCG_TYPE_I32) { - h->base = TCG_REG_GUEST_BASE; + h->base = TCG_REG_TMP1; h->index = addr_reg; h->index_ext = addr_type; } else { - h->base = addr_reg; - h->index = TCG_REG_XZR; - h->index_ext = TCG_TYPE_I64; + if (a_mask) { + ldst = new_ldst_label(s); + + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addr_reg; + + /* tst addr, #mask */ + tcg_out_logicali(s, I3404_ANDSI, 0, TCG_REG_XZR, addr_reg, a_mask); + + /* b.ne slow_path */ + ldst->label_ptr[0] = s->code_ptr; + tcg_out_insn(s, 3202, B_C, TCG_COND_NE, 0); + } + + if (guest_base || addr_type == TCG_TYPE_I32) { + h->base = TCG_REG_GUEST_BASE; + h->index = addr_reg; + h->index_ext = addr_type; + } else { + h->base = addr_reg; + h->index = TCG_REG_XZR; + h->index_ext = TCG_TYPE_I64; + } } -#endif return ldst; } @@ -3117,16 +3116,16 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_set_frame(s, TCG_REG_SP, TCG_STATIC_CALL_ARGS_SIZE, CPU_TEMP_BUF_NLONGS * sizeof(long)); -#if !defined(CONFIG_SOFTMMU) - /* - * Note that XZR cannot be encoded in the address base register slot, - * as that actually encodes SP. Depending on the guest, we may need - * to zero-extend the guest address via the address index register slot, - * therefore we need to load even a zero guest base into a register. - */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, guest_base); - tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE); -#endif + if (!tcg_use_softmmu) { + /* + * Note that XZR cannot be encoded in the address base register slot, + * as that actually encodes SP. Depending on the guest, we may need + * to zero-extend the guest address via the address index register slot, + * therefore we need to load even a zero guest base into a register. + */ + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, guest_base); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE); + } tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out_insn(s, 3207, BR, tcg_target_call_iarg_regs[1]); From patchwork Mon Oct 23 18:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737281 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664883wrl; Mon, 23 Oct 2023 11:16:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkVZ6HjhnWJi7+vOfqEesXTMZBNKeIInh/LlhceFPGALuQqbB7rHlLM1Hgnc2+fV1gDYct X-Received: by 2002:a05:620a:3710:b0:767:82e8:eb88 with SMTP id de16-20020a05620a371000b0076782e8eb88mr12093361qkb.7.1698084977475; Mon, 23 Oct 2023 11:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084977; cv=none; d=google.com; s=arc-20160816; b=1FmsI8/GvVKcBFY00gRn63I33Fqe5c3Ov8VT75G+4HCU5FPOhM8Z0N1TE0HqhoVd9T f/WMU2TSQCEc48kzWUtZH7DTQTTsFNM1KS6nl0DFadaWV4whkai9yFVz9tSEeaAI/R41 BPgarbA/Utx3rtkKT7Ui29qBU5ABROd9gLmLV+G+4+xTi5S5toHue9WHhU41DTjhnx79 CCMs1M3jVHd7TBXYDArRQjRqhuL87UKyCElq6rwLDsFviqc+quDc2if+yjYEolXeIRRy TtJPEU53fdw/KMxZW4qv1zAV96fnPoPLtyyINaZLndEzroRDJs60itqM00laviynLkcJ BK9g== 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=WWoQZ73KhTN/ADC9+C/3f9sBjz2oSl2r5ie5s835XCE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=jTp1jqTdRcsnoohZcSbkHg/uImf9C00XsdTXcQZQTCFc8d1b4dk92V6X3E4T5zT2Sx QQCs5+Qh51eZYYZ5YPgUK2J/MDgZEh7XfQoAlG9piuLmnUBAAxb2QeJ8m77RWaDKqUvr 9XBFbNo8uQYbQePFJ5mM8tTI3SbYyktI9jyQtpzJg2yYQ2cLQHjAdnzcSVrsX1kcdKhM c+eE0LQbJX8LnNYCptMYg6xkTpq/IjKT6dBMXPEMCHYrl8ApBZgVpuCWOl1rHEVSaUKj JoIRgL55v5jQCa3pPBQT8GGWfppnfUDO6M7u9WySJaAnVXCirNgWhStE1z9CXAXkZ9Xp heBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xd9TXPtM; 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 p21-20020a05620a113500b007788cced177si5527334qkk.524.2023.10.23.11.16.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xd9TXPtM; 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 1quzRD-0005hx-Oy; Mon, 23 Oct 2023 14:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzQz-0005aK-Ox for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:49 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQx-0008BY-PS for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:49 -0400 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-357ccaf982eso9113325ab.0 for ; Mon, 23 Oct 2023 11:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084826; x=1698689626; darn=nongnu.org; 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=WWoQZ73KhTN/ADC9+C/3f9sBjz2oSl2r5ie5s835XCE=; b=xd9TXPtMY7/Zvx7MaOpoLKrWTOwrarm8wulW5Ke019gDlj+7D/hnRiiG+2NnQZn71P HIXCQbKLdROsFpLvdamL3HaU9g3lusFC0KbxwARax2oh2kFxNLCBivwU0wkEv5rKZ+mZ UIn8OpHwKyhJyzpVSCipu+2+JpSVMjPJLO0c9TnxrwrNz/a0PwHv0ORP7m8P4DxTuaeQ MF1PWND7efSFuZ0CcO8h8uhAiX9SnJdAgRF2G0ELM3mdOOWxNRHZiiQVaq9cpb/nBKk0 rweopDrh17qya2a4N4hRm2qetSGB/bKUXjaiSCz6HPKrqMpGN9MYRqHCYX69ttPH/tn6 +64w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084826; x=1698689626; 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=WWoQZ73KhTN/ADC9+C/3f9sBjz2oSl2r5ie5s835XCE=; b=nXRQ74JmOGHOtIgcqtoiPZ+5x9SI7ByFO4gUwLIXhVKvHbfTr6uWX4YjNx1MrHVR/F ML/nIxMkakn9U8ZN+4YEytI40XjZUt2sEBIUNAmB+u0yQLJTb/duepsPmfmTCnQDGDx3 r72pTQZAannHxvWMixUru4DrjZNFMOKAxdry/dCrl/rcMX9+nFScbx1IWW69gLByzHqR wBIw2xic9eHA+DwGSo4waaoaaV3XGHzDMDFbJs7SmeV46VaYxSYilRLFumJEnrl6C97D LQ9djbUz40YmVLSZcg1LgpyI35l2CYROzU0AZhzwjKyZXxQ4ENA7Uky0cw4kD7WBkNnk jSew== X-Gm-Message-State: AOJu0YyBJp/z/PQjzkp4iMQzUxL95J+ArDS+RhIEaiH1hTwQW6ZL7UEF Knzl1oGUsjb/32jx6y6ZM7P+BghTWwflhKWqXIA= X-Received: by 2002:a92:d381:0:b0:357:4fab:e24c with SMTP id o1-20020a92d381000000b003574fabe24cmr9863155ilo.13.1698084826627; Mon, 23 Oct 2023 11:13:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 18/38] tcg/i386: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:09 -0700 Message-Id: <20231023181329.171490-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12a.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 198 +++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 788d608150..a83f8aab30 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -153,11 +153,8 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) # define ALL_VECTOR_REGS 0x00ff0000u # define ALL_BYTEL_REGS 0x0000000fu #endif -#ifdef CONFIG_SOFTMMU -# define SOFTMMU_RESERVE_REGS ((1 << TCG_REG_L0) | (1 << TCG_REG_L1)) -#else -# define SOFTMMU_RESERVE_REGS 0 -#endif +#define SOFTMMU_RESERVE_REGS \ + (tcg_use_softmmu ? (1 << TCG_REG_L0) | (1 << TCG_REG_L1) : 0) /* For 64-bit, we always know that CMOV is available. */ #if TCG_TARGET_REG_BITS == 64 @@ -1933,7 +1930,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) return true; } -#ifndef CONFIG_SOFTMMU +#ifdef CONFIG_USER_ONLY static HostAddress x86_guest_base = { .index = -1 }; @@ -1949,6 +1946,7 @@ static inline int setup_guest_base_seg(void) } return 0; } +#define setup_guest_base_seg setup_guest_base_seg #elif defined(__x86_64__) && \ (defined (__FreeBSD__) || defined (__FreeBSD_kernel__)) # include @@ -1959,13 +1957,14 @@ static inline int setup_guest_base_seg(void) } return 0; } +#define setup_guest_base_seg setup_guest_base_seg +#endif #else -static inline int setup_guest_base_seg(void) -{ - return 0; -} -#endif /* setup_guest_base_seg */ -#endif /* !SOFTMMU */ +# define x86_guest_base (*(HostAddress *)({ qemu_build_not_reached(); NULL; })) +#endif /* CONFIG_USER_ONLY */ +#ifndef setup_guest_base_seg +# define setup_guest_base_seg() 0 +#endif #define MIN_TLB_MASK_TABLE_OFS INT_MIN @@ -1984,94 +1983,94 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, MemOp s_bits = opc & MO_SIZE; unsigned a_mask; -#ifdef CONFIG_SOFTMMU - h->index = TCG_REG_L0; - h->ofs = 0; - h->seg = 0; -#else - *h = x86_guest_base; -#endif + if (tcg_use_softmmu) { + h->index = TCG_REG_L0; + h->ofs = 0; + h->seg = 0; + } else { + *h = x86_guest_base; + } h->base = addrlo; h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; -#ifdef CONFIG_SOFTMMU - int cmp_ofs = is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write); - TCGType ttype = TCG_TYPE_I32; - TCGType tlbtype = TCG_TYPE_I32; - int trexw = 0, hrexw = 0, tlbrexw = 0; - unsigned mem_index = get_mmuidx(oi); - unsigned s_mask = (1 << s_bits) - 1; - int fast_ofs = tlb_mask_table_ofs(s, mem_index); - int tlb_mask; + if (tcg_use_softmmu) { + int cmp_ofs = is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write); + TCGType ttype = TCG_TYPE_I32; + TCGType tlbtype = TCG_TYPE_I32; + int trexw = 0, hrexw = 0, tlbrexw = 0; + unsigned mem_index = get_mmuidx(oi); + unsigned s_mask = (1 << s_bits) - 1; + int fast_ofs = tlb_mask_table_ofs(s, mem_index); + int tlb_mask; - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addrlo; - ldst->addrhi_reg = addrhi; + ldst = new_ldst_label(s); + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addrlo; + ldst->addrhi_reg = addrhi; - if (TCG_TARGET_REG_BITS == 64) { - ttype = s->addr_type; - trexw = (ttype == TCG_TYPE_I32 ? 0 : P_REXW); - if (TCG_TYPE_PTR == TCG_TYPE_I64) { - hrexw = P_REXW; - if (s->page_bits + s->tlb_dyn_max_bits > 32) { - tlbtype = TCG_TYPE_I64; - tlbrexw = P_REXW; + if (TCG_TARGET_REG_BITS == 64) { + ttype = s->addr_type; + trexw = (ttype == TCG_TYPE_I32 ? 0 : P_REXW); + if (TCG_TYPE_PTR == TCG_TYPE_I64) { + hrexw = P_REXW; + if (s->page_bits + s->tlb_dyn_max_bits > 32) { + tlbtype = TCG_TYPE_I64; + tlbrexw = P_REXW; + } } } - } - tcg_out_mov(s, tlbtype, TCG_REG_L0, addrlo); - tcg_out_shifti(s, SHIFT_SHR + tlbrexw, TCG_REG_L0, - s->page_bits - CPU_TLB_ENTRY_BITS); + tcg_out_mov(s, tlbtype, TCG_REG_L0, addrlo); + tcg_out_shifti(s, SHIFT_SHR + tlbrexw, TCG_REG_L0, + s->page_bits - CPU_TLB_ENTRY_BITS); - tcg_out_modrm_offset(s, OPC_AND_GvEv + trexw, TCG_REG_L0, TCG_AREG0, - fast_ofs + offsetof(CPUTLBDescFast, mask)); + tcg_out_modrm_offset(s, OPC_AND_GvEv + trexw, TCG_REG_L0, TCG_AREG0, + fast_ofs + offsetof(CPUTLBDescFast, mask)); - tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, TCG_REG_L0, TCG_AREG0, - fast_ofs + offsetof(CPUTLBDescFast, table)); + tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, TCG_REG_L0, TCG_AREG0, + fast_ofs + offsetof(CPUTLBDescFast, table)); - /* - * If the required alignment is at least as large as the access, simply - * copy the address and mask. For lesser alignments, check that we don't - * cross pages for the complete access. - */ - if (a_mask >= s_mask) { - tcg_out_mov(s, ttype, TCG_REG_L1, addrlo); - } else { - tcg_out_modrm_offset(s, OPC_LEA + trexw, TCG_REG_L1, - addrlo, s_mask - a_mask); - } - tlb_mask = s->page_mask | a_mask; - tgen_arithi(s, ARITH_AND + trexw, TCG_REG_L1, tlb_mask, 0); + /* + * If the required alignment is at least as large as the access, + * simply copy the address and mask. For lesser alignments, + * check that we don't cross pages for the complete access. + */ + if (a_mask >= s_mask) { + tcg_out_mov(s, ttype, TCG_REG_L1, addrlo); + } else { + tcg_out_modrm_offset(s, OPC_LEA + trexw, TCG_REG_L1, + addrlo, s_mask - a_mask); + } + tlb_mask = s->page_mask | a_mask; + tgen_arithi(s, ARITH_AND + trexw, TCG_REG_L1, tlb_mask, 0); - /* cmp 0(TCG_REG_L0), TCG_REG_L1 */ - tcg_out_modrm_offset(s, OPC_CMP_GvEv + trexw, - TCG_REG_L1, TCG_REG_L0, cmp_ofs); - - /* jne slow_path */ - tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); - ldst->label_ptr[0] = s->code_ptr; - s->code_ptr += 4; - - if (TCG_TARGET_REG_BITS == 32 && s->addr_type == TCG_TYPE_I64) { - /* cmp 4(TCG_REG_L0), addrhi */ - tcg_out_modrm_offset(s, OPC_CMP_GvEv, addrhi, TCG_REG_L0, cmp_ofs + 4); + /* cmp 0(TCG_REG_L0), TCG_REG_L1 */ + tcg_out_modrm_offset(s, OPC_CMP_GvEv + trexw, + TCG_REG_L1, TCG_REG_L0, cmp_ofs); /* jne slow_path */ tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); - ldst->label_ptr[1] = s->code_ptr; + ldst->label_ptr[0] = s->code_ptr; s->code_ptr += 4; - } - /* TLB Hit. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, - offsetof(CPUTLBEntry, addend)); -#else - if (a_mask) { + if (TCG_TARGET_REG_BITS == 32 && s->addr_type == TCG_TYPE_I64) { + /* cmp 4(TCG_REG_L0), addrhi */ + tcg_out_modrm_offset(s, OPC_CMP_GvEv, addrhi, + TCG_REG_L0, cmp_ofs + 4); + + /* jne slow_path */ + tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); + ldst->label_ptr[1] = s->code_ptr; + s->code_ptr += 4; + } + + /* TLB Hit. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, + offsetof(CPUTLBEntry, addend)); + } else if (a_mask) { ldst = new_ldst_label(s); ldst->is_ld = is_ld; @@ -2085,7 +2084,6 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, ldst->label_ptr[0] = s->code_ptr; s->code_ptr += 4; } -#endif return ldst; } @@ -4140,35 +4138,35 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_push(s, tcg_target_callee_save_regs[i]); } -#if TCG_TARGET_REG_BITS == 32 - tcg_out_ld(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, - (ARRAY_SIZE(tcg_target_callee_save_regs) + 1) * 4); - tcg_out_addi(s, TCG_REG_ESP, -stack_addend); - /* jmp *tb. */ - tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_ESP, - (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 - + stack_addend); -#else -# if !defined(CONFIG_SOFTMMU) - if (guest_base) { + if (!tcg_use_softmmu && guest_base) { int seg = setup_guest_base_seg(); if (seg != 0) { x86_guest_base.seg = seg; } else if (guest_base == (int32_t)guest_base) { x86_guest_base.ofs = guest_base; } else { + assert(TCG_TARGET_REG_BITS == 64); /* Choose R12 because, as a base, it requires a SIB byte. */ x86_guest_base.index = TCG_REG_R12; tcg_out_movi(s, TCG_TYPE_PTR, x86_guest_base.index, guest_base); tcg_regset_set_reg(s->reserved_regs, x86_guest_base.index); } } -# endif - tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); - tcg_out_addi(s, TCG_REG_ESP, -stack_addend); - /* jmp *tb. */ - tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); -#endif + + if (TCG_TARGET_REG_BITS == 32) { + tcg_out_ld(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, + (ARRAY_SIZE(tcg_target_callee_save_regs) + 1) * 4); + tcg_out_addi(s, TCG_REG_ESP, -stack_addend); + /* jmp *tb. */ + tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_ESP, + (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 + + stack_addend); + } else { + tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); + tcg_out_addi(s, TCG_REG_ESP, -stack_addend); + /* jmp *tb. */ + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); + } /* * Return path for goto_ptr. Set return value to 0, a-la exit_tb, From patchwork Mon Oct 23 18:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737267 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664323wrl; Mon, 23 Oct 2023 11:15:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4hf80xIm2RU1G40qkpxgPsn1mW4q6EOuCWuz/8eY2VaK+fxvmYPNlQ7mr3Re233f1pqM6 X-Received: by 2002:a0c:e98b:0:b0:65b:1097:760 with SMTP id z11-20020a0ce98b000000b0065b10970760mr19597725qvn.15.1698084903934; Mon, 23 Oct 2023 11:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084903; cv=none; d=google.com; s=arc-20160816; b=Q+qyBsCRsP4q+SRUQ0bk7SunYxxLKnzIv1jAqOxLb947TLRm0AllPgbO2F1fwjlzUg Y/YSsrLEhkvostYcBio6m3jwPWINEsdPYIXW+56oxARgXRiYy9gA27h5CJqoGzC4rpoS +03bPVj3U1/15e0GQEO8LrbFnXz1AkhdY8pp0k9/72CzHCt2I2JVFjmFxizz3VCUYlH9 JPctgH5DQD/VlJESqf/F2ixz5IkIGQOhGLcU4u1QP48XHWCKUmdFyIfHtN/lesjRt4OA FdVDyP2n4MvWKQt/4dgRQtU6cQGAUFPBAZ4oo4FJwlfP87dDBPB9JjA9Lzcvr6g6MtUg O2iQ== 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=pXxMfityb0ik1K4HMzfaPfkTROJcCUZstvsWWJk+1bM=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=o9BRcBmj7CX6G0gNm5lHz+ONho+tDoaFpVp6G0uqH1+2Zie22ndcs1W5IyesxZUuG3 9mXtORnac45XjqYsvlbWttvkEWnMgUyVgCUGVyqX0Eptds0eL0klqh13zamDE8flwsAS HfAlhqipkBnwUhKKp1eWOZGYOwGAS83bRc4NekVwBWeJvAWWk80MqU6AOIe//trhYPAJ Tk2lbNgJaXNaDbPIdnGXLJ9Y/8xl+WLXwlqqUpE86zFpmuL7QtEziEvucmtWFSzFuQge OAPwnMckkNejDU/7YFY0rpKE2Kj9qaC45/dBSjshMET6uVfIm2l8Bc8+t7QXCj/m1zPM zLhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wnBHzH7F; 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 do8-20020a056214096800b0066cefcfe53dsi5632069qvb.524.2023.10.23.11.15.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wnBHzH7F; 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 1quzRH-0005rw-3D; Mon, 23 Oct 2023 14:14:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR1-0005ag-6F for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:51 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQy-0008Bv-QQ for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:50 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5b837dc2855so2423579a12.0 for ; Mon, 23 Oct 2023 11:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084827; x=1698689627; darn=nongnu.org; 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=pXxMfityb0ik1K4HMzfaPfkTROJcCUZstvsWWJk+1bM=; b=wnBHzH7FqJD8kSlOF05/VHaozXtAOqG/0boWOs9cKKwZV4wab+WsJxrSZVHDk4RzvJ PkmWYh+UU3BgF3rvHL0065lB3abRxHwY92ATGBAltRPUYQenmcVp+iqSVG7DxRuWk8eh 6uWuKS0SUj6RpTwEKDpPAASSFG4Tq6ufB6CekG807LNFT0tTdOXj11FXFMPB9XixQ9t7 69kmvymooxVN8KnmM+2YzE2T/V2L7thRC2FsJOUVjsxbrZbSiWgEdF7Lh+2pFUtZtq25 r6+P0u3YDy0vumYxQOXAJeRnZPk99ifGmwLHuBcpvPe21AE9UjBNPNV1Fm2rbQaKv25p B7Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084827; x=1698689627; 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=pXxMfityb0ik1K4HMzfaPfkTROJcCUZstvsWWJk+1bM=; b=WniH1sQmFg5CbNQJU5iqcWYxeTzI9Lq6mJPyobw60tBRFbOoWMLuGkWj5Szk4EfOEU 8c23gdpDUUApS9Sa50bWGzv00bc1PASFSy9J7288p+mvNPqpRYO3KdSf+vA6OlyG1Xwc 2agq4N8ocsQC7ldAW81EMnVI2CRU1jk5eCwjTvaG/Wg/RQ8Wr8RpUTKw0yYFeDB3pdsL ypJuQ86crUOBr828LsmN+FHy/1+h1nA4RI7vElalCNam4fiCxo8796gkzNqFBlADxPSY 5MhsHTMSkFs3Yu0bMeh8zMoejD3QWuA8BB798GTBw+VdKoDKhpTve3BdDzZpdpfTQ+mM 7+/w== X-Gm-Message-State: AOJu0YzQuzR9BnHp+xxM1X4Orun2MOSWFSeHGAsxpTE08RnDBIMJ2Z/6 0uV0kYBkUVmU1FbwGa63lIfBVKZmiT/3ER01qzc= X-Received: by 2002:a05:6a21:1a0:b0:15e:7323:5bf3 with SMTP id le32-20020a056a2101a000b0015e73235bf3mr450152pzb.26.1698084827401; Mon, 23 Oct 2023 11:13:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 19/38] tcg/loongarch64: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:10 -0700 Message-Id: <20231023181329.171490-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 126 +++++++++++++++---------------- 1 file changed, 61 insertions(+), 65 deletions(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 801302d85d..ccf133db4b 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -165,10 +165,7 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) return TCG_REG_A0 + slot; } -#ifndef CONFIG_SOFTMMU -#define USE_GUEST_BASE (guest_base != 0) #define TCG_GUEST_BASE_REG TCG_REG_S1 -#endif #define TCG_CT_CONST_ZERO 0x100 #define TCG_CT_CONST_S12 0x200 @@ -908,76 +905,77 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false); a_bits = h->aa.align; -#ifdef CONFIG_SOFTMMU - unsigned s_bits = opc & MO_SIZE; - int mem_index = get_mmuidx(oi); - int fast_ofs = tlb_mask_table_ofs(s, mem_index); - int mask_ofs = fast_ofs + offsetof(CPUTLBDescFast, mask); - int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); + if (tcg_use_softmmu) { + unsigned s_bits = opc & MO_SIZE; + int mem_index = get_mmuidx(oi); + int fast_ofs = tlb_mask_table_ofs(s, mem_index); + int mask_ofs = fast_ofs + offsetof(CPUTLBDescFast, mask); + int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addr_reg; - - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_AREG0, mask_ofs); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, table_ofs); - - tcg_out_opc_srli_d(s, TCG_REG_TMP2, addr_reg, - s->page_bits - CPU_TLB_ENTRY_BITS); - tcg_out_opc_and(s, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP0); - tcg_out_opc_add_d(s, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP1); - - /* Load the tlb comparator and the addend. */ - QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); - tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, - is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write)); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_REG_TMP2, - offsetof(CPUTLBEntry, addend)); - - /* - * For aligned accesses, we check the first byte and include the alignment - * bits within the address. For unaligned access, we check that we don't - * cross pages using the address of the last byte of the access. - */ - if (a_bits < s_bits) { - unsigned a_mask = (1u << a_bits) - 1; - unsigned s_mask = (1u << s_bits) - 1; - tcg_out_addi(s, addr_type, TCG_REG_TMP1, addr_reg, s_mask - a_mask); - } else { - tcg_out_mov(s, addr_type, TCG_REG_TMP1, addr_reg); - } - tcg_out_opc_bstrins_d(s, TCG_REG_TMP1, TCG_REG_ZERO, - a_bits, s->page_bits - 1); - - /* Compare masked address with the TLB entry. */ - ldst->label_ptr[0] = s->code_ptr; - tcg_out_opc_bne(s, TCG_REG_TMP0, TCG_REG_TMP1, 0); - - h->index = TCG_REG_TMP2; -#else - if (a_bits) { ldst = new_ldst_label(s); - ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addr_reg; + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_AREG0, mask_ofs); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, table_ofs); + + tcg_out_opc_srli_d(s, TCG_REG_TMP2, addr_reg, + s->page_bits - CPU_TLB_ENTRY_BITS); + tcg_out_opc_and(s, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP0); + tcg_out_opc_add_d(s, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP1); + + /* Load the tlb comparator and the addend. */ + QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); + tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, + is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write)); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_REG_TMP2, + offsetof(CPUTLBEntry, addend)); + /* - * Without micro-architecture details, we don't know which of - * bstrpick or andi is faster, so use bstrpick as it's not - * constrained by imm field width. Not to say alignments >= 2^12 - * are going to happen any time soon. + * For aligned accesses, we check the first byte and include the + * alignment bits within the address. For unaligned access, we + * check that we don't cross pages using the address of the last + * byte of the access. */ - tcg_out_opc_bstrpick_d(s, TCG_REG_TMP1, addr_reg, 0, a_bits - 1); + if (a_bits < s_bits) { + unsigned a_mask = (1u << a_bits) - 1; + unsigned s_mask = (1u << s_bits) - 1; + tcg_out_addi(s, addr_type, TCG_REG_TMP1, addr_reg, s_mask - a_mask); + } else { + tcg_out_mov(s, addr_type, TCG_REG_TMP1, addr_reg); + } + tcg_out_opc_bstrins_d(s, TCG_REG_TMP1, TCG_REG_ZERO, + a_bits, s->page_bits - 1); + /* Compare masked address with the TLB entry. */ ldst->label_ptr[0] = s->code_ptr; - tcg_out_opc_bne(s, TCG_REG_TMP1, TCG_REG_ZERO, 0); - } + tcg_out_opc_bne(s, TCG_REG_TMP0, TCG_REG_TMP1, 0); - h->index = USE_GUEST_BASE ? TCG_GUEST_BASE_REG : TCG_REG_ZERO; -#endif + h->index = TCG_REG_TMP2; + } else { + if (a_bits) { + ldst = new_ldst_label(s); + + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addr_reg; + + /* + * Without micro-architecture details, we don't know which of + * bstrpick or andi is faster, so use bstrpick as it's not + * constrained by imm field width. Not to say alignments >= 2^12 + * are going to happen any time soon. + */ + tcg_out_opc_bstrpick_d(s, TCG_REG_TMP1, addr_reg, 0, a_bits - 1); + + ldst->label_ptr[0] = s->code_ptr; + tcg_out_opc_bne(s, TCG_REG_TMP1, TCG_REG_ZERO, 0); + } + + h->index = guest_base ? TCG_GUEST_BASE_REG : TCG_REG_ZERO; + } if (addr_type == TCG_TYPE_I32) { h->base = TCG_REG_TMP0; @@ -2272,12 +2270,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) TCG_REG_SP, SAVE_OFS + i * REG_SIZE); } -#if !defined(CONFIG_SOFTMMU) - if (USE_GUEST_BASE) { + if (!tcg_use_softmmu && guest_base) { 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 /* Call generated code */ tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); From patchwork Mon Oct 23 18:13:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737283 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665060wrl; Mon, 23 Oct 2023 11:16:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHL4DM+ILtHNqC4V2nqN5Yn5U1d3Y8aB6xn5j8L5m6AupZiXPN6stetMr1mj108zDsiweBv X-Received: by 2002:a1f:2347:0:b0:4a4:156e:6bd9 with SMTP id j68-20020a1f2347000000b004a4156e6bd9mr8342007vkj.5.1698085006585; Mon, 23 Oct 2023 11:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085006; cv=none; d=google.com; s=arc-20160816; b=rmiGYcnUljneY2J98Nu/jnCVd1+2FaqgvvioGw6ZVbvsdFi1REpUEuYTqLwxk3MTkV +SZE9ryRDIVfmmvOC0M3ea3V37XvSGag4kKhBCETPW2uaIc9asvjM84QDwLt7xR5B0hg bmMlil43AlNzFbSWnGzDRVALt3KFUZqHGg/jUkiZRvJZwkcHoeBoPyWDbKceyr4G+U4Z zg6tum4J08JAf1eQy8dNtf57wuetiMtgVkNqh+j1ovwqv73RckwaaTe4JtgK09QBmrVA 4G8xaDhyVktIRCLDmt1FQ3FLyAjb+wxjwDto44qSGYpc4q2Vwf7rPzCOImpjsZ9y7LEF zhYw== 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=6NA4v6NXBUoR4C0a50DqS4JX4mw0CRsfvfpO9da4xso=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=cJXuiaLWZjvbmxXsGGX0JvFZCcopoUu4CjXNBS9heVKw2bPONPsiAn9afoP8w3pySC oEL6k6/zg809WEbMl6ldIdFS0LrwydCxQCrCur5g2U+x8PQPe8lT00pIOquMs6CmOs11 ygmNbeQH0jFJcuZHjcUflXJV8kfSI4mByS35mtOm5Sq87PEcmve63yH+idDc/0I+y2Mf WKersmPNSua0H+XwjrgJshhMLyQmTPNgkgKzqyCNFGLyHs9dpgqcRr9XBgB0li9foJtT z8yUhEu+0n+a+ivyhmfc/Oad03qld+r3t+v1OP9f0WkzaPKRijHlPEpPgAmBIfnsCeX9 pUIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLcpKAi9; 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 d9-20020a05622a05c900b00417a3aa1fb5si6124759qtb.573.2023.10.23.11.16.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLcpKAi9; 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 1quzRE-0005k0-Hh; Mon, 23 Oct 2023 14:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR1-0005aq-Lc for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:51 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzQz-0008CZ-Ig for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:51 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-581b6b93bd1so2157649eaf.1 for ; Mon, 23 Oct 2023 11:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084828; x=1698689628; darn=nongnu.org; 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=6NA4v6NXBUoR4C0a50DqS4JX4mw0CRsfvfpO9da4xso=; b=XLcpKAi9ridF723koTamtCdy+WZ4Ifrd7MtpIW8RKLv91qpCzHuYlTqAvEp5A6gPVX wr3psIG75UAoQP/iPJAPCDZWXYR5VQzUb9e+pAlhmZbvKWLpPxjjAsS9plbXQbt/n7X7 qcViXKef1dA2WGzytH1nlxMGG2qF2xU/wzDgmbAiGHfb6MpDmK0v5BMCJQxKBqmAg3As j0RV6o86igI8hyuxDN8nT/BGkPsKtUpDzH4nKKwJc1x/wqCzexbPzc1nCxsMgZFPSSEb QampYQLN7ZoQ5Invm5caGk6lTfPo3mZxF+X/ebow0pghE1G+dPyJ2doJueW3AZsFtQQj 3YLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084828; x=1698689628; 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=6NA4v6NXBUoR4C0a50DqS4JX4mw0CRsfvfpO9da4xso=; b=j9dI55mAhdd05zwbmGWdZZakbgB/ATiGIAUe+6Ckhj8a1eyJmGyza9ts9J5P3f5oVT EL58OHBxigiE1sqkJvTSRuYYvHPzJDPw5PKtm6glgCBNMu87ixpvKwsQOmQdpltpnaPK h9aQualVlGWY6gFXoZj/NEsZydR+Wq/UxGKZ0YlWP7DVyTsEytqidDnl/kmOBXnlRxxu XjafD/X8qSK6E891fD+yePIRkuVz1Iywlzqyu5trpyHaNtgGDKe7qh8TjH4ZKUKsW1qr 9XSUsjpnyOk3wA0ODxJyTFwzNqKL+V4a3w3tl1VdLJHjLW9hyVIaqWJoYNXCR/6+hiMa AglA== X-Gm-Message-State: AOJu0YzArK9+C5/2208EV3YLB6W/wxDF07wTMn4dSCAdNJuGGa3bx/SC UhDHQF27aKqwECVnr6D4MZ5vPiAtJGxYulYqmlo= X-Received: by 2002:a05:6358:ee45:b0:168:d346:9ee3 with SMTP id ik5-20020a056358ee4500b00168d3469ee3mr7194239rwb.24.1698084828348; Mon, 23 Oct 2023 11:13:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 20/38] tcg/mips: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:11 -0700 Message-Id: <20231023181329.171490-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2c; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2c.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 231 +++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 118 deletions(-) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index e2892edc6a..328984ccff 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -78,13 +78,11 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { #define TCG_TMP2 TCG_REG_T8 #define TCG_TMP3 TCG_REG_T7 -#ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG TCG_REG_S7 -#endif #if TCG_TARGET_REG_BITS == 64 #define TCG_REG_TB TCG_REG_S6 #else -#define TCG_REG_TB (qemu_build_not_reached(), TCG_REG_ZERO) +#define TCG_REG_TB ({ qemu_build_not_reached(); TCG_REG_ZERO; }) #endif /* check if we really need so many registers :P */ @@ -1279,130 +1277,129 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, a_bits = h->aa.align; a_mask = (1 << a_bits) - 1; -#ifdef CONFIG_SOFTMMU - unsigned s_mask = (1 << s_bits) - 1; - int mem_index = get_mmuidx(oi); - int fast_off = tlb_mask_table_ofs(s, mem_index); - int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); - int table_off = fast_off + offsetof(CPUTLBDescFast, table); - int add_off = offsetof(CPUTLBEntry, addend); - int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write); + if (tcg_use_softmmu) { + unsigned s_mask = (1 << s_bits) - 1; + int mem_index = get_mmuidx(oi); + int fast_off = tlb_mask_table_ofs(s, mem_index); + int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); + int table_off = fast_off + offsetof(CPUTLBDescFast, table); + int add_off = offsetof(CPUTLBEntry, addend); + int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write); - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addrlo; - ldst->addrhi_reg = addrhi; - - /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_AREG0, mask_off); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP1, TCG_AREG0, table_off); - - /* Extract the TLB index from the address into TMP3. */ - if (TCG_TARGET_REG_BITS == 32 || addr_type == TCG_TYPE_I32) { - tcg_out_opc_sa(s, OPC_SRL, TCG_TMP3, addrlo, - s->page_bits - CPU_TLB_ENTRY_BITS); - } else { - tcg_out_dsrl(s, TCG_TMP3, addrlo, - s->page_bits - CPU_TLB_ENTRY_BITS); - } - tcg_out_opc_reg(s, OPC_AND, TCG_TMP3, TCG_TMP3, TCG_TMP0); - - /* Add the tlb_table pointer, creating the CPUTLBEntry address in TMP3. */ - tcg_out_opc_reg(s, ALIAS_PADD, TCG_TMP3, TCG_TMP3, TCG_TMP1); - - if (TCG_TARGET_REG_BITS == 32 || addr_type == TCG_TYPE_I32) { - /* Load the (low half) tlb comparator. */ - tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, - cmp_off + HOST_BIG_ENDIAN * 4); - } else { - tcg_out_ld(s, TCG_TYPE_I64, TCG_TMP0, TCG_TMP3, cmp_off); - } - - if (TCG_TARGET_REG_BITS == 64 || addr_type == TCG_TYPE_I32) { - /* Load the tlb addend for the fast path. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP3, TCG_TMP3, add_off); - } - - /* - * Mask the page bits, keeping the alignment bits to compare against. - * For unaligned accesses, compare against the end of the access to - * verify that it does not cross a page boundary. - */ - tcg_out_movi(s, addr_type, TCG_TMP1, s->page_mask | a_mask); - if (a_mask < s_mask) { - if (TCG_TARGET_REG_BITS == 32 || addr_type == TCG_TYPE_I32) { - tcg_out_opc_imm(s, OPC_ADDIU, TCG_TMP2, addrlo, s_mask - a_mask); - } else { - tcg_out_opc_imm(s, OPC_DADDIU, TCG_TMP2, addrlo, s_mask - a_mask); - } - tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, TCG_TMP2); - } else { - tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrlo); - } - - /* Zero extend a 32-bit guest address for a 64-bit host. */ - if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { - tcg_out_ext32u(s, TCG_TMP2, addrlo); - addrlo = TCG_TMP2; - } - - ldst->label_ptr[0] = s->code_ptr; - tcg_out_opc_br(s, OPC_BNE, TCG_TMP1, TCG_TMP0); - - /* Load and test the high half tlb comparator. */ - if (TCG_TARGET_REG_BITS == 32 && addr_type != TCG_TYPE_I32) { - /* delay slot */ - tcg_out_ldst(s, OPC_LW, TCG_TMP0, TCG_TMP3, cmp_off + HI_OFF); - - /* Load the tlb addend for the fast path. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP3, TCG_TMP3, add_off); - - ldst->label_ptr[1] = s->code_ptr; - tcg_out_opc_br(s, OPC_BNE, addrhi, TCG_TMP0); - } - - /* delay slot */ - base = TCG_TMP3; - tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP3, addrlo); -#else - if (a_mask && (use_mips32r6_instructions || a_bits != s_bits)) { ldst = new_ldst_label(s); - ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addrlo; ldst->addrhi_reg = addrhi; - /* We are expecting a_bits to max out at 7, much lower than ANDI. */ - tcg_debug_assert(a_bits < 16); - tcg_out_opc_imm(s, OPC_ANDI, TCG_TMP0, addrlo, a_mask); + /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_AREG0, mask_off); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP1, TCG_AREG0, table_off); + + /* Extract the TLB index from the address into TMP3. */ + if (TCG_TARGET_REG_BITS == 32 || addr_type == TCG_TYPE_I32) { + tcg_out_opc_sa(s, OPC_SRL, TCG_TMP3, addrlo, + s->page_bits - CPU_TLB_ENTRY_BITS); + } else { + tcg_out_dsrl(s, TCG_TMP3, addrlo, + s->page_bits - CPU_TLB_ENTRY_BITS); + } + tcg_out_opc_reg(s, OPC_AND, TCG_TMP3, TCG_TMP3, TCG_TMP0); + + /* Add the tlb_table pointer, creating the CPUTLBEntry address. */ + tcg_out_opc_reg(s, ALIAS_PADD, TCG_TMP3, TCG_TMP3, TCG_TMP1); + + if (TCG_TARGET_REG_BITS == 32 || addr_type == TCG_TYPE_I32) { + /* Load the (low half) tlb comparator. */ + tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, + cmp_off + HOST_BIG_ENDIAN * 4); + } else { + tcg_out_ld(s, TCG_TYPE_I64, TCG_TMP0, TCG_TMP3, cmp_off); + } + + if (TCG_TARGET_REG_BITS == 64 || addr_type == TCG_TYPE_I32) { + /* Load the tlb addend for the fast path. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP3, TCG_TMP3, add_off); + } + + /* + * Mask the page bits, keeping the alignment bits to compare against. + * For unaligned accesses, compare against the end of the access to + * verify that it does not cross a page boundary. + */ + tcg_out_movi(s, addr_type, TCG_TMP1, s->page_mask | a_mask); + if (a_mask < s_mask) { + tcg_out_opc_imm(s, (TCG_TARGET_REG_BITS == 32 + || addr_type == TCG_TYPE_I32 + ? OPC_ADDIU : OPC_DADDIU), + TCG_TMP2, addrlo, s_mask - a_mask); + tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, TCG_TMP2); + } else { + tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrlo); + } + + /* Zero extend a 32-bit guest address for a 64-bit host. */ + if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { + tcg_out_ext32u(s, TCG_TMP2, addrlo); + addrlo = TCG_TMP2; + } ldst->label_ptr[0] = s->code_ptr; - if (use_mips32r6_instructions) { - tcg_out_opc_br(s, OPC_BNEZALC_R6, TCG_REG_ZERO, TCG_TMP0); - } else { - tcg_out_opc_br(s, OPC_BNEL, TCG_TMP0, TCG_REG_ZERO); - tcg_out_nop(s); - } - } + tcg_out_opc_br(s, OPC_BNE, TCG_TMP1, TCG_TMP0); - base = addrlo; - if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { - tcg_out_ext32u(s, TCG_REG_A0, base); - base = TCG_REG_A0; - } - if (guest_base) { - if (guest_base == (int16_t)guest_base) { - tcg_out_opc_imm(s, ALIAS_PADDI, TCG_REG_A0, base, guest_base); - } else { - tcg_out_opc_reg(s, ALIAS_PADD, TCG_REG_A0, base, - TCG_GUEST_BASE_REG); + /* Load and test the high half tlb comparator. */ + if (TCG_TARGET_REG_BITS == 32 && addr_type != TCG_TYPE_I32) { + /* delay slot */ + tcg_out_ldst(s, OPC_LW, TCG_TMP0, TCG_TMP3, cmp_off + HI_OFF); + + /* Load the tlb addend for the fast path. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP3, TCG_TMP3, add_off); + + ldst->label_ptr[1] = s->code_ptr; + tcg_out_opc_br(s, OPC_BNE, addrhi, TCG_TMP0); + } + + /* delay slot */ + base = TCG_TMP3; + tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP3, addrlo); + } else { + if (a_mask && (use_mips32r6_instructions || a_bits != s_bits)) { + ldst = new_ldst_label(s); + + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addrlo; + ldst->addrhi_reg = addrhi; + + /* We are expecting a_bits to max out at 7, much lower than ANDI. */ + tcg_debug_assert(a_bits < 16); + tcg_out_opc_imm(s, OPC_ANDI, TCG_TMP0, addrlo, a_mask); + + ldst->label_ptr[0] = s->code_ptr; + if (use_mips32r6_instructions) { + tcg_out_opc_br(s, OPC_BNEZALC_R6, TCG_REG_ZERO, TCG_TMP0); + } else { + tcg_out_opc_br(s, OPC_BNEL, TCG_TMP0, TCG_REG_ZERO); + tcg_out_nop(s); + } + } + + base = addrlo; + if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { + tcg_out_ext32u(s, TCG_REG_A0, base); + base = TCG_REG_A0; + } + if (guest_base) { + if (guest_base == (int16_t)guest_base) { + tcg_out_opc_imm(s, ALIAS_PADDI, TCG_REG_A0, base, guest_base); + } else { + tcg_out_opc_reg(s, ALIAS_PADD, TCG_REG_A0, base, + TCG_GUEST_BASE_REG); + } + base = TCG_REG_A0; } - base = TCG_REG_A0; } -#endif h->base = base; return ldst; @@ -2465,8 +2462,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) TCG_REG_SP, SAVE_OFS + i * REG_SIZE); } -#ifndef CONFIG_SOFTMMU - if (guest_base != (int16_t)guest_base) { + if (!tcg_use_softmmu && guest_base != (int16_t)guest_base) { /* * The function call abi for n32 and n64 will have loaded $25 (t9) * with the address of the prologue, so we can use that instead @@ -2479,7 +2475,6 @@ static void tcg_target_qemu_prologue(TCGContext *s) TCG_TARGET_REG_BITS == 64 ? TCG_REG_T9 : 0); tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); } -#endif if (TCG_TARGET_REG_BITS == 64) { tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_TB, tcg_target_call_iarg_regs[1]); From patchwork Mon Oct 23 18:13:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737268 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664325wrl; Mon, 23 Oct 2023 11:15:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSnXjV55OpnPCiKm6+dbaTvzludClGOtK2K2t+trP5/fmxPRJHUDen5SgbUFoTUEClnmYg X-Received: by 2002:a05:620a:258b:b0:76e:faf1:5e2c with SMTP id x11-20020a05620a258b00b0076efaf15e2cmr10414409qko.45.1698084904039; Mon, 23 Oct 2023 11:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084904; cv=none; d=google.com; s=arc-20160816; b=iBx0pLR9GbKlKuwqjwP6kPpYjd7sGU3+SxBCLXm5Qudie/nLp52G8xguVXP8tG3a6V Y35kqAhF9KS0wsw0oh+Ffv5fNur3OEjHVWCasWvrYjKO3klb9xs7nOCz3WA8yx3+DD5D Cpv6M38Ue9V8ELAk99rK+DtURXcVh+PTnszVIhEt671m/Q7bvSb4Yt/OAXVRTlPJFF/x KMGPOATaZySzirhYSFZ3WxIsuaqcEra2AJvgdcm6i9sm63Y9u9HNlB7tgQSZpy0yOTjM QBBZLomG2MTMQrRGvlMDxSq6XhPDOGmujNw09QoRx2APwc2nXi9XvpHvHJhAJWeCUnlp pzmg== 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=UPfL8PRDqxISdNKDDtEx7VkZ1IZG1ok5c8lkQqcFV18=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=JXH2KaG2htoN5N7I2y/p04FFmDBG6KqFwdr4oEj9kST6Nyy1qQ0kBoqGDVnYEMK4Fa zfjxoN7yFTKJcm1IUhBay2LP4tHeUPIhbsZV1988eZ8KFEcbD85dWBd2GeB1YF7mMEbe 9C+6FpT44vewb5KR+6YT6mizTLDBtsNtCAwNOQCTZ0ExAuuoT4CRbxlszgkGfR6081Od 2Fyt97eME4HDXuMf0EcTkbvxnJeAU+3ZvyhrykgHnCYuKNMDcbbEULOTvpfXTaYFxwmW bqugFWg+FSdbbZVBawawscHTu1Vun8HPmIVsN73OPuoykeU4aDJLutkDiogfWCiDQCI4 kcAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fxwrrxhb; 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 w15-20020ae9e50f000000b00775784f9d2csi5607702qkf.437.2023.10.23.11.15.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fxwrrxhb; 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 1quzRA-0005fz-MW; Mon, 23 Oct 2023 14:14:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR4-0005bv-Aj for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:55 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR0-0008Fa-PR for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:53 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-692c02adeefso2727381b3a.3 for ; Mon, 23 Oct 2023 11:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084829; x=1698689629; darn=nongnu.org; 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=UPfL8PRDqxISdNKDDtEx7VkZ1IZG1ok5c8lkQqcFV18=; b=fxwrrxhbG8eoYGrDWSp0ObVXQVIQFX2EHfm2PwwwXqiRsIsfZg2qoBvQxdlhLfpn4j tDnGcmxnFeLUAAS0QhOvbEkiUIgaewo35bWw6tTA2ZrW/PCzxFPHYuguhLoxpT2BP8/t iTJrxAQklao1N2Rzg0PlvGVjgJAq9ojk0BN100GruLwc6YNnHBEdyaLSMAxJAWQYF3VS F0l8A4JSDOaexLMZ5hJsFKACo4qtmrlp4EGCvZ09Jw012bzC2cKwNi1bYIxFRwdkWoOy 6FpA7dUWTnE6oTigkzJZ5hfSU7ZM5N4HB74OH0DJixuqdIrD9GnQLFEwhXq6JWx6IWOs IoJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084829; x=1698689629; 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=UPfL8PRDqxISdNKDDtEx7VkZ1IZG1ok5c8lkQqcFV18=; b=Eqm9geA+1FKMhqePbtQzy65Mo1YukkOq5syR2w+K+4aOpE6mDW03RmD6OW/ZeA0WyC yKm3EmiUqYvbXsQV2UkNTS1jsnkUJwYD5iD4QTEha0t4C1lAZS3IxNUv9REfBGXihQGx /nizj34xwa5bq+2uPYrnPj0bPVkD+lDwsAqGA3l8Mz3a1iFtRZLa0O3IUFSXC7Lab4/N 3WJR2gTY/QnsOYSFs3miFFw+LnLGNOq4Tr6trb0s2gJOUjixwUe1VJWtL3CpAU7JSvTa aJ62HJDNoX3bvo603MInlX7a6RAPg0LZhxwnh+s4CLh8XxsEjN4GHqdXVoi4Kl92O/mW VZTg== X-Gm-Message-State: AOJu0YzgB4nQIa5fYSs3M8bdRiCwdAF3vL5wr4kHqVCtWFdbv8GbSY0C qxhdNADfSYOXRShgE8JOSXk7AhZTSI3gP7Cvma8= X-Received: by 2002:a05:6a00:2e8e:b0:666:e1f4:5153 with SMTP id fd14-20020a056a002e8e00b00666e1f45153mr8650257pfb.0.1698084829375; Mon, 23 Oct 2023 11:13:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 21/38] tcg/ppc: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:12 -0700 Message-Id: <20231023181329.171490-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Fix TCG_GUEST_BASE_REG to use 'TCG_REG_R30' instead of '30'. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 284 ++++++++++++++++++++------------------- 1 file changed, 143 insertions(+), 141 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index c31da4da9d..856c3b18f5 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -107,9 +107,7 @@ #define have_isel (cpuinfo & CPUINFO_ISEL) -#ifndef CONFIG_SOFTMMU -#define TCG_GUEST_BASE_REG 30 -#endif +#define TCG_GUEST_BASE_REG TCG_REG_R30 #ifdef CONFIG_DEBUG_TCG static const char tcg_target_reg_names[TCG_TARGET_NB_REGS][4] = { @@ -2317,151 +2315,157 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, s_bits == MO_128); a_bits = h->aa.align; -#ifdef CONFIG_SOFTMMU - int mem_index = get_mmuidx(oi); - int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write); - int fast_off = tlb_mask_table_ofs(s, mem_index); - int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); - int table_off = fast_off + offsetof(CPUTLBDescFast, table); + if (tcg_use_softmmu) { + int mem_index = get_mmuidx(oi); + int cmp_off = is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write); + int fast_off = tlb_mask_table_ofs(s, mem_index); + int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); + int table_off = fast_off + offsetof(CPUTLBDescFast, table); - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addrlo; - ldst->addrhi_reg = addrhi; - - /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, mask_off); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_AREG0, table_off); - - /* Extract the page index, shifted into place for tlb index. */ - if (TCG_TARGET_REG_BITS == 32) { - tcg_out_shri32(s, TCG_REG_R0, addrlo, - s->page_bits - CPU_TLB_ENTRY_BITS); - } else { - tcg_out_shri64(s, TCG_REG_R0, addrlo, - s->page_bits - CPU_TLB_ENTRY_BITS); - } - tcg_out32(s, AND | SAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_R0)); - - /* - * Load the (low part) TLB comparator into TMP2. - * For 64-bit host, always load the entire 64-bit slot for simplicity. - * We will ignore the high bits with tcg_out_cmp(..., addr_type). - */ - if (TCG_TARGET_REG_BITS == 64) { - if (cmp_off == 0) { - tcg_out32(s, LDUX | TAB(TCG_REG_TMP2, TCG_REG_TMP1, TCG_REG_TMP2)); - } else { - tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2)); - tcg_out_ld(s, TCG_TYPE_I64, TCG_REG_TMP2, TCG_REG_TMP1, cmp_off); - } - } else if (cmp_off == 0 && !HOST_BIG_ENDIAN) { - tcg_out32(s, LWZUX | TAB(TCG_REG_TMP2, TCG_REG_TMP1, TCG_REG_TMP2)); - } else { - tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2)); - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1, - cmp_off + 4 * HOST_BIG_ENDIAN); - } - - /* - * Load the TLB addend for use on the fast path. - * Do this asap to minimize any load use delay. - */ - if (TCG_TARGET_REG_BITS == 64 || addr_type == TCG_TYPE_I32) { - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, - offsetof(CPUTLBEntry, addend)); - } - - /* Clear the non-page, non-alignment bits from the address in R0. */ - if (TCG_TARGET_REG_BITS == 32) { - /* - * We don't support unaligned accesses on 32-bits. - * Preserve the bottom bits and thus trigger a comparison - * failure on unaligned accesses. - */ - if (a_bits < s_bits) { - a_bits = s_bits; - } - tcg_out_rlw(s, RLWINM, TCG_REG_R0, addrlo, 0, - (32 - a_bits) & 31, 31 - s->page_bits); - } else { - TCGReg t = addrlo; - - /* - * If the access is unaligned, we need to make sure we fail if we - * cross a page boundary. The trick is to add the access size-1 - * to the address before masking the low bits. That will make the - * address overflow to the next page if we cross a page boundary, - * which will then force a mismatch of the TLB compare. - */ - if (a_bits < s_bits) { - unsigned a_mask = (1 << a_bits) - 1; - unsigned s_mask = (1 << s_bits) - 1; - tcg_out32(s, ADDI | TAI(TCG_REG_R0, t, s_mask - a_mask)); - t = TCG_REG_R0; - } - - /* Mask the address for the requested alignment. */ - if (addr_type == TCG_TYPE_I32) { - tcg_out_rlw(s, RLWINM, TCG_REG_R0, t, 0, - (32 - a_bits) & 31, 31 - s->page_bits); - } else if (a_bits == 0) { - tcg_out_rld(s, RLDICR, TCG_REG_R0, t, 0, 63 - s->page_bits); - } else { - tcg_out_rld(s, RLDICL, TCG_REG_R0, t, - 64 - s->page_bits, s->page_bits - a_bits); - tcg_out_rld(s, RLDICL, TCG_REG_R0, TCG_REG_R0, s->page_bits, 0); - } - } - - if (TCG_TARGET_REG_BITS == 32 && addr_type != TCG_TYPE_I32) { - /* Low part comparison into cr7. */ - tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2, - 0, 7, TCG_TYPE_I32); - - /* Load the high part TLB comparator into TMP2. */ - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1, - cmp_off + 4 * !HOST_BIG_ENDIAN); - - /* Load addend, deferred for this case. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, - offsetof(CPUTLBEntry, addend)); - - /* High part comparison into cr6. */ - tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_TMP2, 0, 6, TCG_TYPE_I32); - - /* Combine comparisons into cr7. */ - tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ)); - } else { - /* Full comparison into cr7. */ - tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2, 0, 7, addr_type); - } - - /* Load a pointer into the current opcode w/conditional branch-link. */ - ldst->label_ptr[0] = s->code_ptr; - tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); - - h->base = TCG_REG_TMP1; -#else - if (a_bits) { ldst = new_ldst_label(s); ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addrlo; ldst->addrhi_reg = addrhi; - /* We are expecting a_bits to max out at 7, much lower than ANDI. */ - tcg_debug_assert(a_bits < 16); - tcg_out32(s, ANDI | SAI(addrlo, TCG_REG_R0, (1 << a_bits) - 1)); + /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, mask_off); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_AREG0, table_off); + /* Extract the page index, shifted into place for tlb index. */ + if (TCG_TARGET_REG_BITS == 32) { + tcg_out_shri32(s, TCG_REG_R0, addrlo, + s->page_bits - CPU_TLB_ENTRY_BITS); + } else { + tcg_out_shri64(s, TCG_REG_R0, addrlo, + s->page_bits - CPU_TLB_ENTRY_BITS); + } + tcg_out32(s, AND | SAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_R0)); + + /* + * Load the (low part) TLB comparator into TMP2. + * For 64-bit host, always load the entire 64-bit slot for simplicity. + * We will ignore the high bits with tcg_out_cmp(..., addr_type). + */ + if (TCG_TARGET_REG_BITS == 64) { + if (cmp_off == 0) { + tcg_out32(s, LDUX | TAB(TCG_REG_TMP2, + TCG_REG_TMP1, TCG_REG_TMP2)); + } else { + tcg_out32(s, ADD | TAB(TCG_REG_TMP1, + TCG_REG_TMP1, TCG_REG_TMP2)); + tcg_out_ld(s, TCG_TYPE_I64, TCG_REG_TMP2, + TCG_REG_TMP1, cmp_off); + } + } else if (cmp_off == 0 && !HOST_BIG_ENDIAN) { + tcg_out32(s, LWZUX | TAB(TCG_REG_TMP2, + TCG_REG_TMP1, TCG_REG_TMP2)); + } else { + tcg_out32(s, ADD | TAB(TCG_REG_TMP1, TCG_REG_TMP1, TCG_REG_TMP2)); + tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1, + cmp_off + 4 * HOST_BIG_ENDIAN); + } + + /* + * Load the TLB addend for use on the fast path. + * Do this asap to minimize any load use delay. + */ + if (TCG_TARGET_REG_BITS == 64 || addr_type == TCG_TYPE_I32) { + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, + offsetof(CPUTLBEntry, addend)); + } + + /* Clear the non-page, non-alignment bits from the address in R0. */ + if (TCG_TARGET_REG_BITS == 32) { + /* + * We don't support unaligned accesses on 32-bits. + * Preserve the bottom bits and thus trigger a comparison + * failure on unaligned accesses. + */ + if (a_bits < s_bits) { + a_bits = s_bits; + } + tcg_out_rlw(s, RLWINM, TCG_REG_R0, addrlo, 0, + (32 - a_bits) & 31, 31 - s->page_bits); + } else { + TCGReg t = addrlo; + + /* + * If the access is unaligned, we need to make sure we fail if we + * cross a page boundary. The trick is to add the access size-1 + * to the address before masking the low bits. That will make the + * address overflow to the next page if we cross a page boundary, + * which will then force a mismatch of the TLB compare. + */ + if (a_bits < s_bits) { + unsigned a_mask = (1 << a_bits) - 1; + unsigned s_mask = (1 << s_bits) - 1; + tcg_out32(s, ADDI | TAI(TCG_REG_R0, t, s_mask - a_mask)); + t = TCG_REG_R0; + } + + /* Mask the address for the requested alignment. */ + if (addr_type == TCG_TYPE_I32) { + tcg_out_rlw(s, RLWINM, TCG_REG_R0, t, 0, + (32 - a_bits) & 31, 31 - s->page_bits); + } else if (a_bits == 0) { + tcg_out_rld(s, RLDICR, TCG_REG_R0, t, 0, 63 - s->page_bits); + } else { + tcg_out_rld(s, RLDICL, TCG_REG_R0, t, + 64 - s->page_bits, s->page_bits - a_bits); + tcg_out_rld(s, RLDICL, TCG_REG_R0, TCG_REG_R0, s->page_bits, 0); + } + } + + if (TCG_TARGET_REG_BITS == 32 && addr_type != TCG_TYPE_I32) { + /* Low part comparison into cr7. */ + tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2, + 0, 7, TCG_TYPE_I32); + + /* Load the high part TLB comparator into TMP2. */ + tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP2, TCG_REG_TMP1, + cmp_off + 4 * !HOST_BIG_ENDIAN); + + /* Load addend, deferred for this case. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_REG_TMP1, + offsetof(CPUTLBEntry, addend)); + + /* High part comparison into cr6. */ + tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_TMP2, + 0, 6, TCG_TYPE_I32); + + /* Combine comparisons into cr7. */ + tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ)); + } else { + /* Full comparison into cr7. */ + tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP2, + 0, 7, addr_type); + } + + /* Load a pointer into the current opcode w/conditional branch-link. */ ldst->label_ptr[0] = s->code_ptr; - tcg_out32(s, BC | BI(0, CR_EQ) | BO_COND_FALSE | LK); - } + tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); - h->base = guest_base ? TCG_GUEST_BASE_REG : 0; -#endif + h->base = TCG_REG_TMP1; + } else { + if (a_bits) { + ldst = new_ldst_label(s); + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addrlo; + ldst->addrhi_reg = addrhi; + + /* We are expecting a_bits to max out at 7, much lower than ANDI. */ + tcg_debug_assert(a_bits < 16); + tcg_out32(s, ANDI | SAI(addrlo, TCG_REG_R0, (1 << a_bits) - 1)); + + ldst->label_ptr[0] = s->code_ptr; + tcg_out32(s, BC | BI(0, CR_EQ) | BO_COND_FALSE | LK); + } + + h->base = guest_base ? TCG_GUEST_BASE_REG : 0; + } if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) { /* Zero-extend the guest address for use in the host address. */ @@ -2695,12 +2699,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) } tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_REG_R1, FRAME_SIZE+LR_OFFSET); -#ifndef CONFIG_SOFTMMU - if (guest_base) { + if (!tcg_use_softmmu && guest_base) { tcg_out_movi_int(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base, true); 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]); tcg_out32(s, MTSPR | RS(tcg_target_call_iarg_regs[1]) | CTR); From patchwork Mon Oct 23 18:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737286 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665137wrl; Mon, 23 Oct 2023 11:16:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyUdpqAfweIY9AhOy2lJkiirUxRjpUe7klu5UiyQIOJhR7p59C4dYpO5hvEojVYHjJOseu X-Received: by 2002:a05:620a:17ab:b0:76f:1ead:e4f4 with SMTP id ay43-20020a05620a17ab00b0076f1eade4f4mr12507601qkb.15.1698085014259; Mon, 23 Oct 2023 11:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085014; cv=none; d=google.com; s=arc-20160816; b=RctJgzbf7DNw7Abpbn00uqlRRhJexhjifzrhISPcQ27isHeTKEpEGn+HwdhEbBQdk/ tIUwfPh5KSZixXou/hNRVNY0ddCIq8z9WBcT8um5ZAL4jLaFw3P/hY5NqbwgneriqGxf gD40lPKxc5jRQkaIrLlrD/ErL2mK0/wtX/+oStHQGG5VNIkVU6StpkzCjxcWy0xrARIC WUpHPquGCsEDqMhuLup8VTwRLSFIZqlTPDgt9W2Gq5c3I6fxCyvn6nsRef12O9UVzkR7 zXCWjeU9YQFg85WqaCp4zgj6FSE/21e6T9rGfi6O3UhNoRmMItG5KWOwJ0CFWy6GjCjn tXmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Gscgf9TaNURfjEVsbC8XIQGIbXkPOrKC3iA1FwA6PsE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OXuVIaaXurXj/RhyVrnSz00VuRKi71ITrvypzYGUmI5qxqTspmFLqfy3KCkC31oiUJ 45cXxwDG93FPBcIVXeWvsX/lRXD6p/Je5wDVoRyjFQSZNpGErxd4+clbz6q/V3wZTJCc PzHMrm7leI357W/XFpsP1iUmXWUUZQAg7tZlyOdJs11alMDnoWbP35CBoFAvsJ8E7lFM 7UWtKdE69M7JJZydrg973jxIRf19j38owoZc7Zt+p3uOkM9SWuwLt1xefghvoNCHZLwn HdRAmFcIIjka9G7NoEZWHYMYxvROQ5tpiXkJWCQeaVtsrJE3GBDdsmCVBpk1xARzrlYn 7JwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Um4GTz+k; 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 v4-20020a05620a090400b0076f19d66ddfsi5939012qkv.138.2023.10.23.11.16.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Um4GTz+k; 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 1quzRD-0005if-No; Mon, 23 Oct 2023 14:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR3-0005bo-98 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:54 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR1-0008Fy-Hc for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:52 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6be0277c05bso2742232b3a.0 for ; Mon, 23 Oct 2023 11:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084830; x=1698689630; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Gscgf9TaNURfjEVsbC8XIQGIbXkPOrKC3iA1FwA6PsE=; b=Um4GTz+kCDi3H0tlkAzuVnTq87askO17lX831qVy23K3DUonU4YnGTxDrb+L0Pe2gL HYkqVNWXHqCAeRgSjPLq+2pWx9Z2QK4yZaqgYnBYHTelZU8ujQwAPDft4/QLqvKcoubS 6B/NYuRQd70JY8/uwQyJ85AaM7LPwUbdZ6uClUFUsXenIjIL1jaZDRHACXF1qEtj6AVd p2em5Dk6jGv4qFJFNkGZRCBMtMja3UL/JiQrLxFH8Z2VHLCa6/y8y/r2J7PBofF2Ct7X AlSXCJvI0WxgcyPQlkVrEAnUp1D0XIED1UdJSkJ+Bv5N5bXLO5sU+HhuUiX9/uvVE7IB aRww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084830; x=1698689630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gscgf9TaNURfjEVsbC8XIQGIbXkPOrKC3iA1FwA6PsE=; b=JRTXwumfb6cQimjYqDmk6/qihh9vo/lUyV3Yf2USZO4Y87l+KkQ1qiJ7KC5Ck4u3uE GbRMwh7OQGSqS5OpX8vC412asao3VrFWiSNbFcAcUMhbHVoGbCIYzqjIQw6TET4+2zvw dxwndl3q8sKNzHrgBGk38jErEznNOpKFxH6hvfZ5r1fgDDhQUnR2heqzwSHyEMRiUsoM s4JB2Qj6j/Gj134atQGpwYgdu7M6DRX6ypT1mEmpJR8zQmk0aL/2Tj+TVJjq86K0zrs0 CBBYMog+6Vhq6vMddlvT7SwdRpU2jYv/7Jfq2tK/UGNIpGeT5Lr9AgBTs2UMvg1wpkRS JyIA== X-Gm-Message-State: AOJu0YxyCjBnVUbyEXsSeVEgX8vJjb/TtVWWTaHOUhaqRCSx4fzADj4N jRLvnDvetsbeQfrkmgxe6EXXj5z1Ytf3WGa23GA= X-Received: by 2002:a62:f245:0:b0:6bd:b4f1:49e8 with SMTP id y5-20020a62f245000000b006bdb4f149e8mr6922428pfl.2.1698084830348; Mon, 23 Oct 2023 11:13:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 22/38] tcg/riscv: Do not reserve TCG_GUEST_BASE_REG for guest_base zero Date: Mon, 23 Oct 2023 11:13:13 -0700 Message-Id: <20231023181329.171490-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Fixes: 92c041c59b ("tcg/riscv: Add the prologue generation and register the JIT") Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index d6dbcaf3cb..dc71f829d1 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -2076,8 +2076,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) } #if !defined(CONFIG_SOFTMMU) - tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base); - tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); + if (guest_base) { + 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 /* Call generated code */ From patchwork Mon Oct 23 18:13:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737279 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664816wrl; Mon, 23 Oct 2023 11:16:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcMqaslE5VBrTMb0H1YoFm1iAAz3kPEjY9p0PQrHwDwCItVJknLBvcUbMgIYwu2MyNtGpt X-Received: by 2002:a67:cb84:0:b0:458:729b:4ebc with SMTP id h4-20020a67cb84000000b00458729b4ebcmr8147819vsl.16.1698084967487; Mon, 23 Oct 2023 11:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084967; cv=none; d=google.com; s=arc-20160816; b=DPkjUP468cHLaNiLy69wELDwYpiPYTBb2bUUCXSLUgfLhZvDeTgUl4xbw2y3hnXUIx YJ6j0T00bPWmZsMykXDNVuWpu7RNYeEaobiN6QOb4QYQjC9HlGax5YCGlcmWlNBYRt2D 9SoDDz9bd44dw/dBgEz3w4dkvRFSvOxBrR/Nm25p9CcA4uTltP7FULaM9eyz4T2nKiL9 Tg7sj5RHt1t6MNj6zwfJX8iUA59fOTCTUBuip4H0beKGctdSpcl8gsTIjlE++5iqzzlk b2Nh6zkJNLKcwf7KTQEU0fC4gZZwsKTr3uDWAnSwnWCQZwvgvZslO4HG5ezHJm8Mp3xA 0dGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JvjLY5SZ74SJJZ4Z/bCpNskQetGcwIwHRaw0bsKKJdY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xSZXbPmWLYR69i2bFDurgo+eNaL+iNoa5kIwImFusIxhPTyZHTqzuKiRrurtD09xEm dzdxKIWgeHVtInRDoWaG2rxvx3mdcUiTuV7OWoxa5zUQJHZwCTSMK29mm4QSkHKXIngP /X6kU9ghL4QKquRzfasA8u5MO05s9LIcUsAbB8Bd4O7PsMn8FP6pnPLunj12q8Lsap1G eKbOmQ49OsvI1gbJjZgRiTTrj7Z17T2OG12PlNIOCTFrl1RVahi/QaXiQH5QYAEeEzm+ cGdYI9zU0Ry+KHzMdB3nqoaDzvZRcyoI3a34IDqkcqvoHbJgD9yPa0PGBKJfiwNsFPVD giVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wl1Gor1E; 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 c24-20020a05620a269800b007788d758a18si5956314qkp.511.2023.10.23.11.16.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wl1Gor1E; 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 1quzRF-0005kA-2e; Mon, 23 Oct 2023 14:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR7-0005cj-Vn for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:59 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR2-0008GG-De for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:57 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso2726895b3a.0 for ; Mon, 23 Oct 2023 11:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084831; x=1698689631; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JvjLY5SZ74SJJZ4Z/bCpNskQetGcwIwHRaw0bsKKJdY=; b=Wl1Gor1ESbvaRp2JJuheKJWFGCOvJ0JCgxYMbsOU5sEH3SUXpYaZYjlXBOI4EkOeB+ KL1kuo0SioOsKScXeN91f7EGltHA7TSeecRFGhHXmFMiGHsG5zl7tRAIA4Y9pMjR24E+ Iv66Rxd+JnUhLi147x0moiMtGdA2w8/cNo7NAH/wraJRs+qlsEfeLm5CxLIk0cU1aHOX X9Okf03dsAu5tKi+ZQcBfG9me37smzl/Nyw4kAD7uSj0ba7pW3KxO2mtQRBrGF0Lc/A4 8B3uRQKD4wZ99BCV//fHHBPHcrrS+aNTWJdBe5JxYCR2mIh9Ro9YTZQNzWb/CuBhyjCq JjQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084831; x=1698689631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JvjLY5SZ74SJJZ4Z/bCpNskQetGcwIwHRaw0bsKKJdY=; b=Qpat1aNjXM4ECzZRY6Lz7N3KyrxJoxyNMUHpvLqeAWPLPNRj7Vclpaz6hQygJf3LBP nGdO3kgbqzrYz71am3E+sb2u2JKq+nQoUYEMyi4xTaPtS8syx91CF3Qwtmf3y3FTt0No apJ3mbxanWjWOHxgCFzTAa4sdn8oP9+tSOB1azTlKUsrVJMn72JwD4bKg/QrNiqDMEWu Ri3jGxQWa/nVvAhByEn5NDKy4H1PXtbSHrWLJnvi6uXj0664DuJjOWsMSVm/KPFDqyng jCoHvZrxRLPi9NccvH70eQI04Yfz4Fk5+6bBiGPzf5wbvV97Nd6A2ElyXpSzqdTcsjbk FfaQ== X-Gm-Message-State: AOJu0Yw/6rFgyAvrrlK6OrTDLIAxOxPnXreJGQDz8Z/+QmSQ8PkOjhLh 5BiUmu/um87VEfyPh7oCg5HjMFGLNn4zFw3tjoM= X-Received: by 2002:a05:6a21:66c4:b0:16c:b60c:953c with SMTP id ze4-20020a056a2166c400b0016cb60c953cmr390648pzb.58.1698084831083; Mon, 23 Oct 2023 11:13:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 23/38] tcg/riscv: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:14 -0700 Message-Id: <20231023181329.171490-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 185 +++++++++++++++++++------------------ 1 file changed, 94 insertions(+), 91 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index dc71f829d1..34e10e77d9 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1245,105 +1245,110 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, TCGReg *pbase, aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false); a_mask = (1u << aa.align) - 1; -#ifdef CONFIG_SOFTMMU - unsigned s_bits = opc & MO_SIZE; - unsigned s_mask = (1u << s_bits) - 1; - int mem_index = get_mmuidx(oi); - int fast_ofs = tlb_mask_table_ofs(s, mem_index); - int mask_ofs = fast_ofs + offsetof(CPUTLBDescFast, mask); - int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); - int compare_mask; - TCGReg addr_adj; + if (tcg_use_softmmu) { + unsigned s_bits = opc & MO_SIZE; + unsigned s_mask = (1u << s_bits) - 1; + int mem_index = get_mmuidx(oi); + int fast_ofs = tlb_mask_table_ofs(s, mem_index); + int mask_ofs = fast_ofs + offsetof(CPUTLBDescFast, mask); + int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); + int compare_mask; + TCGReg addr_adj; - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addr_reg; - - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_AREG0, mask_ofs); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, table_ofs); - - tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP2, addr_reg, - s->page_bits - CPU_TLB_ENTRY_BITS); - tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP0); - tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP1); - - /* - * For aligned accesses, we check the first byte and include the alignment - * bits within the address. For unaligned access, we check that we don't - * cross pages using the address of the last byte of the access. - */ - addr_adj = addr_reg; - if (a_mask < s_mask) { - addr_adj = TCG_REG_TMP0; - tcg_out_opc_imm(s, addr_type == TCG_TYPE_I32 ? OPC_ADDIW : OPC_ADDI, - addr_adj, addr_reg, s_mask - a_mask); - } - compare_mask = s->page_mask | a_mask; - if (compare_mask == sextreg(compare_mask, 0, 12)) { - tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP1, addr_adj, compare_mask); - } else { - tcg_out_movi(s, addr_type, TCG_REG_TMP1, compare_mask); - tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP1, TCG_REG_TMP1, addr_adj); - } - - /* Load the tlb comparator and the addend. */ - QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); - tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, - is_ld ? offsetof(CPUTLBEntry, addr_read) - : offsetof(CPUTLBEntry, addr_write)); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_REG_TMP2, - offsetof(CPUTLBEntry, addend)); - - /* Compare masked address with the TLB entry. */ - ldst->label_ptr[0] = s->code_ptr; - tcg_out_opc_branch(s, OPC_BNE, TCG_REG_TMP0, TCG_REG_TMP1, 0); - - /* TLB Hit - translate address using addend. */ - if (addr_type != TCG_TYPE_I32) { - tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP0, addr_reg, TCG_REG_TMP2); - } else if (have_zba) { - tcg_out_opc_reg(s, OPC_ADD_UW, TCG_REG_TMP0, addr_reg, TCG_REG_TMP2); - } else { - tcg_out_ext32u(s, TCG_REG_TMP0, addr_reg); - tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP0, TCG_REG_TMP0, TCG_REG_TMP2); - } - *pbase = TCG_REG_TMP0; -#else - TCGReg base; - - if (a_mask) { ldst = new_ldst_label(s); ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addr_reg; - /* We are expecting alignment max 7, so we can always use andi. */ - tcg_debug_assert(a_mask == sextreg(a_mask, 0, 12)); - tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP1, addr_reg, a_mask); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_AREG0, mask_ofs); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, TCG_AREG0, table_ofs); - ldst->label_ptr[0] = s->code_ptr; - tcg_out_opc_branch(s, OPC_BNE, TCG_REG_TMP1, TCG_REG_ZERO, 0); - } + tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP2, addr_reg, + s->page_bits - CPU_TLB_ENTRY_BITS); + tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP0); + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP1); - if (guest_base != 0) { - base = TCG_REG_TMP0; - if (addr_type != TCG_TYPE_I32) { - tcg_out_opc_reg(s, OPC_ADD, base, addr_reg, TCG_GUEST_BASE_REG); - } else if (have_zba) { - tcg_out_opc_reg(s, OPC_ADD_UW, base, addr_reg, TCG_GUEST_BASE_REG); - } else { - tcg_out_ext32u(s, base, addr_reg); - tcg_out_opc_reg(s, OPC_ADD, base, base, TCG_GUEST_BASE_REG); + /* + * For aligned accesses, we check the first byte and include the + * alignment bits within the address. For unaligned access, we + * check that we don't cross pages using the address of the last + * byte of the access. + */ + addr_adj = addr_reg; + if (a_mask < s_mask) { + addr_adj = TCG_REG_TMP0; + tcg_out_opc_imm(s, addr_type == TCG_TYPE_I32 ? OPC_ADDIW : OPC_ADDI, + addr_adj, addr_reg, s_mask - a_mask); } - } else if (addr_type != TCG_TYPE_I32) { - base = addr_reg; + compare_mask = s->page_mask | a_mask; + if (compare_mask == sextreg(compare_mask, 0, 12)) { + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP1, addr_adj, compare_mask); + } else { + tcg_out_movi(s, addr_type, TCG_REG_TMP1, compare_mask); + tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP1, TCG_REG_TMP1, addr_adj); + } + + /* Load the tlb comparator and the addend. */ + QEMU_BUILD_BUG_ON(HOST_BIG_ENDIAN); + tcg_out_ld(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, + is_ld ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write)); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP2, TCG_REG_TMP2, + offsetof(CPUTLBEntry, addend)); + + /* Compare masked address with the TLB entry. */ + ldst->label_ptr[0] = s->code_ptr; + tcg_out_opc_branch(s, OPC_BNE, TCG_REG_TMP0, TCG_REG_TMP1, 0); + + /* TLB Hit - translate address using addend. */ + if (addr_type != TCG_TYPE_I32) { + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP0, addr_reg, TCG_REG_TMP2); + } else if (have_zba) { + tcg_out_opc_reg(s, OPC_ADD_UW, TCG_REG_TMP0, + addr_reg, TCG_REG_TMP2); + } else { + tcg_out_ext32u(s, TCG_REG_TMP0, addr_reg); + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP0, + TCG_REG_TMP0, TCG_REG_TMP2); + } + *pbase = TCG_REG_TMP0; } else { - base = TCG_REG_TMP0; - tcg_out_ext32u(s, base, addr_reg); + TCGReg base; + + if (a_mask) { + ldst = new_ldst_label(s); + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addr_reg; + + /* We are expecting alignment max 7, so we can always use andi. */ + tcg_debug_assert(a_mask == sextreg(a_mask, 0, 12)); + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP1, addr_reg, a_mask); + + ldst->label_ptr[0] = s->code_ptr; + tcg_out_opc_branch(s, OPC_BNE, TCG_REG_TMP1, TCG_REG_ZERO, 0); + } + + if (guest_base != 0) { + base = TCG_REG_TMP0; + if (addr_type != TCG_TYPE_I32) { + tcg_out_opc_reg(s, OPC_ADD, base, addr_reg, + TCG_GUEST_BASE_REG); + } else if (have_zba) { + tcg_out_opc_reg(s, OPC_ADD_UW, base, addr_reg, + TCG_GUEST_BASE_REG); + } else { + tcg_out_ext32u(s, base, addr_reg); + tcg_out_opc_reg(s, OPC_ADD, base, base, TCG_GUEST_BASE_REG); + } + } else if (addr_type != TCG_TYPE_I32) { + base = addr_reg; + } else { + base = TCG_REG_TMP0; + tcg_out_ext32u(s, base, addr_reg); + } + *pbase = base; } - *pbase = base; -#endif return ldst; } @@ -2075,12 +2080,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) TCG_REG_SP, SAVE_OFS + i * REG_SIZE); } -#if !defined(CONFIG_SOFTMMU) - if (guest_base) { + if (!tcg_use_softmmu && guest_base) { 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 /* Call generated code */ tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); From patchwork Mon Oct 23 18:13:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737273 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664586wrl; Mon, 23 Oct 2023 11:15:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOHifk5lpMzoKHJb2I+WLsUhfhuSAw9HxV7ulQZEFS454eAOJx4cedKXqlo+bMUhS7O42O X-Received: by 2002:a05:620a:880d:b0:775:985e:f5c2 with SMTP id qj13-20020a05620a880d00b00775985ef5c2mr8371736qkn.17.1698084939610; Mon, 23 Oct 2023 11:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084939; cv=none; d=google.com; s=arc-20160816; b=MbFFP0Ol3DTgeJ9dBNGm51y9Qw7oS/tYwnGSsrp0LDhCyjXGgLHj31nCgvV+UstjBW 2N64pNTB04c8fRvec7z7hNpovpHFI9HXaF+5QKQURGpgaIoLfVyROtUTVoZhOwnuEf7m dMOS2RodbHGMbEt8gxNYxLr3MR+gw+eJCFv7gnB+LmSfVaZkoi04g5b9qcGDlOQ7FW9h itwnaCxr1P9A1ObvCb7ABOK/QptOiF23MEYZA3wPFoWeNcDFlKqdCKXQUUUMST5r/X65 FtkHPouh95X0bPPztxT4chLj/h804sqKB66HfAkUAW7XuPp2fZPPSVfBdN+yY0gUsX2R MpzQ== 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=Bcjf2eCMU+42vUIozeZGyhF4KpNEtDy+BJZ7xBFSvto=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=0EMpwTFiEdIHTLg4inva1G34Ykb3XUWivJhusXd28ObQltiOszZycOWIqtXcqG9Nv5 3iUyVlv7ESb4ebxlrqGfhXAMzYjTNBT7JGhJRUO580UwRNqSLoDXVSTwnn+JtMOTtrXT icGFiv7CXEaiB0FaL6P9XGbGaeaN1PclMVGLijPBJsJjuWgRS/76c/MiB+bimkUsVJuZ kRziWnfJZS8puyBKeNkooZgVBMx3cVLCPDMZepph9gCK7yiNM0YsK27J18rI7XDDLTcD 5HEveChsQMzhLsQAnCYBSGNqDeeTjguoQNAFSOYuSOzBD7pIY/3B4cROvMLdM5zdf5lg pSNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lkfR1n7m; 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 g6-20020a05620a40c600b00779e2bd2eaasi939855qko.389.2023.10.23.11.15.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lkfR1n7m; 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 1quzRF-0005kB-79; Mon, 23 Oct 2023 14:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR8-0005cl-5B for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:59 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR4-0008GM-3L for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:56 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6ba54c3ed97so3480532b3a.2 for ; Mon, 23 Oct 2023 11:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084832; x=1698689632; darn=nongnu.org; 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=Bcjf2eCMU+42vUIozeZGyhF4KpNEtDy+BJZ7xBFSvto=; b=lkfR1n7mjrkHRuL/3nhg6VZf0D2kEmQS/yiolOir0ASDnHB3onL3eO394Qu0uRFMx8 czzS0MO7hxFY4Il9uBKvmorxcFtzXoskPTqz454ShfIbqtoxd99u1dbN4XQi5BzTNNuJ QhnNLf5g9bmB0THOpTAoWRFBEJ6lD+tFhEEVVDhe9XO2sIO4pibDJNjHkktwtxE8+ZaN 2NzDjAlpUoSNsZ0MOJAEZqhHa8iqQPg9C6GHMdeqNlCpL+28EmYDMGuPLmEjIRc9VmRH 1NqeY2X96WSvTOB+NAPay4PRMBFMfqoHD0s/cf0Z16I90MsFbIs3KA23mcdqOvx9bGNi EklA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084832; x=1698689632; 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=Bcjf2eCMU+42vUIozeZGyhF4KpNEtDy+BJZ7xBFSvto=; b=cVExWp4XPSM9IUVE2p8PbMWS/jf6E2+ZTPqdOdtmLif7353WzqGoWKca8qSy9XJa3x UEgH6TpKgiuqU/Z3DnIFPoi0w9rh4QoPeCC63uempM15/fcQj5CXe5WAYxNW19UAYF2k sVG5NDI06RohkCNLmV7CCt62D9V97AlRTGb60boK/xLz22MlEKfjLYDagDzLllFjxxHi NV1U0HP2PUvHGOBgbGWg815GdYjoPgxfAz58O6C814mmkMZfwCDLFnowBFITtj1WVq1F yMTPbtauzVrC3XRAJZ89ibEiTFBELAGPqnifLFcMLOncsGpz2sc+kEo8erZuY53Wibc0 vyLg== X-Gm-Message-State: AOJu0YwmTS1uvMlI7RTLM/Fi6HOT2/9ctuW3UPqSp6qBNUY6szSSoNW/ qTF3D4jCZSGp8njDnrYLhuCtV6rSudRX/916v8w= X-Received: by 2002:a05:6a21:66c6:b0:174:2a38:9d9c with SMTP id ze6-20020a056a2166c600b001742a389d9cmr371666pzb.57.1698084831929; Mon, 23 Oct 2023 11:13:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 24/38] tcg/s390x: Use tcg_use_softmmu Date: Mon, 23 Oct 2023 11:13:15 -0700 Message-Id: <20231023181329.171490-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 161 ++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 82 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 4ef9ac3d5b..fbee43d3b0 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -46,9 +46,7 @@ /* A scratch register that may be be used throughout the backend. */ #define TCG_TMP0 TCG_REG_R1 -#ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG TCG_REG_R13 -#endif /* All of the following instructions are prefixed with their instruction format, and are defined as 8- or 16-bit quantities, even when the two @@ -1768,94 +1766,95 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; -#ifdef CONFIG_SOFTMMU - unsigned s_mask = (1 << s_bits) - 1; - int mem_index = get_mmuidx(oi); - int fast_off = tlb_mask_table_ofs(s, mem_index); - int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); - int table_off = fast_off + offsetof(CPUTLBDescFast, table); - int ofs, a_off; - uint64_t tlb_mask; + if (tcg_use_softmmu) { + unsigned s_mask = (1 << s_bits) - 1; + int mem_index = get_mmuidx(oi); + int fast_off = tlb_mask_table_ofs(s, mem_index); + int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); + int table_off = fast_off + offsetof(CPUTLBDescFast, table); + int ofs, a_off; + uint64_t tlb_mask; - ldst = new_ldst_label(s); - ldst->is_ld = is_ld; - ldst->oi = oi; - ldst->addrlo_reg = addr_reg; - - tcg_out_sh64(s, RSY_SRLG, TCG_TMP0, addr_reg, TCG_REG_NONE, - s->page_bits - CPU_TLB_ENTRY_BITS); - - tcg_out_insn(s, RXY, NG, TCG_TMP0, TCG_AREG0, TCG_REG_NONE, mask_off); - tcg_out_insn(s, RXY, AG, TCG_TMP0, TCG_AREG0, TCG_REG_NONE, table_off); - - /* - * For aligned accesses, we check the first byte and include the alignment - * bits within the address. For unaligned access, we check that we don't - * cross pages using the address of the last byte of the access. - */ - a_off = (a_mask >= s_mask ? 0 : s_mask - a_mask); - tlb_mask = (uint64_t)s->page_mask | a_mask; - if (a_off == 0) { - tgen_andi_risbg(s, TCG_REG_R0, addr_reg, tlb_mask); - } else { - tcg_out_insn(s, RX, LA, TCG_REG_R0, addr_reg, TCG_REG_NONE, a_off); - tgen_andi(s, addr_type, TCG_REG_R0, tlb_mask); - } - - if (is_ld) { - ofs = offsetof(CPUTLBEntry, addr_read); - } else { - ofs = offsetof(CPUTLBEntry, addr_write); - } - if (addr_type == TCG_TYPE_I32) { - ofs += HOST_BIG_ENDIAN * 4; - tcg_out_insn(s, RX, C, TCG_REG_R0, TCG_TMP0, TCG_REG_NONE, ofs); - } else { - tcg_out_insn(s, RXY, CG, TCG_REG_R0, TCG_TMP0, TCG_REG_NONE, ofs); - } - - tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); - ldst->label_ptr[0] = s->code_ptr++; - - h->index = TCG_TMP0; - tcg_out_insn(s, RXY, LG, h->index, TCG_TMP0, TCG_REG_NONE, - offsetof(CPUTLBEntry, addend)); - - if (addr_type == TCG_TYPE_I32) { - tcg_out_insn(s, RRE, ALGFR, h->index, addr_reg); - h->base = TCG_REG_NONE; - } else { - h->base = addr_reg; - } - h->disp = 0; -#else - if (a_mask) { ldst = new_ldst_label(s); ldst->is_ld = is_ld; ldst->oi = oi; ldst->addrlo_reg = addr_reg; - /* We are expecting a_bits to max out at 7, much lower than TMLL. */ - tcg_debug_assert(a_mask <= 0xffff); - tcg_out_insn(s, RI, TMLL, addr_reg, a_mask); + tcg_out_sh64(s, RSY_SRLG, TCG_TMP0, addr_reg, TCG_REG_NONE, + s->page_bits - CPU_TLB_ENTRY_BITS); - tcg_out16(s, RI_BRC | (7 << 4)); /* CC in {1,2,3} */ + tcg_out_insn(s, RXY, NG, TCG_TMP0, TCG_AREG0, TCG_REG_NONE, mask_off); + tcg_out_insn(s, RXY, AG, TCG_TMP0, TCG_AREG0, TCG_REG_NONE, table_off); + + /* + * For aligned accesses, we check the first byte and include the + * alignment bits within the address. For unaligned access, we + * check that we don't cross pages using the address of the last + * byte of the access. + */ + a_off = (a_mask >= s_mask ? 0 : s_mask - a_mask); + tlb_mask = (uint64_t)s->page_mask | a_mask; + if (a_off == 0) { + tgen_andi_risbg(s, TCG_REG_R0, addr_reg, tlb_mask); + } else { + tcg_out_insn(s, RX, LA, TCG_REG_R0, addr_reg, TCG_REG_NONE, a_off); + tgen_andi(s, addr_type, TCG_REG_R0, tlb_mask); + } + + if (is_ld) { + ofs = offsetof(CPUTLBEntry, addr_read); + } else { + ofs = offsetof(CPUTLBEntry, addr_write); + } + if (addr_type == TCG_TYPE_I32) { + ofs += HOST_BIG_ENDIAN * 4; + tcg_out_insn(s, RX, C, TCG_REG_R0, TCG_TMP0, TCG_REG_NONE, ofs); + } else { + tcg_out_insn(s, RXY, CG, TCG_REG_R0, TCG_TMP0, TCG_REG_NONE, ofs); + } + + tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); ldst->label_ptr[0] = s->code_ptr++; - } - h->base = addr_reg; - if (addr_type == TCG_TYPE_I32) { - tcg_out_ext32u(s, TCG_TMP0, addr_reg); - h->base = TCG_TMP0; - } - if (guest_base < 0x80000) { - h->index = TCG_REG_NONE; - h->disp = guest_base; - } else { - h->index = TCG_GUEST_BASE_REG; + h->index = TCG_TMP0; + tcg_out_insn(s, RXY, LG, h->index, TCG_TMP0, TCG_REG_NONE, + offsetof(CPUTLBEntry, addend)); + + if (addr_type == TCG_TYPE_I32) { + tcg_out_insn(s, RRE, ALGFR, h->index, addr_reg); + h->base = TCG_REG_NONE; + } else { + h->base = addr_reg; + } h->disp = 0; + } else { + if (a_mask) { + ldst = new_ldst_label(s); + ldst->is_ld = is_ld; + ldst->oi = oi; + ldst->addrlo_reg = addr_reg; + + /* We are expecting a_bits to max out at 7, much lower than TMLL. */ + tcg_debug_assert(a_mask <= 0xffff); + tcg_out_insn(s, RI, TMLL, addr_reg, a_mask); + + tcg_out16(s, RI_BRC | (7 << 4)); /* CC in {1,2,3} */ + ldst->label_ptr[0] = s->code_ptr++; + } + + h->base = addr_reg; + if (addr_type == TCG_TYPE_I32) { + tcg_out_ext32u(s, TCG_TMP0, addr_reg); + h->base = TCG_TMP0; + } + if (guest_base < 0x80000) { + h->index = TCG_REG_NONE; + h->disp = guest_base; + } else { + h->index = TCG_GUEST_BASE_REG; + h->disp = 0; + } } -#endif return ldst; } @@ -3453,12 +3452,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) TCG_STATIC_CALL_ARGS_SIZE + TCG_TARGET_CALL_STACK_OFFSET, CPU_TEMP_BUF_NLONGS * sizeof(long)); -#ifndef CONFIG_SOFTMMU - if (guest_base >= 0x80000) { + if (!tcg_use_softmmu && guest_base >= 0x80000) { 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]); From patchwork Mon Oct 23 18:13:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737278 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664818wrl; Mon, 23 Oct 2023 11:16:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAuKhVUCHyluzILyqz2pYsVY1cdOq7zBRdmAbXKbt4+W8UI+e/DV+vJ7t4DKh4PcaKLMlO X-Received: by 2002:a05:620a:469f:b0:777:659d:7fcb with SMTP id bq31-20020a05620a469f00b00777659d7fcbmr11014745qkb.36.1698084967500; Mon, 23 Oct 2023 11:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084967; cv=none; d=google.com; s=arc-20160816; b=q/USiDqlV5uBc0KQcqT/s/GYb80g/yQVyqDR0Az9MxiDxhzISxqOJVWDym06TMwrO9 M+PX8YxcoZxhd1jfXwsQ6foCJr5uABGI+PstTgFATmcOVAWC9XTMr5yD9rL6qHqmwHsa WN3cSSe5hFthUteZCILQ48vEGLM8RgOW8hT691/4cgWZU6LOwJ83JuB9BCoIWSMZ8PND ooXr/cR2qFn6D2LEKe5hDzsGik2XUqKoPlhaQq7yM/KyVznzl/m+Y6mZmmnVxYfzWbyi EO5xHySmsCU9f3IM0+l0eG00np3X9JVUstWRUCcGlZJDOr1bodhyBjuaTBblq2lY6Hz4 uG3Q== 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=qq+/ocKlHxuwOLYzAnqcUyLG835LUOMki3n0K/cpOvs=; fh=30H5lBTeLONNZXKqIz21He08Ou1A37bT4D5dItg7lPM=; b=MEi8N8OMS55IcY0sYYrc7o0EEN1nhw6cy2QgThGRgqrzCOz+2xEh+0PGBb5XrA/aju coEulUQGwqr6FDZnbdZ/SyeNzKNx9AzynXq3BxIvaVGvQcuBdITaZp8VJtx1mFx9dXdY 4T8brukini+4W1TknicPLHBZkSEKemSfmX0vb615nx2VOoTHkj6IxsBbcc+C3/oWMITs ZZkBrKpmS4RT2FgGOKE8IuAU4D6If1KMvhNrR9kNj5oDFCCWRyF84+MJccTKOsvY8Uqs eQyxpIb84Sq48Xmby1/4qN4x1pE2XIgFtsUZ3te0rCkDrbwfOR1eVOfibGk1gVB2dIDn Nayw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bsCcC0Sx; 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 oq34-20020a05620a612200b0076db460394esi5678273qkn.438.2023.10.23.11.16.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bsCcC0Sx; 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 1quzRL-00068B-EC; Mon, 23 Oct 2023 14:14:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR7-0005ck-W3 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:59 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR4-0008Gg-Ao for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:56 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b709048f32so2785623b3a.0 for ; Mon, 23 Oct 2023 11:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084833; x=1698689633; darn=nongnu.org; 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=qq+/ocKlHxuwOLYzAnqcUyLG835LUOMki3n0K/cpOvs=; b=bsCcC0Sxvck583GAqCPuD772Xa9MTtQkm82jMrnyZweJyohV+oCmLuAApqA22vNwdM +hP6K61Dc+WXh9aHDYOXv4KeUFKOgw2F1UhmZu9ZrhmN5RYZ38trFEvJwS4laqriVjJV XsbjvJVsW/O9UC1d7lCqtByzUFoWLt0hX5c2JCAwFHVD3V6BATC5fFI021dcKorTfGJ4 N/hOSvdhI3w1v0OjTYHWw+vrSkgBrzvXQ7NyNU4jEc7n5osjeScluaYQS9ZE/PVdQlrO eviTalKJ4mKHflhMqisYDY8r3rumSswB28KNSVhQFGuRFsWdZti0acjoCNG0mnv83+k/ DykA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084833; x=1698689633; 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=qq+/ocKlHxuwOLYzAnqcUyLG835LUOMki3n0K/cpOvs=; b=nKYo7NeX0lDG2He6R0KLuqbapYCHPgVamzPhTMLTC6sFiX2JN0ZPH3dIpdhetfcchw 2P72egwF+2/6tqXghtu1f5KGltq5j+uT5xPsCDZZ0z8TfE3uET4Ijhmv9w/nGFfZ85NQ lMS2tr0WADOKlRV76jqjv6uhR8BQAWGgU3ZRwsPDd2IKSzaiSiXtKgqfV3BqipDvJxcO H7aSYkvJHFE30hF3yavOoY6aRXtQpvOGaNMB8Hn67I1g8dXSyYYPJzR18n/VU0BOMnGP QN2re2fTYKLOQ6RgqDM1Od20Hh2kpnBVq5+A8KrFVeGg4QYtwXCvr+cMWwZSv10h/aNv nLPA== X-Gm-Message-State: AOJu0YyL6m0R80I3k6aa8UYDRJT40+QxOUc0LKunwuSKbN3H9AAG/Y5r 9W+25B2OGY9JPTm3AbMV/Hokyqyn2gL+PGQ5SwI= X-Received: by 2002:a05:6a21:3d85:b0:16b:d853:90be with SMTP id bj5-20020a056a213d8500b0016bd85390bemr386550pzc.25.1698084832813; Mon, 23 Oct 2023 11:13:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mike Frysinger , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL v3 25/38] tcg: drop unused tcg_temp_free define Date: Mon, 23 Oct 2023 11:13:16 -0700 Message-Id: <20231023181329.171490-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 From: Mike Frysinger Use of the API was removed a while back, but the define wasn't. Signed-off-by: Mike Frysinger Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231015010046.16020-1-vapier@gentoo.org> Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 80cfcf8104..3ead59e459 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -52,7 +52,6 @@ static inline void tcg_gen_insn_start(target_ulong pc, target_ulong a1, typedef TCGv_i32 TCGv; #define tcg_temp_new() tcg_temp_new_i32() #define tcg_global_mem_new tcg_global_mem_new_i32 -#define tcg_temp_free tcg_temp_free_i32 #define tcgv_tl_temp tcgv_i32_temp #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i32 #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32 @@ -60,7 +59,6 @@ typedef TCGv_i32 TCGv; typedef TCGv_i64 TCGv; #define tcg_temp_new() tcg_temp_new_i64() #define tcg_global_mem_new tcg_global_mem_new_i64 -#define tcg_temp_free tcg_temp_free_i64 #define tcgv_tl_temp tcgv_i64_temp #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i64 #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i64 From patchwork Mon Oct 23 18:13:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737272 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664578wrl; Mon, 23 Oct 2023 11:15:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT918xahSVnCm1i6xgkSS6w3nW6PZ0yoKwLfpmDl9CtvMI1AJ+ll8XjLTT+5LIPIV9ZSP+ X-Received: by 2002:a05:620a:4305:b0:777:2767:6465 with SMTP id u5-20020a05620a430500b0077727676465mr11385326qko.40.1698084939122; Mon, 23 Oct 2023 11:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084939; cv=none; d=google.com; s=arc-20160816; b=ZM3hPX4kyltYNLvMB3snl2bOIBF3fpNcZFQ943OwelFfbVr6VnntAy9E1rOydx/rms mZeo7CqLQ04uZsT92lB6fs0QXUZ6FQuzvci7cIu8Ni1bqH0x3wNudPsum9rEBrzuCbbT Hx3QOJLvQ6PkctqAeXSFJjlJVftFnrlMl+B3LojTybgCBixXND3vGBlGUttpumMHa8p3 YevgKoYoW+4bHkLq0XVysttPdV0hnikSM0Um9HERnhSNsbn53pZXtvu/GGJ/sHzHjFk/ Oak2SEn74rtLOfN2nyfUrQlSXN52NChZuCB/fogYXWXuPcvHHKMZRWVTbL7bhPKXb1ju L6/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=F3d0+LIJRpydd1LcLJpx5zgMPpG2uno1kweVdtXY0oQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=SyenNFugZj132+F5+RfbNAN5/PqziWhaTUTF/tMGnedtjwnXOIRrYvo+u7+kzRaUWn +9W1ClcRBs3MI00j+wb0XRFm0NDhSM5MmIzx4HNQE5bnvZ1QBywFi1+emy+n2AwyZf+s xkMPBawsozBXYitExskDcEdk57Ez5Qma1o/aRad796zazNCZVDkAWscfaWxF7i5qblX2 SkehiLYNzh8Z/v7IIHk8E6aLpfkuKM/bou4Kl1LKHpU5ady6l6yg8MqJrpjU7wgQYecy yaRRH9h46H75l7K8bFV9YgWjaZKne/nFH6sDuM9N5lUbCF6BdRy528F49+fWFCuLdmeb sfZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i3/hEYS4"; 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 g4-20020a05620a40c400b00762dfc825e1si5978036qko.342.2023.10.23.11.15.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i3/hEYS4"; 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 1quzRL-00068H-Dw; Mon, 23 Oct 2023 14:14:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzR9-0005ee-Do for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:59 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR6-0008Gq-Gy for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:13:59 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1ea05b3f228so2498128fac.1 for ; Mon, 23 Oct 2023 11:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084834; x=1698689634; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=F3d0+LIJRpydd1LcLJpx5zgMPpG2uno1kweVdtXY0oQ=; b=i3/hEYS4StqHfyOejKhQszU42wyhsrnSTofC70BYmA06lGBJL3ChQpFL8+FJw5UELU Ap1JH314sTDEs0WNZyEn2z4K3UHIfWAc0XStDw5lF6l+8i9Fr//lxO7amYpTSYymvaBF ojYc7D0dlSyXAaReHs14NVpmjpmArxCVUS/Ro2/a/1ayaJYYuQMDS0n83uTz6oWWfyi5 l8UaAvbEPTuSipLsFA0smfr0Ul4F9tJcrzOLsRPUVo9S/bP96GvIAH6zwcseykmnL/hQ 1W8vwJ/vtURy/F4mOEPOURnjKtdQONVQB3IyiGE40c+5mYCgBqeWH9JjzTCP3Pizpe0N cI1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084834; x=1698689634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F3d0+LIJRpydd1LcLJpx5zgMPpG2uno1kweVdtXY0oQ=; b=YGQXNDac77J06qJ6jv+dp7WqxdPas12cKufqiVn18dsu7NxOHxA/m8OmKt+HnVq5AN 4Pio1J9LdMCQnuGONZxsc+5TGul8aJ/1UCCR+pMMmaC2UNzhLvwMwzgLnZdfuPshB07O TXEDppxzO90eRWbdxe5kzwFXQbnBi+A+dvaiFb5UgM6jcRr0YM246iKJ5AmTDygEWJ9H x7ornkteiie+n60sfGiuB6zRsreSA26WThxs5JRa8ONDZtcWbBGa4RgdZpIWJ0DzpGKq 3QzBST7GQ42gqWjiKNOpC/DOBX1j/X64L/TNW/J21QyDlm5NCMNfPlodhqz2viIx0KY2 27gA== X-Gm-Message-State: AOJu0Yy+JppwhFal9AVITfniskEH6uEtZcSHnDa4ZstUJa5zWNOh94Rg +hka3BZw4tCXZYLC1xw8S0VPdgE5Pt1A6Up22wg= X-Received: by 2002:a05:6871:3316:b0:1e9:9215:3987 with SMTP id nf22-20020a056871331600b001e992153987mr12316627oac.16.1698084833812; Mon, 23 Oct 2023 11:13:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 26/38] tcg: Use constant zero when expanding with divu2 Date: Mon, 23 Oct 2023 11:13:17 -0700 Message-Id: <20231023181329.171490-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x31.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 Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 393dbcd01c..c29355b67b 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -342,8 +342,8 @@ void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) tcg_gen_op3_i32(INDEX_op_divu_i32, ret, arg1, arg2); } else if (TCG_TARGET_HAS_div2_i32) { TCGv_i32 t0 = tcg_temp_ebb_new_i32(); - tcg_gen_movi_i32(t0, 0); - tcg_gen_op5_i32(INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2); + TCGv_i32 zero = tcg_constant_i32(0); + tcg_gen_op5_i32(INDEX_op_divu2_i32, ret, t0, arg1, zero, arg2); tcg_temp_free_i32(t0); } else { gen_helper_divu_i32(ret, arg1, arg2); @@ -362,8 +362,8 @@ void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) tcg_temp_free_i32(t0); } else if (TCG_TARGET_HAS_div2_i32) { TCGv_i32 t0 = tcg_temp_ebb_new_i32(); - tcg_gen_movi_i32(t0, 0); - tcg_gen_op5_i32(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2); + TCGv_i32 zero = tcg_constant_i32(0); + tcg_gen_op5_i32(INDEX_op_divu2_i32, t0, ret, arg1, zero, arg2); tcg_temp_free_i32(t0); } else { gen_helper_remu_i32(ret, arg1, arg2); @@ -1674,8 +1674,8 @@ void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) tcg_gen_op3_i64(INDEX_op_divu_i64, ret, arg1, arg2); } else if (TCG_TARGET_HAS_div2_i64) { TCGv_i64 t0 = tcg_temp_ebb_new_i64(); - tcg_gen_movi_i64(t0, 0); - tcg_gen_op5_i64(INDEX_op_divu2_i64, ret, t0, arg1, t0, arg2); + TCGv_i64 zero = tcg_constant_i64(0); + tcg_gen_op5_i64(INDEX_op_divu2_i64, ret, t0, arg1, zero, arg2); tcg_temp_free_i64(t0); } else { gen_helper_divu_i64(ret, arg1, arg2); @@ -1694,8 +1694,8 @@ void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) tcg_temp_free_i64(t0); } else if (TCG_TARGET_HAS_div2_i64) { TCGv_i64 t0 = tcg_temp_ebb_new_i64(); - tcg_gen_movi_i64(t0, 0); - tcg_gen_op5_i64(INDEX_op_divu2_i64, t0, ret, arg1, t0, arg2); + TCGv_i64 zero = tcg_constant_i64(0); + tcg_gen_op5_i64(INDEX_op_divu2_i64, t0, ret, arg1, zero, arg2); tcg_temp_free_i64(t0); } else { gen_helper_remu_i64(ret, arg1, arg2); From patchwork Mon Oct 23 18:13:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737265 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664106wrl; Mon, 23 Oct 2023 11:14:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzePWia8BokTMbDLXv+7nOdS1jxweK3NL1REqVnFfuRC4awmKOUlYmI2cq0THcrTJluxEg X-Received: by 2002:a05:620a:2488:b0:778:a780:a30b with SMTP id i8-20020a05620a248800b00778a780a30bmr12520714qkn.41.1698084868275; Mon, 23 Oct 2023 11:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084868; cv=none; d=google.com; s=arc-20160816; b=Sj/GG0mOh9BQ/gIESSQbu8TlRvuqiSvH1JZBMRBmTiHeeFltvd4s9woXa/iq52D3iu BMw1/tn0Ty1cr8ZnfiWZD95gT/eujUzVA7V4UfisRY1Tr1jJy+TFUgduQJqTaPq/HjaW nkc0ofEQx3zTg1pA98yojX7gH59adb2/aCk+ymjaWAxzpYQbQG9/LEODT6CUpPnIFrQ+ nq8uu8q1pviHA6qXH4GogP+j+Tqgcrd+I2b8ZJUku8RYSHpAeQx18s937cLcc0Z9jZfr MWn3IQjMlBuLpbfcbF0kcSg58A664ENdwVgV4qqoBzGD4ryF9UV+9kVt2vSE/17nKxMS yESQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QOgygXHDxUHtfSFg6wMi8J9He8Jq0o2OiYkY7oLrEpM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=cbsDDCAHxXZ3dRbThvMmPnk0vn9uMT5jToLgammvOJTXmtMa/MgvJzdJ8nTp10Vzg3 +GNy2n7S7RHrsImVRmqpF/zOQV8xG/FT73h8dUnOqJTFgXsLOTfi7caG/SnDmEFssiit i8++u7md5wcBtnh2ONtHi+6Zw/hNN1J4TqQf6DzXdeYikq6uvA2EJAxaWqlKsYlpHBYk KruzbAmMVnTyDv025UyGw8aihxOy4gLwMDBLnFK6RkjsICY9ESYfoZPDCxYLk0RV+cWL w86uq9s96DfF+yflS8jmFCNyKTe90VhkoO2Atg9m2LnvKMH7hZLRNkLqPj+CVubfSuHT LZiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PrshqDM3; 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 f14-20020a05620a408e00b00767ce9f241bsi6097516qko.490.2023.10.23.11.14.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PrshqDM3; 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 1quzRF-0005o8-Ns; Mon, 23 Oct 2023 14:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRA-0005fk-BD for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR6-0008Gx-H2 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b87c1edfd5so2722596b3a.1 for ; Mon, 23 Oct 2023 11:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084835; x=1698689635; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QOgygXHDxUHtfSFg6wMi8J9He8Jq0o2OiYkY7oLrEpM=; b=PrshqDM37Noanvu4ezPThl2V/kkmtx5+5ahssjfzCdSPfJJ+s6+ILW1AIMl/ja+OJb ll/teYNj7Ow0vTubsCIgb1Bz315I+NAPkOBkahxbjuaa5+3anBoCgjGTTfUSQAJZAVpb CQKHM5akfQ4O5Y9vncpzSC9/Bmcye7P55nZ1MLavda5zK5HwevFSUQcOkS5TDVtUo5PG J50ENOS0OWjdfbn3Ylzh+MVRcN60QOR7/mH+iG2tejg0g6rdr9SWa5lcK8HS/s3tBzcc /iGZag/Ys9aa+KJ7icZl448AsNsEdouj+IoMIWJwkrlv1BvIrSAkZV+HtP+pfx3ZZHOH 6YZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084835; x=1698689635; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QOgygXHDxUHtfSFg6wMi8J9He8Jq0o2OiYkY7oLrEpM=; b=R38Fu2g5bVOsECpGxG5jxoxLKsQB6tpwToRKhKvxleyozS5uXadUuQlNCeCEcBVKQz JGJNB/T56+ofobK/Rmt6frlrqi7xltJ9c4VBvI++KU+6up9ykPKy05ZxVJ497T6czwtw Htogk+6etaDmyvRNYBJYKPYQ9+8AH9uunp4Uu8BGYNxKimmdZY5wKCmW9ORdXXOR6Ql/ 9PvXgSrJYv/xhUvzLJptj8QdEeLm2XaUONACskVEMt5LTMwE4gGvLdgUiF0xQxoinGso LcPFoqV0+CM3M46SDn8rLN1HhKBj3soRy9Baj21nYasOcBDPiODm3JQdY7T2YJ/3Nalv 6lHA== X-Gm-Message-State: AOJu0YxmP515xfYlvR2SPVLJO6yqBV5r6ZsueCq7nAoJVTHpEiSrYE/s dZ68OfHXt7Xcb3QhYZVMfDCRV1u+0Y2qgNPzET0= X-Received: by 2002:a05:6a00:10c4:b0:6b8:780:94e5 with SMTP id d4-20020a056a0010c400b006b8078094e5mr8729053pfu.18.1698084834755; Mon, 23 Oct 2023 11:13:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 27/38] tcg: Optimize past conditional branches Date: Mon, 23 Oct 2023 11:13:18 -0700 Message-Id: <20231023181329.171490-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 already register allocate through extended basic blocks, optimize through extended basic blocks as well. Signed-off-by: Richard Henderson --- tcg/optimize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 3013eb04e6..2db5177c32 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -688,12 +688,14 @@ static void finish_folding(OptContext *ctx, TCGOp *op) int i, nb_oargs; /* - * For an opcode that ends a BB, reset all temp data. - * We do no cross-BB optimization. + * We only optimize extended basic blocks. If the opcode ends a BB + * and is not a conditional branch, reset all temp data. */ if (def->flags & TCG_OPF_BB_END) { - memset(&ctx->temps_used, 0, sizeof(ctx->temps_used)); ctx->prev_mb = NULL; + if (!(def->flags & TCG_OPF_COND_BRANCH)) { + memset(&ctx->temps_used, 0, sizeof(ctx->temps_used)); + } return; } From patchwork Mon Oct 23 18:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737284 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665077wrl; Mon, 23 Oct 2023 11:16:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvBIPoeL3yE8dDOWAszeesleZ0/BUbTD08bvaZNK7ZRN8CnVY5d1DBB/1bY/mmReMqzN2T X-Received: by 2002:a05:620a:25ca:b0:775:73f6:1b39 with SMTP id y10-20020a05620a25ca00b0077573f61b39mr10573853qko.25.1698085007870; Mon, 23 Oct 2023 11:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085007; cv=none; d=google.com; s=arc-20160816; b=Rk0+f8BmP5DIw3pA/zwXjPnb2jkssqDEDtpLFuvd4AtJxaQ08MMM+qbWlszNa9576k wSsp52IQSuZ5lz9KoDnGDyCYiqbB/O3q4DRoBJkmUQ+twPfvmadL6R1tRX2Tw3h2tPya e85bmUecTPHbzMW7qdDqRn/xKHL/ANiQG9psOAfUOnOu2V+dQnVMOtAf33Y849ive/hp LxUW7FcgxyLz9Pm5UJtgMOwCtfb2zgkg4aVDMTThV0XZfLU20LWEfxMfO871gW4ZTBvr NRNoBfKMXKr6F59h2aUBWoGL5arFhH9y2w3h9jfWnZprAd8AVMyAFDs0+HQRnRVIfW0Q kQOg== 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=i+3c/q3YHMTCq7WXcy5yo10z7tmQCbWln7ShYoiyjhk=; fh=WHbKwsB9jlgssve14/eRnAYNW4p1c+a/TobPlehjgd8=; b=SZnqkaLo8bnejj0voLoahGF1o5MD6+UDzeHks+ulVCdRe9zb2D8ED4FHGZXFdYjOyG E9LJy443JtDBf3D/+cSj9t2vNW3DXdCWc/fYE0YwPe3WTcHoBB1ieBDdBqu3Ern1aLyY rs1eSsZJgVry8Ew/jDNOmWLzJqyKg3z4S8MvmspwL1fCijwWEnfcb7TW4ct4UklprXh4 In56MxYxMuiE4iZScTGa6Ma2/NLogjhax4TLK0yUJ2JD9ltwv9PqXFMXROxBRH1xAhrA xMezHZKg8mRU60sLs7OI3k/W/IHBxMluDAXRFmGu6rpFKyANEbJaMIIV6SBApBHpKKdh 66dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZjoJGwI; 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 q8-20020a05620a024800b0076c8d5c1aeesi5490420qkn.551.2023.10.23.11.16.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZjoJGwI; 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 1quzRI-00061e-AC; Mon, 23 Oct 2023 14:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRA-0005g0-Kl for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR7-0008H7-OT for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5840fe01176so2283012eaf.1 for ; Mon, 23 Oct 2023 11:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084836; x=1698689636; darn=nongnu.org; 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=i+3c/q3YHMTCq7WXcy5yo10z7tmQCbWln7ShYoiyjhk=; b=IZjoJGwIRbcZYnoSriIOCMXL/4gz+pt+htEaHjH5/EQo547t4i0vdtbceSj2KYTV+h i++8x904Qo3ArOP8zhJLSxjeULtqWNuE7ajrP/ZzSi711i3bflcwmzEU42gj+77mEDBK SMonMEXN207HQtRvdbdVtsfta0bp7IF38vh9xO7bp/g0lO3KeSKne62m+guF36beTk72 NSdqjlo3fH7/IY2aUJwQXxvEOZY0d0ITLaBA3N+k0umkCluCBmV5K/AK4tboU48rHLEu lfhjIzN+80DBAU7Zc9JaYGqiUoA9IQ7mIU9swr3TIGXS6kqbH4bghKo1loqm0yIdHt/F M6eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084836; x=1698689636; 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=i+3c/q3YHMTCq7WXcy5yo10z7tmQCbWln7ShYoiyjhk=; b=QlqECqXRprfc8pbK1an8Wx5bLp8Dg3q7sc9tfG0ptUWeolVd4Z3aCG77kcUVb+WPOO uZftTlwjZVkye0VnpWFxpsgoz62tAMcpxbTFiN66OfRsiA+e6JoAzJRSGaRmkgzWU00e OwQJAkDorQLHMBYIQoJA1xbyit6i4y4DmtFMAw8AmZCK7zQlO3L4A848DcukM89hg5Xv Of8qMdNyO/6PxCf/F07OqDPU34eyfO9s0EUKNWS0HDDKsWfF/QB/XsV/ADIJpHWC+Ol1 UfstV9RjtKdCHf3pGSQlx8+4ZfqH6qV3+wMwf9/2ZvFxjcI2LenPm1Ite9ZyAhMjmIIT DqaA== X-Gm-Message-State: AOJu0Yy9bRgRfG6I3ok9hUzZIrl6Nclmu8edKUmtn2SMi/T+E9/qlTgG KXzxP7sPWnelGMObDlINHW8kWvpVdTX/AJo5WdA= X-Received: by 2002:a05:6358:5bc8:b0:168:e469:7530 with SMTP id i8-20020a0563585bc800b00168e4697530mr2610905rwf.32.1698084835820; Mon, 23 Oct 2023 11:13:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 28/38] tcg: Add tcg_gen_{ld,st}_i128 Date: Mon, 23 Oct 2023 11:13:19 -0700 Message-Id: <20231023181329.171490-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.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 Do not require the translators to jump through concat and extract of i64 in order to move values to and from env. Tested-by: Song Gao Reviewed-by: Song Gao Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 3 +++ tcg/tcg-op.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 2048f92b5e..56d4e9cb9f 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -747,6 +747,9 @@ void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src); void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg); void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi); +void tcg_gen_ld_i128(TCGv_i128 ret, TCGv_ptr base, tcg_target_long offset); +void tcg_gen_st_i128(TCGv_i128 val, TCGv_ptr base, tcg_target_long offset); + static inline void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi) { tcg_gen_deposit_i64(ret, lo, hi, 32, 32); diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index c29355b67b..b4dbb2f2ba 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2880,6 +2880,28 @@ void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src) } } +void tcg_gen_ld_i128(TCGv_i128 ret, TCGv_ptr base, tcg_target_long offset) +{ + if (HOST_BIG_ENDIAN) { + tcg_gen_ld_i64(TCGV128_HIGH(ret), base, offset); + tcg_gen_ld_i64(TCGV128_LOW(ret), base, offset + 8); + } else { + tcg_gen_ld_i64(TCGV128_LOW(ret), base, offset); + tcg_gen_ld_i64(TCGV128_HIGH(ret), base, offset + 8); + } +} + +void tcg_gen_st_i128(TCGv_i128 val, TCGv_ptr base, tcg_target_long offset) +{ + if (HOST_BIG_ENDIAN) { + tcg_gen_st_i64(TCGV128_HIGH(val), base, offset); + tcg_gen_st_i64(TCGV128_LOW(val), base, offset + 8); + } else { + tcg_gen_st_i64(TCGV128_LOW(val), base, offset); + tcg_gen_st_i64(TCGV128_HIGH(val), base, offset + 8); + } +} + /* QEMU specific operations. */ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) From patchwork Mon Oct 23 18:13:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737269 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664342wrl; Mon, 23 Oct 2023 11:15:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6iME9wneO62GHVjlj4miisTJXB483Wnjf862+U3qgZYBXlxq9/+qcO2u5QmQGlMLOfATx X-Received: by 2002:a05:6214:20a7:b0:66d:62a2:3281 with SMTP id 7-20020a05621420a700b0066d62a23281mr11078356qvd.39.1698084905630; Mon, 23 Oct 2023 11:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084905; cv=none; d=google.com; s=arc-20160816; b=Weqoz2v8l1jCUMW4Bflq6ZbAcZgIH3Fm0AVaTbdFUUWcV78PDobxZuQFdH2/CsrjBz cJKDhb0xylCem7RZ3/z8vVtajxz98tRj98TPrLsjO92urNRK2ja875ktIoHpuiLlgBIp N+E/IBAMmm+2nCkJfn3BVStSjW9SlU13vVYrekg8c9/l+0lQ3vqmUJA2Jh2SzqpRpbtV QpreO5Y8oP5Fi9sxIcag6m1jChu5iO8A8YGXBfSNjKZk1vvUaDl6+V2/62fhNdQM8md0 94pS0/Q0/hoEnvm+uYqpev090tk5SY/Gceb3xN7gM9pXWRi/yluUdXu54v4Acs7te5Ou Abkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/+snroCXssJGe4IIYkDLyy8cs4QbLodfmBU5jWNYWK4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=pwjzO/ncEJaN25XWWXv6F9lszF6sf3RTg4ZetpKHQxs64gSVgpJbgLqkmxx5flTK/M Z2MLsIuNWerlT3xRC/S3V4Cj3eM6VELR9epIWdT3Ar8LL5TSYSn+ju5FeEdhdwY28DdS lSc6DuJ0Xos/5MPyRu1lYlNoayRjsbyYX0zoYUtugAkXIPm7hm9Yq63FuROyTOl9h7Ha uvdxH3lgs/Z1C5opn4J/BuNgtx+obtUM+qq2Id1hoZNlJtrsPWGdiKa94RkroXN8ag3u gP41jKiudGfiTfD4VrRgHdm+3LbsiLBIKKcjPBPaWlQosNODpwcdBN/0UJI/gckN1fgm yrGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSg1ExP6; 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 g24-20020a05620a109800b00774067d659csi5917120qkk.92.2023.10.23.11.15.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSg1ExP6; 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 1quzRF-0005nW-N6; Mon, 23 Oct 2023 14:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRB-0005h7-CF for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:01 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR8-0008HH-Mq for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b9af7d41d2so2967446b3a.0 for ; Mon, 23 Oct 2023 11:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084837; x=1698689637; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/+snroCXssJGe4IIYkDLyy8cs4QbLodfmBU5jWNYWK4=; b=XSg1ExP6acc9Vzx3uYkyP4sRL8IiyVW39KX/D32XpG7+qOAFy4rMwoAz9ZPTBsfScL THZEtsDSZ0Fsh2aLROPV0piwP2w/6xuSmzxmM31eyL/DxxaZzJLZNOyO2dX1NO4CK9Bj qlEPBYeYdNjVgx7956steRX8UprdlzlB5GCqtcBhb5KPMjpbD59vvTPvFzyYlyXr5yk1 XeWZWSLWb9/f+gwXzMS7eovWHCMiFQnJolmXAfe4aQ/7/vWS2j6amEtJZgKt8Q2ku0aH INA/BGBDQDJxqu4tp3DSAY7fdeNF2zKrKR6MKaqMGKtxvDot0DgywNY55kb4S0kfbLkr pVpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084837; x=1698689637; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/+snroCXssJGe4IIYkDLyy8cs4QbLodfmBU5jWNYWK4=; b=Sbe4Xp9lyiXJ+Tq/TVwh9YGLa4fWkpojrYK3exNPXW+jxH39fZ0ah1fQ8oeQRRAOu7 822NsRIo+n/rdNphJhgIXMOWNESlAkwkdU+YgjGHwFx+4EKznloBicn9PJ4uiUAMHmN0 1NY0aKsw0yolHI92xAjatKJfDQsh+vfnj9wD3+ogL1D4HnmGKWMnq4CseC5zvlMDV7RZ 0n4S74Fm78ybFhbf25A+zwTZx6+ydIkNLRZQxfbC2roE2C8XjHhJ+TGCir5HEvahSlJk 7xv86WMROlZOyP56K34UUw7j/69wSQAcshjVCNQldtKSUfF3kEt9sNWjgriG+OtZ6RBt tB0w== X-Gm-Message-State: AOJu0YwQF3OCuwWLTOmVBgmfK05w9weox15+KZAs+jfqFb/HUJP6aklH 1dw0HAsGtL1MO8p/qWh7i5GOYEqCr1zceMnk/i4= X-Received: by 2002:a05:6a21:3e0a:b0:14b:f9b2:eb7 with SMTP id bk10-20020a056a213e0a00b0014bf9b20eb7mr316254pzc.59.1698084836703; Mon, 23 Oct 2023 11:13:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 29/38] target/i386: Use i128 for 128 and 256-bit loads and stores Date: Mon, 23 Oct 2023 11:13:20 -0700 Message-Id: <20231023181329.171490-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 63 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 4f6f9fa7e5..18d06ab247 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2918,59 +2918,54 @@ static inline void gen_stq_env_A0(DisasContext *s, int offset) static inline void gen_ldo_env_A0(DisasContext *s, int offset, bool align) { + MemOp atom = (s->cpuid_ext_features & CPUID_EXT_AVX + ? MO_ATOM_IFALIGN : MO_ATOM_IFALIGN_PAIR); + MemOp mop = MO_128 | MO_LE | atom | (align ? MO_ALIGN_16 : 0); int mem_index = s->mem_index; - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_16 : 0)); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(0))); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(1))); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_qemu_ld_i128(t, s->A0, mem_index, mop); + tcg_gen_st_i128(t, tcg_env, offset); } static inline void gen_sto_env_A0(DisasContext *s, int offset, bool align) { + MemOp atom = (s->cpuid_ext_features & CPUID_EXT_AVX + ? MO_ATOM_IFALIGN : MO_ATOM_IFALIGN_PAIR); + MemOp mop = MO_128 | MO_LE | atom | (align ? MO_ALIGN_16 : 0); int mem_index = s->mem_index; - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(0))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_16 : 0)); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(1))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_ld_i128(t, tcg_env, offset); + tcg_gen_qemu_st_i128(t, s->A0, mem_index, mop); } static void gen_ldy_env_A0(DisasContext *s, int offset, bool align) { + MemOp mop = MO_128 | MO_LE | MO_ATOM_IFALIGN_PAIR; int mem_index = s->mem_index; - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_32 : 0)); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(0))); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(1))); + TCGv_i128 t0 = tcg_temp_new_i128(); + TCGv_i128 t1 = tcg_temp_new_i128(); + tcg_gen_qemu_ld_i128(t0, s->A0, mem_index, mop | (align ? MO_ALIGN_32 : 0)); tcg_gen_addi_tl(s->tmp0, s->A0, 16); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(2))); - tcg_gen_addi_tl(s->tmp0, s->A0, 24); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(3))); + tcg_gen_qemu_ld_i128(t1, s->tmp0, mem_index, mop); + + tcg_gen_st_i128(t0, tcg_env, offset + offsetof(YMMReg, YMM_X(0))); + tcg_gen_st_i128(t1, tcg_env, offset + offsetof(YMMReg, YMM_X(1))); } static void gen_sty_env_A0(DisasContext *s, int offset, bool align) { + MemOp mop = MO_128 | MO_LE | MO_ATOM_IFALIGN_PAIR; int mem_index = s->mem_index; - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(0))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_32 : 0)); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(1))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_ld_i128(t, tcg_env, offset + offsetof(YMMReg, YMM_X(0))); + tcg_gen_qemu_st_i128(t, s->A0, mem_index, mop | (align ? MO_ALIGN_32 : 0)); tcg_gen_addi_tl(s->tmp0, s->A0, 16); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(2))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_addi_tl(s->tmp0, s->A0, 24); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(3))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + tcg_gen_ld_i128(t, tcg_env, offset + offsetof(YMMReg, YMM_X(1))); + tcg_gen_qemu_st_i128(t, s->tmp0, mem_index, mop); } #include "decode-new.h" From patchwork Mon Oct 23 18:13:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737275 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664593wrl; Mon, 23 Oct 2023 11:15:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiCEpW5ibBQKLVcwIQpLpJnLSdlYZtAJNxj+z95DtP68NoQdoZyCdGau+ZGz3v3UUIsATO X-Received: by 2002:a05:620a:190d:b0:773:c864:35aa with SMTP id bj13-20020a05620a190d00b00773c86435aamr12926962qkb.26.1698084940000; Mon, 23 Oct 2023 11:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084939; cv=none; d=google.com; s=arc-20160816; b=aOzW5JnjY6LUa0rE1ibxikfXMkYnfK090kuaOQG04QOf+6OBIK3gjmWs3zeS2RTJtO kCoIfd8/45MvXtVuZmsq7mu7U/qwNnbbZv1iKdT+CAkQSONvgDMKdYfbHG1ehVW0e7+I aQx/TYqlKSD3PtDrVQ9StGc9aKzdjyKc1EHHu+G0MLvZ2VIv27dJ4W8DJmTzg2RcpRaH fD0Z7TmaNmYFqOvctHE99OrFGtUh8JeVD6gYyt5JucH5Dv+g4KWXWl3flb6ndzJJO3SA 6KsqThVVICcclAJzp/kYhXgSIqg8c1RqFE+l0n3ytQDBr3UdzK5+Sivw2olROtszvWHH KiWQ== 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=3PSV1d0+Nd9u1BeAFewAMmI3bPYXAWKfgIrndrhftjU=; fh=OTkfrEnbNDInppsfj4HB8z6V33zCj7LOct256XBfW6M=; b=ZmW9ZI1F3k+GYFknsAwi9gbycwJOd+h2qvdzyvnBdJ/1rTXvbMTo4zibJuH7rzmCMD XLQH8aw2ZOUJICKAHRTHLZWWG8SH46zMhjSxmAOMpUwUUqfQt0v7E2yR3SBYOGpsn6PI +QiSBDwhLhFLMqoZLu6GPTJyDa2ArDvQ7slqAzhJeyZyMCeAm/8RqlnHZ2uGRg2mPfeD aUHyLxR0tEDDaLumMHmz0Y3TEe9CBytkHS2LH/ji2pqEq2w5O/Nry4Q//cRtP1rgxpBF 4LQ25JHilBjjg0hfGqYO2FHqn9IF4K53DHLHvnVn+xf5OyUVw8RxBqcwawnzO8qhe781 /SAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BL9aQF2l; 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 h9-20020a05620a400900b0077568858eb4si5862884qko.559.2023.10.23.11.15.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BL9aQF2l; 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 1quzRS-0006EE-66; Mon, 23 Oct 2023 14:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRB-0005h8-Cs for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:01 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzR9-0008Hd-BM for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:00 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so3585052b3a.0 for ; Mon, 23 Oct 2023 11:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084838; x=1698689638; darn=nongnu.org; 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=3PSV1d0+Nd9u1BeAFewAMmI3bPYXAWKfgIrndrhftjU=; b=BL9aQF2lHkAHP1eTr96IYV/dM6QUqd7Sb0iHbDzdieZt5Ubpw+IyidJZGm51jugnhk ZK2Xc8Y+uIFhXW1aLJ/9NEYUFEqhcOMrS+LOL32UDSaiGC+CixuHRW92kbFmhn/3vnRq MqAvDJpI1ndUQTqTZHfdFS0wI7ZlNq2UNjwTUW1IYzMBNXeIdvHsBcquMurYXZfDubU4 xsO7ol0/6J+hfjxd0xVJf9lLI48O4TSJx4VrvEECiifi12phWCeEcGS+pv27hNJ4DBHG NDTVwwM23emKVmUXlZCTybDUbsSvleUmiNd1Bu2/UO93S6+8zLa2+8d6QGbOVlCxtmyu IAhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084838; x=1698689638; 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=3PSV1d0+Nd9u1BeAFewAMmI3bPYXAWKfgIrndrhftjU=; b=fuO30cjx3mMwIiRQI7/tBHsSIVD+Tz/3jHICmkL4O2BCE1O4kAR/XSD7TubijJhCtP U7ETZqfPPTRM3INJvEAp7lgEO9BVwvcUH700IBo9BY9HSGPiXjYfrj0V7aC6tuUq/b95 S6/jnddrtNPIsUnKFgAtvT8/FVH18FsaqJtFTQYuLejLvab6CD8dnYfJxXrhzOM+LtpG SdIVv2SitXYRj5kdmoB3MFhx99IpQwfKJR1y5DG3wYCjg4adX0qwVDWe/Va6ZIjAgAkY UUKMbO1BBICPqNn8m3doM3GP7Nc7nNMD57O+Lhcu6QRADmPZGe3bCzohyg1gSHpBhAM/ OhZQ== X-Gm-Message-State: AOJu0YxmvwRp7pa9r+Se5xxwkvqYLFS0tjbu6iHOyayTj/sPfS3IWzhZ UvGc9sB5v9RMSKpi27vIbE0t+FA9cnwI/7oFTjw= X-Received: by 2002:a05:6a20:54a9:b0:174:c134:81fa with SMTP id i41-20020a056a2054a900b00174c13481famr450321pzk.17.1698084837515; Mon, 23 Oct 2023 11:13:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL v3 30/38] tcg: add negsetcondi Date: Mon, 23 Oct 2023 11:13:21 -0700 Message-Id: <20231023181329.171490-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 From: Paolo Bonzini This can be useful to write a shift bit extraction that does not depend on TARGET_LONG_BITS. Signed-off-by: Paolo Bonzini Message-Id: <20231019104648.389942-15-pbonzini@redhat.com> Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 4 ++++ include/tcg/tcg-op.h | 2 ++ tcg/tcg-op.c | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index 56d4e9cb9f..a0bae5df01 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -346,6 +346,8 @@ void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); +void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret, + TCGv_i32 arg1, int32_t arg2); void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2); void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al, @@ -544,6 +546,8 @@ void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); +void tcg_gen_negsetcondi_i64(TCGCond cond, TCGv_i64 ret, + TCGv_i64 arg1, int64_t arg2); void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1, TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2); void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al, diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 3ead59e459..e81dd7dd9e 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -199,6 +199,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_setcond_tl tcg_gen_setcond_i64 #define tcg_gen_setcondi_tl tcg_gen_setcondi_i64 #define tcg_gen_negsetcond_tl tcg_gen_negsetcond_i64 +#define tcg_gen_negsetcondi_tl tcg_gen_negsetcondi_i64 #define tcg_gen_mul_tl tcg_gen_mul_i64 #define tcg_gen_muli_tl tcg_gen_muli_i64 #define tcg_gen_div_tl tcg_gen_div_i64 @@ -317,6 +318,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_setcond_tl tcg_gen_setcond_i32 #define tcg_gen_setcondi_tl tcg_gen_setcondi_i32 #define tcg_gen_negsetcond_tl tcg_gen_negsetcond_i32 +#define tcg_gen_negsetcondi_tl tcg_gen_negsetcondi_i32 #define tcg_gen_mul_tl tcg_gen_mul_i32 #define tcg_gen_muli_tl tcg_gen_muli_i32 #define tcg_gen_div_tl tcg_gen_div_i32 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index b4dbb2f2ba..828eb9ee46 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -291,6 +291,12 @@ void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret, } } +void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret, + TCGv_i32 arg1, int32_t arg2) +{ + tcg_gen_negsetcond_i32(cond, ret, arg1, tcg_constant_i32(arg2)); +} + void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) { if (arg2 == 0) { @@ -1602,6 +1608,12 @@ void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, } } +void tcg_gen_negsetcondi_i64(TCGCond cond, TCGv_i64 ret, + TCGv_i64 arg1, int64_t arg2) +{ + tcg_gen_negsetcond_i64(cond, ret, arg1, tcg_constant_i64(arg2)); +} + void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { From patchwork Mon Oct 23 18:13:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737270 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664348wrl; Mon, 23 Oct 2023 11:15:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOdtwCL2sxqyu/aY+3N/WJjXs+SrH3JYSZvndOams26BDhgdPctIxj3+5oRfjTEgsuUXzf X-Received: by 2002:ad4:4eaa:0:b0:66d:620a:9486 with SMTP id ed10-20020ad44eaa000000b0066d620a9486mr13759710qvb.26.1698084906605; Mon, 23 Oct 2023 11:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084906; cv=none; d=google.com; s=arc-20160816; b=d1YZbVDZqrzXlM1abj1gzf2+rsaNXbqMrLyav0ZlnvNcdTll4alcSF7VQlpdcBx7bw lg2OPPZjzXH+h4D5GLutLhfREgdg0yJ2ZzqInfytyXgw+6Ii7VRbXljz1/Y1dR886Hx1 gcigJ+zj3Xi7ojHnbBfn1lJcHqmgSk+LsfbwWtVk+bVlQL36s44IEMc+226Rq6hdcnSB gm9SyeU+bFy9w1r35Zbu3nrNA0XvyySB1nIjnt6yJXoIn+2/giYxvJ61XFqfTQEtkeej L/7VXGxWc+Fz+i0RBkR84d/+8DPbqztydGXEfOcBQhZ96usPv3cZPOi6BAg+wq9xEO2U HgXg== 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=gvOyipzTKG60zeb6vbq80oIWpFAQowpjRgOLngWjDDA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=QifliBixwA2DTPwCe8+n6hClSHsFv5A9HUaxMAfEWjk/m+nHU2YK19rIr2ogmXM/cx 7a4naJLcl6c/Msgr64U9URVFO707sVuJ0Txji6EnU2wG1fggNGz/KHbT3bUaXiLz5tBv bsr8gv8S4/k0TvoGq5awT0dc2ATtCNn8h+xA2r1TKEO6qzjPoTX9I5tBUr404ZKfpUpg KeXeQKn8DjUgd6fTf9qpu3qIFGQ7Tsve1MiaJRNhvN3pnDjeja5f/Uo0+05MJIE4WVNB +iiE68PosK/eTviUTuFcUUAHVjpBX17dL2JUGD8P/CXmQ7gEl+0KtiSKQL+Xoe4zVOan kLBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QiLcaNk4; 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 me13-20020a0562145d0d00b0066d101766d5si6219558qvb.569.2023.10.23.11.15.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QiLcaNk4; 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 1quzRF-0005on-Uy; Mon, 23 Oct 2023 14:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRB-0005iO-Vo for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:02 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRA-0008Hw-9h for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:01 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-581b6b93bd1so2157722eaf.1 for ; Mon, 23 Oct 2023 11:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084839; x=1698689639; darn=nongnu.org; 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=gvOyipzTKG60zeb6vbq80oIWpFAQowpjRgOLngWjDDA=; b=QiLcaNk4GMT8ig0h/sK+3t5Mqr61JUoSHjahvMuPC0onI6Qat064ujBKDbrmPYcaOj TTZsiT8HEQmm2d+8L6hLbt3AQttUaDaDTk7tfBC74vQkFzNrK3GnjXxsagr1H8Rm0+aX jOd2t+j4DI+oswv03v0ihXXLkKZkHPnwryAdfDGJWN64ZdoJX3lHa4r52UnfKixBYDLy D/6mhNXH3lgwpd60dIrOS5soQbiWisc5aEIALRwyVlLHrQv/fFjXjSJxeEDy6sByquNA f5+3/P89oKrQhi9XZF3bEVr83EEwHtyXeLo0sQxGxOBo2OXbigxt0i3Ixw+0sGOese/D Jg9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084839; x=1698689639; 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=gvOyipzTKG60zeb6vbq80oIWpFAQowpjRgOLngWjDDA=; b=ds1LWjLXoV13yvM36QJVXoVUkAPZjbVn3O1xemNP6MD5a/y+UivmvOHMOIGE7stAjN crtskx+vMndq/JuNedtW9Ec8meGuh2avTHLI0r67hVC/n3rTCJTAyt6KtZRZTpTXpPIJ U9iM7fRhslwl4Cui1PBMXnhn8TemfQaKdXyXMZkEANViPwcDUqYBJNWYVIbs/wrPWfRQ OaYYxGl/58pi+BcUhH1sQyDavSUr6uOcuERSquKG/JPTlxvFZFltm/4ElqFpsFGHtC+d Vto9F7VfXP85maBW9kg8eomtgD8Eph9YB4RTSUfMLORFZSGVZ5Eed/7L7fmPNwfD8o/7 Aqqg== X-Gm-Message-State: AOJu0YwlRTVt1nMaUwtsgZktsCSqyBiSf5kMJaDZJeJp+ccgapQ/JkgP iUKmkcUi58OJZac1YNL/vn3nXDmXHgM2QFRGCGU= X-Received: by 2002:a05:6358:f0e:b0:168:d3e7:5ee6 with SMTP id b14-20020a0563580f0e00b00168d3e75ee6mr5751410rwj.26.1698084838990; Mon, 23 Oct 2023 11:13:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 31/38] tcg: Export tcg_gen_ext_{i32,i64,tl} Date: Mon, 23 Oct 2023 11:13:22 -0700 Message-Id: <20231023181329.171490-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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 two concrete type functions already existed, merely needing a bit of hardening to invalid inputs. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 2 ++ include/tcg/tcg-op.h | 2 ++ tcg/tcg-op-ldst.c | 14 ++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h index a0bae5df01..677aea6dd1 100644 --- a/include/tcg/tcg-op-common.h +++ b/include/tcg/tcg-op-common.h @@ -361,6 +361,7 @@ void tcg_gen_ext8s_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext16s_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext8u_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg); +void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc); void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags); void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg); void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg); @@ -564,6 +565,7 @@ void tcg_gen_ext32s_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext8u_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext16u_i64(TCGv_i64 ret, TCGv_i64 arg); void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg); +void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc); void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index e81dd7dd9e..a02850583b 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -219,6 +219,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_ext16s_tl tcg_gen_ext16s_i64 #define tcg_gen_ext32u_tl tcg_gen_ext32u_i64 #define tcg_gen_ext32s_tl tcg_gen_ext32s_i64 +#define tcg_gen_ext_tl tcg_gen_ext_i64 #define tcg_gen_bswap16_tl tcg_gen_bswap16_i64 #define tcg_gen_bswap32_tl tcg_gen_bswap32_i64 #define tcg_gen_bswap64_tl tcg_gen_bswap64_i64 @@ -338,6 +339,7 @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) #define tcg_gen_ext16s_tl tcg_gen_ext16s_i32 #define tcg_gen_ext32u_tl tcg_gen_mov_i32 #define tcg_gen_ext32s_tl tcg_gen_mov_i32 +#define tcg_gen_ext_tl tcg_gen_ext_i32 #define tcg_gen_bswap16_tl tcg_gen_bswap16_i32 #define tcg_gen_bswap32_tl(D, S, F) tcg_gen_bswap32_i32(D, S) #define tcg_gen_bswap_tl tcg_gen_bswap32_i32 diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 2b96687699..e2c55df217 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -714,7 +714,7 @@ void tcg_gen_qemu_st_i128_chk(TCGv_i128 val, TCGTemp *addr, TCGArg idx, tcg_gen_qemu_st_i128_int(val, addr, idx, memop); } -static void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc) +void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc) { switch (opc & MO_SSIZE) { case MO_SB: @@ -729,13 +729,16 @@ static void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc) case MO_UW: tcg_gen_ext16u_i32(ret, val); break; - default: + case MO_UL: + case MO_SL: tcg_gen_mov_i32(ret, val); break; + default: + g_assert_not_reached(); } } -static void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc) +void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc) { switch (opc & MO_SSIZE) { case MO_SB: @@ -756,9 +759,12 @@ static void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc) case MO_UL: tcg_gen_ext32u_i64(ret, val); break; - default: + case MO_UQ: + case MO_SQ: tcg_gen_mov_i64(ret, val); break; + default: + g_assert_not_reached(); } } From patchwork Mon Oct 23 18:13:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737280 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664836wrl; Mon, 23 Oct 2023 11:16:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtf4/PR8kdtqKZMjriLTFuTXTGkn5AW/x79V98Aw7rGrWaeRxepyy4LQ3Y79MWWaOu0z0v X-Received: by 2002:a05:6808:a1b:b0:3a4:225f:a15b with SMTP id n27-20020a0568080a1b00b003a4225fa15bmr10421331oij.31.1698084969387; Mon, 23 Oct 2023 11:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084969; cv=none; d=google.com; s=arc-20160816; b=sCSTtHVJmzEdArYM1jXL4DdRPVle/LlfInsQBODv3IwYiHpJ5T2MfQ+CLp61FMtaco unspbU1pFc8N6NyXnhmv3LcOvJxS8FAdLRQo+xyyE4TddsbrkOi2rXsTgaVXgPwpAd7m 6dt+7020fW9i1oKYBg5MlMmc7Kd5RAPrhDSttCVKGWb8eeOwoU3qrAGLLy+6tjIcTv8I pqQKh5uetbHytrXGT43ce6edHER3QAjr108Seu151hmPLI8XZnj9CW0P6VTLog2kHtol C9b2WzeR/N0m5yMSIGkD7DmfDihz9TOlDu3MZ8KG7fWn6zTlFJArMlHRStK+0f/fs9H4 52+A== 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=zU+v3676qRcEsyxppjdiDrJD+V8v/rvklw88kLBv4us=; fh=OTkfrEnbNDInppsfj4HB8z6V33zCj7LOct256XBfW6M=; b=K8KWbVOXKw+j8dJ/0526WgcDtdWArF0ErZku6Y7H/K0qKlzMD3JVHr0xX/8Jk2P+pW PjNW7K8vFvivn1rruEnnp4M6hzfaDlJWSNfh87u7BxOMLC/OuK1RSNEykJkNhBrnsmBQ 2k+wMOcQJUJ0vNqC7QKw6FO9qk2CgVWvyRew/2c9un6ImaViqgyIeGnT5X4ZgeBqhhuG cK9uz/wGrp0gL0pdd9IPfOrkWNdsaYlWwHN9IlPUhCGuFnDyiebGVHVNPDex/ysqMWN9 Qd2rDlH9D/y8vJ8AW5y9rBbHJDWgyo6fwfWqj5l9ObkxEAnwP6Q9w7hIwEfZejmGs075 EZaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=thEWhLrv; 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 ee12-20020a0562140a4c00b0066d36b953f2si5734957qvb.407.2023.10.23.11.16.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=thEWhLrv; 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 1quzRG-0005qs-Pk; Mon, 23 Oct 2023 14:14:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRC-0005iy-Pg for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:03 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRB-0008I5-5M for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:02 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5842a94feb2so1970730eaf.0 for ; Mon, 23 Oct 2023 11:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084839; x=1698689639; darn=nongnu.org; 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=zU+v3676qRcEsyxppjdiDrJD+V8v/rvklw88kLBv4us=; b=thEWhLrvBKwu7FLa/CVVfGnBCoYRTjw9MkS4oe4mtnQl5XA06TilmiEeghPFaCoDSf 0eVnNI0rUjWEOnBNPD5j3lF5ICNBLoNFkA+vFd5jm74PPdTWXU/EgF17rR/TIhlrUwje vNY8WjJ9CYEjFZ6yvouNrHYjTWgc+l3VsUk5r2tuQId5l6Q/6dQjd+xd7c3bglZf9/pv zmMb50p4jVZjmeZbBa2rRuUkB5Ib64QRF8fi6ZXMqsa4WWjZ+c4Kz9y99f6UjZx0DI+P CuetvCRXeV+7BoK+wcXaSC3+w68iYdhQqn6a8y4hImyX+1H0YGVLqp6oXvsJLU1LgF6C mNgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084839; x=1698689639; 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=zU+v3676qRcEsyxppjdiDrJD+V8v/rvklw88kLBv4us=; b=WGmsr48Q/plRlwi8hZkKkDjJU5xF351Wu/tNjoIeGyWKWppZ2r6MLombJDxVa25ZCY vQANa2lJULdNMuQqxbaoUTM8FoJHtBRotIWYNALQU/T7tfUbFwiz0ubz/8B7VSEYu3BM qMZ6c5YgcJYX797bLrF4RcN2H9w1r5O/V7e1Ag9Dg3MMK3Hg+WB/zpEyVovrjuwYJr2F iDHDbNq/aJrOJJ5Q323CKH7W+Y5Ii1/l1O1CIYT5gEywWcq/7XUchoaH54IDzJeC1kbR rQe+Wl+YsNo/GT3Iss5HXEcGFVJRsMljl8kshQk+Vs3c1QtsMxWVW01XVsQnyuOTELSs RgPQ== X-Gm-Message-State: AOJu0YzpbCV5oPLjiKXSEotUcmgW58t3a5wqtw2lV8C3TZJui9B9YhtE vCtkGDP3DTejM9+khxbmFgGjyb4dVJy+DBPkJ38= X-Received: by 2002:a05:6358:1a9e:b0:168:e3e1:11d5 with SMTP id gm30-20020a0563581a9e00b00168e3e111d5mr2539604rwb.28.1698084839703; Mon, 23 Oct 2023 11:13:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:13:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL v3 32/38] tcg: Define MO_TL Date: Mon, 23 Oct 2023 11:13:23 -0700 Message-Id: <20231023181329.171490-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c36; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc36.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 From: Paolo Bonzini This will also come in handy later for "less than" comparisons. Signed-off-by: Paolo Bonzini Message-Id: <03ba02fd-fade-4409-be16-2f81a5690b4c@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- include/exec/target_long.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/target_long.h b/include/exec/target_long.h index 93c9472971..3cd8e26a23 100644 --- a/include/exec/target_long.h +++ b/include/exec/target_long.h @@ -29,12 +29,14 @@ typedef uint32_t target_ulong; #define TARGET_FMT_lx "%08x" #define TARGET_FMT_ld "%d" #define TARGET_FMT_lu "%u" +#define MO_TL MO_32 #elif TARGET_LONG_SIZE == 8 typedef int64_t target_long; typedef uint64_t target_ulong; #define TARGET_FMT_lx "%016" PRIx64 #define TARGET_FMT_ld "%" PRId64 #define TARGET_FMT_lu "%" PRIu64 +#define MO_TL MO_64 #else #error TARGET_LONG_SIZE undefined #endif From patchwork Mon Oct 23 18:13:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737295 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665918wrl; Mon, 23 Oct 2023 11:18:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElOXnd6t0sm4IqOWoKaBnnhK1ybb64s/X390rtZYrSNvGHU6XVrUtoSzL07SjIZ0x/kJzu X-Received: by 2002:a67:c211:0:b0:457:de3b:9b32 with SMTP id i17-20020a67c211000000b00457de3b9b32mr9164297vsj.18.1698085116983; Mon, 23 Oct 2023 11:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085116; cv=none; d=google.com; s=arc-20160816; b=N0EJGpUs/H1aSomhiwJLQ/8Rw7SA0UYxJ+qygX3sEJV3nCfZmHk6fcrnWAuuZXzbgn 3mjDm07FD9/TyyqEOw/b7mwExu1x4FiOncxB5uyK6cGNS3IgrFXX9bcz/FTCzOz08T6B H9ITGmerz8v+1x9QoZhSLmeX2pLF5k7Az/4lLUDolcnpV44AgeeRE6Mt3De/ISqUFYCq btWOjvEPhAK+TJ3XaMv2PwA2uzfeWdhQuwWFPwqVfRHZQVkD+Ue5YzSo91YwUu+VrygB hG4R3mRDXzQZMdQ5F9X4Ai/lPmJmXSceiXngtQPuyr9m1dV9jYWaxX1YLQDw59n3hpti X7HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=T4DZaKL6rPO4eOmJB5sgPBMNx7MhU9e4zPB2kNBWFXU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OUxrbcP9Gtw8oSIuBAxSfJKA/u/q297kDwUTY2VkceEsftciUREsikpzl6z2Z4HQ4M MCrb11ayJLJeddbdJcyCIaIZVDZ/hjSnHjnZNPmPPb28OwodKDBijwxEcjIY4ei7xG1Y lkVMxf949u2hkEhkQ+0zXNbLAI2TjQGVurNvsS57nTzCEKowt8OyM//DRdjvQOcRM9aF vQLFUIlpWZzWGtaDjQPeivDJ3yB0/9A8rrI2tlGbtubD3Jx49BZ32yLvW+JMjPFFS+Y8 R8b6fGZLh9CQsIiv8+Z4fiGTsRSXAmsXgGkVw5Y25cMLaswX3PSxNxu8Vg3XcFGtqioJ eJSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=olsCo6+e; 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 qs21-20020a05620a395500b0076d40ceedd8si5847903qkn.722.2023.10.23.11.18.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=olsCo6+e; 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 1quzRH-0005tO-6u; Mon, 23 Oct 2023 14:14:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRE-0005jr-7x for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:04 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRC-0008IK-Nn for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:03 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-581f78a0206so2091547eaf.2 for ; Mon, 23 Oct 2023 11:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084840; x=1698689640; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=T4DZaKL6rPO4eOmJB5sgPBMNx7MhU9e4zPB2kNBWFXU=; b=olsCo6+eTtThKj8CnIcjq9KnsnjYyL4kCeUg0aj7hRS8Z2b2aGsacBGjH9HnX0pRQw OyOLBXmL/UN6wQmaPOYERRRqi5IbBseAhrsRrVqn4u8MiRi/AdbvZcRFBgejPtRggeCU nLcijn18T6hgpafL56PEDHp+1hrfFUxjOBZv4NnunGl3/TBk5bLiYJuR/JLg4bG2XtvY viIfqukZkdgTGiRXX4TFsiGnO2ip021JkG3EJmbOay/A3/86zb2Cwp7RWXO5119BmcBX A7An5tjB8H6zYUl0UOAD3Rw+/Qk3Hdy2JXx0AGUfrLZt3Gz2Kp9+Q+vHQ1xxOaWFvrje vq1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084840; x=1698689640; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4DZaKL6rPO4eOmJB5sgPBMNx7MhU9e4zPB2kNBWFXU=; b=wEY1AKfS0q6Rgh4i20IdCoA2Vbz0/pWKdXgCN0LS1+lryaITGh4icn3q9fRn3/eEAu 3B5Wucw99Wvr72PzIDLiL8XKsTtAkG6o0Gq6mkf/CQCbJk+0T8i5A6iHB9ERhImQ3YRZ 5VSpEAW5CSDw71sEa1SNiDHCz0NaVM7wdNbMl40bLTIyWARQv+FVI19kj1LS4Juh0N9Z FXD+RB24RzNInwif34fmZSlHbQvg9ZihzXyE96gOzllg1+YoQ76zEX7iILcNwz88Ja5P sBjNqKlgWM7JfozMldnKAH1e0iF1zHIANt/0brbprRcAPYeeCyxaOVg645xJAKWKWgOd p65Q== X-Gm-Message-State: AOJu0YzlIFtTWBbRw5GxwBMom2HehW60bIWj/Ii50L/WBdFP3WRXLxel A/WuUBRb6snMmB/392hByrHPIEsh7g4fpq+hhXE= X-Received: by 2002:a05:6359:6c11:b0:168:e697:ce0d with SMTP id tc17-20020a0563596c1100b00168e697ce0dmr1980721rwb.31.1698084840509; Mon, 23 Oct 2023 11:14:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.13.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v3 33/38] target/arm: Use tcg_gen_ext_i64 Date: Mon, 23 Oct 2023 11:13:24 -0700 Message-Id: <20231023181329.171490-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.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 ext_and_shift_reg helper does this plus a shift. The non-zero check for shift count is duplicate to the one done within tcg_gen_shli_i64. Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 37 ++-------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 10e8dcf743..ad78b8b120 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1324,41 +1324,8 @@ static void ext_and_shift_reg(TCGv_i64 tcg_out, TCGv_i64 tcg_in, int extsize = extract32(option, 0, 2); bool is_signed = extract32(option, 2, 1); - if (is_signed) { - switch (extsize) { - case 0: - tcg_gen_ext8s_i64(tcg_out, tcg_in); - break; - case 1: - tcg_gen_ext16s_i64(tcg_out, tcg_in); - break; - case 2: - tcg_gen_ext32s_i64(tcg_out, tcg_in); - break; - case 3: - tcg_gen_mov_i64(tcg_out, tcg_in); - break; - } - } else { - switch (extsize) { - case 0: - tcg_gen_ext8u_i64(tcg_out, tcg_in); - break; - case 1: - tcg_gen_ext16u_i64(tcg_out, tcg_in); - break; - case 2: - tcg_gen_ext32u_i64(tcg_out, tcg_in); - break; - case 3: - tcg_gen_mov_i64(tcg_out, tcg_in); - break; - } - } - - if (shift) { - tcg_gen_shli_i64(tcg_out, tcg_out, shift); - } + tcg_gen_ext_i64(tcg_out, tcg_in, extsize | (is_signed ? MO_SIGN : 0)); + tcg_gen_shli_i64(tcg_out, tcg_out, shift); } static inline void gen_check_sp_alignment(DisasContext *s) From patchwork Mon Oct 23 18:13:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737294 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665911wrl; Mon, 23 Oct 2023 11:18:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIroDxwFMDRN67d/I1ei5qzrBPmqt+sv6pD1F5oi5snbIXCRdil0Nu/eQQLsefVPYS6MUs X-Received: by 2002:ac8:7f0b:0:b0:417:fe9c:6dce with SMTP id f11-20020ac87f0b000000b00417fe9c6dcemr12885494qtk.25.1698085116474; Mon, 23 Oct 2023 11:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085116; cv=none; d=google.com; s=arc-20160816; b=kQ/CAZ1uoPBoihUAzsiYgwrpk5EfM2P+9pEll7RGJFYWKtqkcQXr2z4vdtbWvYhBTM tq6mirSdMr+KFlc+Wxa0HZ4L2oyL8hbkZubom8BFFFw156rW7KzfJHZKo4gILwsl3nlK RX98BQ07I1umeZvINZsGtt98HBvfsqfKUgMl9sgnL5ljpE6JRnzJ9MT0XsSObrPKGGXK fJyuCMQQk/WsRv6jddTDZ0ZuWYaXsciAWwaEdknKtEHmUjLpE5NtcJ5oShb6tlxJj2j7 ogfgb9w2aWHPcTW+uuBANL5U/P9KNIsmLGTKfVWfv/V5HCzs+jgLeMtMmUiEc0G+Y9yY Unsw== 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=MhCC9XTd6nS9RO+tM5LcavZGdQ2zIqBqYuneDU4EEqo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=fCSV2Tt+Re1UjQQ0pWmSSgLGnugu7XNrG8iz925rRqfev1eXXnL9qZJLownAWQgC1H kF3BmLG03DfpxPcG8yuWPpscxeiQUOLZiD9CVM6HlUr0eLw2AkibtqJ+XqmAwLEChB79 bcoDVm3ioktdCHfQe4lF5dkFEczGfIbDTGv+5fcnRxICSzPzKRKLnLbV3Zeyu14ZVKYr WASCE/Hhdmziksybwx60Ja8NK3MYtXA316YCOGDMbG+uuajkfdIaRdE3cZSbZxz7nfZ0 xRHj8LxmZiv3C+Z6ppVtvxlYEzn4LolGY5iLDct+vu2e+IVj2IPhkMOZeFGgafexjmLr X41w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbQFiyYu; 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 s11-20020a05622a178b00b0041981d576c3si5519387qtk.595.2023.10.23.11.18.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbQFiyYu; 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 1quzRI-00061o-AJ; Mon, 23 Oct 2023 14:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRD-0005ja-W5 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:04 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRC-0008Ic-GD for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:03 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-58441865ffaso1326698eaf.1 for ; Mon, 23 Oct 2023 11:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084841; x=1698689641; darn=nongnu.org; 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=MhCC9XTd6nS9RO+tM5LcavZGdQ2zIqBqYuneDU4EEqo=; b=EbQFiyYu1JIWNdonw6t1qltXCI1VT/lz2m34STwT3n7F5RrcLOLguQ9Eq8kGd92aeW pRZ5JAhxcgToafDdK6rQAY8q8MOiYnyaABG1YxpOH+HYbSvh/7ETXNYUIY3GpWEdNMUe QPiz3Bqb8wfVQcNzkJrcM8cvTJ0oC9f/+nPkAxRjIsahB6QejGVKPnnE+e1QjCdYW7z/ 5tEXlK3vi0bG/NWUy3jbJ3F/NbkTmXnoHHVLyhl2hgN2VxZnzKLiPBMQbUON2PtFzERy FAAy1O1Is/aQdfntwfA+8vYo+sH6RQa1vKA11qbv2IJ+PeRqxn+MXLxeAJCs5GOorsUT Du1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084841; x=1698689641; 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=MhCC9XTd6nS9RO+tM5LcavZGdQ2zIqBqYuneDU4EEqo=; b=qOUEgKYJNNCcqwPz49/a1InaXX9Yjq3LlilWF97ruQ7F5k65pNUqsnCnVuT0kThldt vZO429Ob5hUQe+l9zyuQABkH48yEZP3Z4yMgGVv2TFfkzoSYSeTYsNE2F4WItLTScPwQ PvxrcvlFEFohTKlJpMHOXzDC1XR4aBAbnyYY3XLhA177hs5zMJiDGhv6FXt7ezfHR/pr kSndAIE8/a95BzE1/O76bDYNtNfk1bLBAhE/jDo5TgZH8QBSSYb8eDZhoHvb/3Q7muLK z99WHFrCPHHpKaOt4yNyZEwW1bwXh0wCaN5GGGdbUQc12071ccGb1KBfPiX5OA+rWUx/ fqPg== X-Gm-Message-State: AOJu0Yy/9ZQDGGC//ahreRJS/7rk1IwA2bEXNS0VxmJ3uegOIGGKiQ7d IioRq8Z2B54aiGGTiudXuvOVakQ7/GjzA/9c35U= X-Received: by 2002:a05:6359:593:b0:168:e9d2:6568 with SMTP id ee19-20020a056359059300b00168e9d26568mr1568841rwb.25.1698084841422; Mon, 23 Oct 2023 11:14:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 34/38] target/i386: Use tcg_gen_ext_tl Date: Mon, 23 Oct 2023 11:13:25 -0700 Message-Id: <20231023181329.171490-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c36; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc36.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 18d06ab247..587d88692a 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -701,33 +701,11 @@ static inline void gen_op_movl_T0_Dshift(DisasContext *s, MemOp ot) static TCGv gen_ext_tl(TCGv dst, TCGv src, MemOp size, bool sign) { - switch (size) { - case MO_8: - if (sign) { - tcg_gen_ext8s_tl(dst, src); - } else { - tcg_gen_ext8u_tl(dst, src); - } - return dst; - case MO_16: - if (sign) { - tcg_gen_ext16s_tl(dst, src); - } else { - tcg_gen_ext16u_tl(dst, src); - } - return dst; -#ifdef TARGET_X86_64 - case MO_32: - if (sign) { - tcg_gen_ext32s_tl(dst, src); - } else { - tcg_gen_ext32u_tl(dst, src); - } - return dst; -#endif - default: + if (size == MO_TL) { return src; } + tcg_gen_ext_tl(dst, src, size | (sign ? MO_SIGN : 0)); + return dst; } static void gen_extu(MemOp ot, TCGv reg) From patchwork Mon Oct 23 18:13:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737276 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664740wrl; Mon, 23 Oct 2023 11:15:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFupuoJuofvHE8bpWxH9rl5y2LbF3S7EE7a0jIAcsUzwE6GO2utDCj5iCqkJL/YsGi7Oehq X-Received: by 2002:a05:620a:2b4d:b0:778:9a5a:fc1 with SMTP id dp13-20020a05620a2b4d00b007789a5a0fc1mr10115359qkb.16.1698084957352; Mon, 23 Oct 2023 11:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084957; cv=none; d=google.com; s=arc-20160816; b=HuPm4KvWwoGrlJR/1XbSClAL9aE0ej40+JKKskMonBSj5RdBwKYu37eUem2AxVaN4f jFvQpXqmPmJMTuiKoBzn+aGixVTGv8lx485oINYXWX8aZZpHVdYwn1ocoTP3zRJ2oRkN EbofSioUZ8dX18DeHz3ByDnPoB6ZywAb8rnislkaKQvLiVX8588+S/BpYbgQ54wrhnH/ 64aT0oOsYKNgUSk9Ku9nvsVlb4Ql7732+ahunxIuhwZyDf7lGL1sVj04vmXMnmIt6pG8 DTdmzIRlOhq+qMai4phvn2+TbJHkwHwTIOG7aNcvmoFaoHmZjyj4nNPAyKsXy0W7zyXK a03g== 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=0BPLQFLnOkGd2O+DZrp/H9MQMrrZMZjnNrX39kKF71w=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=owldTSE/IW5Dbl9z4dxu3SCN7GEaZiJxudfl0GMsx4Sx+ZMk3ThcAJqC2p2g7Zewfc jQbWMotd9y96KZpZEckT61CBuMyi6oAWHQobUPkx0GAz0RWq9pekJUCnlktQjJsIHYdb EMbwBwtxeP+liqlyxm5EpQmqk2vYJk2Qr6+488WmKzWO99+nUKKhKn8CtR50cL7YR7F+ NpBfuaPVAV+TnNVg1BgUgMhMvVo8IX2GqT91thdpbgJtKmq7N4Tvdzq2M2od5U3Lloir 1BHn/fNqcJPkHOvcVUK9O8ccYGExLEFbpAyTLwZ/d0Ho4FMwK+41MBLpqJx/NQyLtvAh 9waQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m4AO2phi; 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 l8-20020a05620a28c800b00773db595cccsi4631416qkp.672.2023.10.23.11.15.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m4AO2phi; 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 1quzRe-0006OC-3M; Mon, 23 Oct 2023 14:14:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRF-0005ka-6Y for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:05 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRD-0008It-LK for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:04 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso2757649b3a.3 for ; Mon, 23 Oct 2023 11:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084842; x=1698689642; darn=nongnu.org; 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=0BPLQFLnOkGd2O+DZrp/H9MQMrrZMZjnNrX39kKF71w=; b=m4AO2phiy17MMXPImsHN22acalREyGv2TVRwm335D6kI+fgCNyvSWjx84xVBGt6/LJ dzkx58ARrdOp5Go5+tnhmsBVGJOaUpVgNZwZQ3BMZgSczmX6ehiLwunYqR5DHZhd5ZD2 FK/pduj5TvE/47YDwQQeFMgRqYiUxBnkn30EYOaMxKKeiMMZQ3jBAnELQgEWlBM6rACf g+yp9/QqNkFVda6lYfgZTvafhAzhbSog25yg9PPAJ52ba1OaceTtC7nMeoxpWyRb92cI jhNds9wwquaycq/4NW0QtlZXFuXMoDueeKTPeyWraRm28Xzpn9ItNNjbSVoYs6baw37X vBYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084842; x=1698689642; 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=0BPLQFLnOkGd2O+DZrp/H9MQMrrZMZjnNrX39kKF71w=; b=mVrwKHdyQvE6pnSy2mA2fVI14wLnB3TQBCQda5rNonXRiqngal1Ich3xLH8ClOhQf5 WlRdwSUTLAQaqQAuLtIp0mk3TK3Xz3E465+6XCvVcmohxQuYFHBRrkKGv9oVZNRyMDuf E765HmgRilxnGexlUgaFnVIQpKWm3yQd2RbXnnLn9JXX/fJ0qpJwUHK+nUP9ux8UqmY3 mnd/Uez9SOLwF/MDGSoKrw+yNg85TqXuShFf+24s9vKD7v/x8OjXXyqKolOuHqsoWoRv z9S5w0bbX1vmg8I6hEF6TMS2GjBsZo+0zPrlo1JZuJtwftP/6Fr9Ij3rZymt44YZFfcI aROw== X-Gm-Message-State: AOJu0Yyqqf7GeyX82Eg5nfEEaMdHl1wz5j2BywEvI/Mu8eT+A+RbuRTG +75dL2wG408IVX457YJTMw5BQErMKsY8gi8CyDY= X-Received: by 2002:a05:6a21:4842:b0:16b:d137:de5a with SMTP id au2-20020a056a21484200b0016bd137de5amr345082pzc.28.1698084842377; Mon, 23 Oct 2023 11:14:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL v3 35/38] target/m68k: Use tcg_gen_ext_i32 Date: Mon, 23 Oct 2023 11:13:26 -0700 Message-Id: <20231023181329.171490-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 still need to check OS_{BYTE,WORD,LONG}, because m68k includes floating point in OS_*. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/m68k/translate.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 4d0110de95..4a0b0b2703 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -520,21 +520,9 @@ static inline void gen_ext(TCGv res, TCGv val, int opsize, int sign) { switch (opsize) { case OS_BYTE: - if (sign) { - tcg_gen_ext8s_i32(res, val); - } else { - tcg_gen_ext8u_i32(res, val); - } - break; case OS_WORD: - if (sign) { - tcg_gen_ext16s_i32(res, val); - } else { - tcg_gen_ext16u_i32(res, val); - } - break; case OS_LONG: - tcg_gen_mov_i32(res, val); + tcg_gen_ext_i32(res, val, opsize | (sign ? MO_SIGN : 0)); break; default: g_assert_not_reached(); @@ -1072,15 +1060,10 @@ static int gen_ea_mode_fp(CPUM68KState *env, DisasContext *s, int mode, tmp = tcg_temp_new(); switch (opsize) { case OS_BYTE: - tcg_gen_ext8s_i32(tmp, reg); - gen_helper_exts32(tcg_env, fp, tmp); - break; case OS_WORD: - tcg_gen_ext16s_i32(tmp, reg); - gen_helper_exts32(tcg_env, fp, tmp); - break; case OS_LONG: - gen_helper_exts32(tcg_env, fp, reg); + tcg_gen_ext_i32(tmp, reg, opsize | MO_SIGN); + gen_helper_exts32(tcg_env, fp, tmp); break; case OS_SINGLE: gen_helper_extf32(tcg_env, fp, reg); From patchwork Mon Oct 23 18:13:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737271 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1664418wrl; Mon, 23 Oct 2023 11:15:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFUM+HK71+y7Wta+HPAaLEd6I2LKUQOglaLXIqB8hsF0XeTD8LTqU+E/GIzUXv1Kbvy8Qd X-Received: by 2002:a67:e156:0:b0:450:f5cb:c3ce with SMTP id o22-20020a67e156000000b00450f5cbc3cemr8300160vsl.17.1698084915875; Mon, 23 Oct 2023 11:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698084915; cv=none; d=google.com; s=arc-20160816; b=J219gjO8+BewHDuIAsSXiDt38vikGewIsmLDVsXcbHSoRbzRaLbcSEMQsUiiFeVcpT KTvqBo2VY9D3CXALO36J6FWPfOTJUYOTf3v2z/DSDQUDqFYUbOJz3jG3U+rYGzDRFT3N Eeb00Vy0xZ3eGHQZkBi8uEnAzuVolqfNt0w+ckOgG1V3NPz4IxeJ2kfTalmUDc13Eelo ZceLH5ciEhsIFX2J9PiOLPWgxYtkcPT/bTkVLNqDTAonEw4zZBrkIkxf9bBzql10E+FH 7kTyMzXyaionMJwcOigBxUsVs6W6bc6u2GfQ5tBpIMJq2gZfwPH/XRE9CIbTAZzC0giW IiBg== 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=lZTStllFRXXRJKs8va6Nw+b+x2His96pbgh13vqXpyU=; fh=BCLN+t2ZqfLIJQawKoImfSYKBLl07s8FDPr8BfggRIo=; b=b78o1bs1cszJV5p3mu89Xv+7OVgYWTurdegz9ZmyXOk6qIdOLsSehbVkrb8He7QzO/ +qq/n53D1zwMRQ5T5YKCnXb76GjptaNLjYHxeR/wAEpPd4fFfKMcn8FX2uGJWtqE2dDr BbMyNkN4TIaRLO/P35Nrs2cqiTpHY99AH4YG/iX9c3Qddw74oB3Sb14ofP+DyTWs5Rrp vSecDr5E+Nls5vL+q7aUJtBQbeNULFByrHYV+jA6hy9HqaNAEwzHG3XyCE+1lBpZpCn8 WkLZtLNpv68FHr1qcsLnzryLEeOMBq3mhwa4RYcn/HQpEqe/GLstw707gw7GR/Z5ygBk GvBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWCWcgyr; 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 nf7-20020a0562143b8700b0065b2161c3d8si6193576qvb.328.2023.10.23.11.15.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWCWcgyr; 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 1quzRk-0006fY-Q8; Mon, 23 Oct 2023 14:14:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRG-0005pQ-1J for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:06 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRE-0008J1-Eg for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:05 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so2707647b3a.3 for ; Mon, 23 Oct 2023 11:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084843; x=1698689643; darn=nongnu.org; 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=lZTStllFRXXRJKs8va6Nw+b+x2His96pbgh13vqXpyU=; b=zWCWcgyr1LwsgYJPsxF6inFIQZFc7tM5Y2MCFNbfW1MPgGAis33vGJ0sBmekPkEKIW UROlc99qoyD0BmQgOzAcNpLbSOfLbQaotoXWBlCmMVuMe/EEkYpk4jOprgcSkxsXZZ9n NimKqcopEBaXSE1d7z4S0BuXLyTi+1L0MyPfqHs3GmFv4OMOvmwnWqH2hxmC22QnH+Le covKQ2e5Ql/JW9xlkRKkt7T+DaL/XZJtzZZ9FY0W+7j2gCxHyCpQWfg2rVepEHCVcXSW GSjiIBwfPFRJdoQFpcegWG8umlLAK8WIo/d5kvk4VKgBT37jmSaMq8fHL22By7qyzRCv fiyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084843; x=1698689643; 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=lZTStllFRXXRJKs8va6Nw+b+x2His96pbgh13vqXpyU=; b=mnaGelZJaOYHG5PYT05ClWBlvnonir8zfOwE+1bWYZrBwH7+XR0uslW38gnpq0vXnY +2s49bPoOudmstHO2gSlu/CtEQN48HxMYldPKa3mF+7apmw5lKrYi0Vs3q8FjIhIMuwh U29nwzs4qxh/HFAWMUXOq4K4mAZXJNyNse7L9JkXLliaYHGqZpU31IEqaxq4NrJIQc0n M0+8mg8FkUYGpRQVnSQM13T3/X+Ha5BSWyxrjmUdrcM3NkUHMydSBJYVEE23xa40ONKB jqkaLmBBuytf+o0nxmCTI/npba1X8CcYwFaKOH0RsFYKHjEbnkovJ7ty69fxIxJc6qW8 kKPQ== X-Gm-Message-State: AOJu0YyTkHvqRBsfoDh1+5gyHPsZ6C3adx4uBwoUfwgDp9lnuXP3j2fw fNd67ijQhPcCJI8Vwnpj6oYN635kiLZITGp07S8= X-Received: by 2002:a05:6a20:6a1a:b0:17d:f127:d435 with SMTP id p26-20020a056a206a1a00b0017df127d435mr392532pzk.45.1698084843183; Mon, 23 Oct 2023 11:14:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PULL v3 36/38] target/rx: Use tcg_gen_ext_i32 Date: Mon, 23 Oct 2023 11:13:27 -0700 Message-Id: <20231023181329.171490-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Reviewed-by: Yoshinori Sato Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/translate.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index f8860830ae..c6ce717a95 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -492,13 +492,11 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a) /* mov. rs,rd */ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) { - static void (* const mov[])(TCGv ret, TCGv arg) = { - tcg_gen_ext8s_i32, tcg_gen_ext16s_i32, tcg_gen_mov_i32, - }; TCGv tmp, mem, addr; + if (a->lds == 3 && a->ldd == 3) { /* mov. rs,rd */ - mov[a->sz](cpu_regs[a->rd], cpu_regs[a->rs]); + tcg_gen_ext_i32(cpu_regs[a->rd], cpu_regs[a->rs], a->sz | MO_SIGN); return true; } @@ -570,10 +568,7 @@ static bool trans_MOVU_mr(DisasContext *ctx, arg_MOVU_mr *a) /* movu. rs,rd */ static bool trans_MOVU_rr(DisasContext *ctx, arg_MOVU_rr *a) { - static void (* const ext[])(TCGv ret, TCGv arg) = { - tcg_gen_ext8u_i32, tcg_gen_ext16u_i32, - }; - ext[a->sz](cpu_regs[a->rd], cpu_regs[a->rs]); + tcg_gen_ext_i32(cpu_regs[a->rd], cpu_regs[a->rs], a->sz); return true; } From patchwork Mon Oct 23 18:13:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737288 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665173wrl; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIfS4MAbuPD8/rommVmeJ5TRo9SBWqnwQVrrGESNcHP+qMSXMXreqHQ4Tts37eQgP84kFs X-Received: by 2002:a05:622a:7:b0:41b:4c0:cbf4 with SMTP id x7-20020a05622a000700b0041b04c0cbf4mr14419760qtw.7.1698085017579; Mon, 23 Oct 2023 11:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085017; cv=none; d=google.com; s=arc-20160816; b=GbVqucrIT3Gd2KvzGXS8gptTg5p6XGjQcWb4XBstMkq7Z6JN0Pl56G0AnpbIiEjWLj A/3LMB6Z1yW5shOaiLEXKBPzTOTwDRuRG44BAcK+wsVqnhMDmrxL7FOj2ILjjqQzilEH yBTJMKVyCtJUg/WiLMIwiS4yhqW8jP6KPdh/GCJxamxkPbv0TeIyzZsbx6KmYQ8XIGrQ qv0oUeA0D92AZEOKLaXWuth/QcgMA0TYeI9ZKhD7zN+a8xWMXzKadmcZu35tUqkxaGp7 IZSZ0XGYZTtSNx+gKsIJw8KSLb0sfQAx+6B/bqXg5p6LGJkadV/7D+9OjfgE271khVhW yLCA== 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=HoubwkFzMAESazVThDNIBAh5pqmgk/UJhOFdR/AHQTc=; fh=AviQk2djdIC6erHNV64fPAlsYrBm9AENj/pCljp3+TU=; b=UcTIaHSIxYRJ0pE+es0U8GJ+vSUCoMUDupMfq0cQSjYOuEo5pf0zdcMfnJPgJ2Mg3V Z4i21VSpKhXegCyUe8qEQjMg+8mvZ7rAvqzTh3MU3EPqTXA2uhBBy+HgH71m7ajt39tk UMJ/hUs9Q+2ovZdLIEgB8Kr4gB9dxkoIwsSUxSiKYQSTh9RFmWTtoc+qU6Jk0ZhTKTBp yYHMUYB5RoZ5MEXQzPOHPQSK0PMVLXt0LVB29CbwNOUZLlEKnFbNp5cCc7S1yFH4XRqi KkNf04h0Y9ZUcMTXqrhe58Qym7mImo857Ela0sMPxcppOj+826axUvGL9paBBYAqoWcA mhWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UK+hUxzi; 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 v22-20020a05622a145600b00419630a935esi5589651qtx.237.2023.10.23.11.16.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:16:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UK+hUxzi; 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 1quzRe-0006Vv-Cu; Mon, 23 Oct 2023 14:14:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRH-0005s5-04 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:07 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRF-0008JJ-BU for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:06 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso2588441b3a.1 for ; Mon, 23 Oct 2023 11:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084844; x=1698689644; darn=nongnu.org; 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=HoubwkFzMAESazVThDNIBAh5pqmgk/UJhOFdR/AHQTc=; b=UK+hUxziVmi6209mz85zviyKaFuE/Mm5UWiLebuAvO6ap+HuPZZemQqnvSNzqsNKQ+ Wxzf0jmbsgqoIhs/FjutuJYCwRy+xDUIw5gNXmMzK7DHnyN1INQWz+mQbOJ39dwdD3eH f7NH5W8m6pbFc9sHqNFxpsf9GKiRVUlGxHdwkoM/JSuerjtzThUv3CAkPtFjRYRUrDyv GtYQR67kxV+TOylD7tpL04V9WedQXAUch9I5KDlJQdYpRBXmCW9ciV8KJRoVbWnEkgL3 FzfnGhADGzRTxKURgELuDTtpSE8zwQ6EUUVcbSGaypZxlXBV/j5wdyrnbALlw+Rls7Ee pqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084844; x=1698689644; 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=HoubwkFzMAESazVThDNIBAh5pqmgk/UJhOFdR/AHQTc=; b=JYxAr2EVgXtJuRpjtyDwk4VWYhii7DE1AFNWU+drvTvggftcfF8nqz7u+m+c+gwr37 Yw5g9U4McjSu1wMegFw7FZFTOoukkc2R7bBnPBKrJDBuIUfpXyjo5ZZBeoFK+paCBvpp ySJDLlXMrCkFlrX4oNaFaDyP0QCOEXKB0Zxp+WRFI8+tD7oQ6Mqlor4gxrHSFAbEgnrr Vhubk1UmE0eYGQZPe76wLblFFR8iqaRoFC8JGlNDwYl5caPVzeF6GKpr4UOdXw9R1Wfx Z14wvyNeHzbn4/o/aViSR1bK814GlaNxff/lVKGqzLserBjcxbnmeJtbsaIIfcraM2JP E3Wg== X-Gm-Message-State: AOJu0YyR+DInanvLNsRzxMMVvarwjXYM1JKaoDh2O4dm04cxWh66xFV3 y59pws9TUoyywBZfZqx0SFQQdphFFQqmWbOJTbg= X-Received: by 2002:a62:f246:0:b0:691:27b:15b4 with SMTP id y6-20020a62f246000000b00691027b15b4mr16941402pfl.5.1698084844093; Mon, 23 Oct 2023 11:14:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Bastian Koppelmann Subject: [PULL v3 37/38] target/tricore: Use tcg_gen_*extract_tl Date: Mon, 23 Oct 2023 11:13:28 -0700 Message-Id: <20231023181329.171490-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 EXTR instructions can use the extract opcodes. Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- target/tricore/translate.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index dd812ec0f0..66553d1be0 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -6542,28 +6542,16 @@ static void decode_rrpw_extract_insert(DisasContext *ctx) switch (op2) { case OPC2_32_RRPW_EXTR: if (width == 0) { - tcg_gen_movi_tl(cpu_gpr_d[r3], 0); - break; - } - - if (pos + width <= 32) { - /* optimize special cases */ - if ((pos == 0) && (width == 8)) { - tcg_gen_ext8s_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); - } else if ((pos == 0) && (width == 16)) { - tcg_gen_ext16s_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); - } else { - tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], 32 - pos - width); - tcg_gen_sari_tl(cpu_gpr_d[r3], cpu_gpr_d[r3], 32 - width); - } + tcg_gen_movi_tl(cpu_gpr_d[r3], 0); + } else if (pos + width <= 32) { + tcg_gen_sextract_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], pos, width); } break; case OPC2_32_RRPW_EXTR_U: if (width == 0) { tcg_gen_movi_tl(cpu_gpr_d[r3], 0); } else { - tcg_gen_shri_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], pos); - tcg_gen_andi_tl(cpu_gpr_d[r3], cpu_gpr_d[r3], ~0u >> (32-width)); + tcg_gen_extract_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], pos, width); } break; case OPC2_32_RRPW_IMASK: From patchwork Mon Oct 23 18:13:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737293 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1665864wrl; Mon, 23 Oct 2023 11:18:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWdoKCibpd1gu0O4vM8V+mpCYEz4N9o6LXzr4OuS461YVeWrwsXKmPJFPxojo4HS28mpDt X-Received: by 2002:a05:6214:2266:b0:63f:80a0:4eea with SMTP id gs6-20020a056214226600b0063f80a04eeamr15460459qvb.24.1698085110642; Mon, 23 Oct 2023 11:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698085110; cv=none; d=google.com; s=arc-20160816; b=SRFj0kPZ1S1nbcfdeEQcIfZK4nqqY5YKwswRS+YkKMP7cYqWpPsR0CIX/6XV917jDh gDYl5koiTBTc7pnKPp+J/pJJkCMMa4kbmsXW6snuuDu1Nk608CYlRN+5Kr3GIvB505c8 3rRn18YOGF6QviT+QMoH6wv7L2gQWMJVB80pwqHdYEy0jCiXKJ1DKYoKYVEY9siaDCnc L9nqlvVJBEaDSw+Hq8NJ6olkemlajaEX5JTUJvIoFXeeylG7ESukkYbhfL9zsEHdGgVZ b95Ox2WLmEY467edohHz/f9qT5r60rB5mwEFmIwKi4j8tE9dmaairMfji1YHqv2oSZcm Y2hg== 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=zHmmFYF02i+OnY3fmwj8/XxXt0JUUTrQhyiW4ERnoxY=; fh=CYNKLrQn3/SkOzHVC+Oxp/KpGWhDzIr0x67bL1yAbP0=; b=GquKyzWqehmBrvR0O2EqXvyYSRJj9681Js9J7CC6o0L80PoWYQZnnAKkdqxGxEUrQw Brh6vbRnqWyWMoIgbV8qlX46Crfq4ugRLXXzAlsd9Ay7Gp5f3yu60xP7wUhRMblpQxd4 d3fqZZYJkxba46X0Wk81tmfvpBTQg9dVGTY83uvtSFUy8vs6jCmoer+WjZtdLsprJVoI hQYDQISxvgWhr90jXWEYC5TFeTSFN04jtPVBNCRmRxZTb7aMpYegJ21WuxIttTsG8K5p RXNAkctJMxUPgzWK+rAQIS5cdTmUmk+PfduY1vo0K6lQo7coskCVIhLbA8cHW8q1C45O lgoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDyj7uBi; 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 m17-20020a05622a055100b004180387dcc0si5858329qtx.605.2023.10.23.11.18.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 11:18:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDyj7uBi; 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 1quzRf-0006dl-Em; Mon, 23 Oct 2023 14:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quzRI-00060e-58 for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:08 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quzRG-0008JV-JG for qemu-devel@nongnu.org; Mon, 23 Oct 2023 14:14:07 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-581f78a0206so2091588eaf.2 for ; Mon, 23 Oct 2023 11:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698084845; x=1698689645; darn=nongnu.org; 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=zHmmFYF02i+OnY3fmwj8/XxXt0JUUTrQhyiW4ERnoxY=; b=xDyj7uBiwUX+P9mTK1Cp7jOH4ec6tKeGipsnCJgTLNDln6sy3EfDpLleAXVZFrE4QB WExisMIM/wkJ3D410EeGeyR4WFYKycsmlvn+IiKQiWXvpWPL7zCuLfKT+A+GNC68SL0M ZkWiv9N0KD0AtbVrJ8CZlNkNxMFaL3gecWUo4atLF88x8P7v2CHU96/WcrKkDAlc/c65 syGAwYKcoxCces1BkycTrfqkM7I4F71E7zI+l2LP7hTcrC+55RXr6+kCBZ/WMcFG0i52 8aDJwonznUyMNYJKvcu+2J6RmKrIyDWYu+aHZTIFBmRPvaKSpEEVjCT/J3Ts1r5/j7OJ W6tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698084845; x=1698689645; 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=zHmmFYF02i+OnY3fmwj8/XxXt0JUUTrQhyiW4ERnoxY=; b=FWQuGxejSNQ0Xf5pHjQs9mheZe1xLJbQuv/WFSPUbhID+eRNcEeCzi+w19r1txWFLd s3DXNEHDTwfrW1vJXXFsFzyz2sv+Y7rdxV83dXtMNru0u0TeFs3C7MJApU38YpQ3OnYv z6Gep4JHYKhf/4zyzZNg5Ba1Z7FwAZvt3US/fn89hw+2ILu/IrKDukckV2B3JV6IR9Qt F/ZWXn1BUOdzWGNg0bN6wupr7BF5HjUWieI7vztLizwN8FvVMNR3UcvJ0Nq+rlTJkkeg lTBQUxlniBnpbSL2KF1MRwLtVJOWz6EXHUcmxsLsYixhyyYofqSJeHzyLg3+QXHBNWd7 a6eA== X-Gm-Message-State: AOJu0YwZW1c+jMfH3TG1mH0yomYSjLqsiz0O2JRfrximqZgxjGPe0OZi UywL3RR39aisOIscM5im7SH7+1uu0AfCD36MAM4= X-Received: by 2002:a05:6359:5c20:b0:168:e177:b2bf with SMTP id pu32-20020a0563595c2000b00168e177b2bfmr3032364rwb.5.1698084845220; Mon, 23 Oct 2023 11:14:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id v10-20020a65568a000000b005b83bc255fbsm5205137pgs.71.2023.10.23.11.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:14:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Max Filippov Subject: [PULL v3 38/38] target/xtensa: Use tcg_gen_sextract_i32 Date: Mon, 23 Oct 2023 11:13:29 -0700 Message-Id: <20231023181329.171490-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231023181329.171490-1-richard.henderson@linaro.org> References: <20231023181329.171490-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.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 Reviewed-by: Max Filippov Signed-off-by: Richard Henderson --- target/xtensa/translate.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 54bee7ddba..de89940599 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -2262,17 +2262,7 @@ static void translate_salt(DisasContext *dc, const OpcodeArg arg[], static void translate_sext(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { - int shift = 31 - arg[2].imm; - - if (shift == 24) { - tcg_gen_ext8s_i32(arg[0].out, arg[1].in); - } else if (shift == 16) { - tcg_gen_ext16s_i32(arg[0].out, arg[1].in); - } else { - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_shli_i32(tmp, arg[1].in, shift); - tcg_gen_sari_i32(arg[0].out, tmp, shift); - } + tcg_gen_sextract_i32(arg[0].out, arg[1].in, 0, arg[2].imm + 1); } static uint32_t test_exceptions_simcall(DisasContext *dc,