From patchwork Wed Aug 18 21:28:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499007 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1053685jab; Wed, 18 Aug 2021 14:30:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy1NK01Mtg45VKzVfD3m73WUbiBdhafmgoVBraq4xTqBXDaxQfOJsZI6Txkx4zUYM6ADwW X-Received: by 2002:a05:6214:4009:: with SMTP id kd9mr11084012qvb.40.1629322211012; Wed, 18 Aug 2021 14:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322211; cv=none; d=google.com; s=arc-20160816; b=NqvY2h9TJUEwZ/fso5lL7Yo+9KeVdsRpuywzrR5In8zjSe8Ij93mldozswB/EnfPxr MN/twhTutequH7AFqlqZN6rptGPqSGK7wJJ7lAWkdMZftZ7YFNZJAqmfgbREqtxqpxWp AvPhI6uykgLxIY6rP+G2obdPAzoQMEoAlETK0UPsCPd5StMTnEAH3nz7lC9jL+vFsG8G jpzklGat7NgylswzThoAjjcjdyGDgkzEnW+pUfDYqpOOs6tuAZ9QkDOhgwyHpa68L4i3 vjHdxEdb/JkFUcZ7tqwmPLP8Y6FlTlKulNYMQavT7zx3O0esuZ3gSQN83RpbCjYR0+cP 2g5Q== 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=kt/mDazQAKYKsXxjbdT0yp22oT0Ru63VroJp5mmRuZU=; b=rDXwLWRzs6ARpAEZc95rEN0A3A6MddmKre752NxRuErJAdB1M51m940eSXEqOaD1kC MGSHboZXKAAIX9LC9KBOotnF6T7WYD/IPKVDbDm9gMlM/GLSmdtImNsAxmeLEaCwSgMJ boadHugmM2cMlmzEF7kJjXKAiCxB1e+8nH37yjouVVHfkEEA/f4A6Yzo+EjD1TMA4Yys aZRWZPOk3x2HbpFqObaJ5pbctBcjWOYm8qTfrEK3WGpJ14RLlBl2nbEv5WoA8NJ6hT72 pAvYHGeyMzUB8poAzrgUef4h21alRdSTOAV4H/yHVehRgzSAvTt5fM9vFK9bn4+UrcwD 4Fpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7lCMpxu; 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 y8si694205qkp.220.2021.08.18.14.30.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7lCMpxu; 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]:41138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGT8U-0005lk-Ao for patch@linaro.org; Wed, 18 Aug 2021 17:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7e-0005lD-Li for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:18 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:38773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7d-0005gq-6y for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:18 -0400 Received: by mail-pg1-x529.google.com with SMTP id w8so3707432pgf.5 for ; Wed, 18 Aug 2021 14:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kt/mDazQAKYKsXxjbdT0yp22oT0Ru63VroJp5mmRuZU=; b=F7lCMpxuZQGAdUkgnxUhEvAKaKKBFpsMY7hUsBZyh8z0l/KpLcrQ25ohULxuW8CVoU dWguFkovqPDysBBmPI5nQsMP6fBFsTbgOHY2J02IWfohdQWB7DvYQvNXG2bBarfiwnRB DIe888AIkLj+qJvpAurmeTVzia3Wh45+iKAqgwbS+qa1np7tm/TghA5qEyFjb/F8NXIZ zd7ltdB9KplwHlFEjQQNI7cOknt8jTCHIvUh2Qwn9Ib5H8Z7/SEcA3t5DevVI34LX2MX gQkVnX4deuWTb42Okj50SFKKSc+7KEP1FTRgM+5isrYUlvURp7eVxWDoBb+8I43YFL9s lI+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kt/mDazQAKYKsXxjbdT0yp22oT0Ru63VroJp5mmRuZU=; b=YgYUdGVWwCNuxfjLBWt0JjJDm4xU4OR9AHmBni0fIdOf5itzFDWjETnJoq/47Grikh Z54i0WAxcwZ0yByq8NsKyUq7229PgDnOFeWDK+enPOjHCP/IdSkqf24eLZQRPVpKGCUh DAuOIPCzzoRBSWh4OxQiv8M7Mx1Owy1q6F5zVhMDQuvWUO+Xc00XiQqXXI7i/Jbyyy28 LG0y3y8hSqpscpXlM4TF4J3kz0dyJ0Md21onF4IWEUdOTFzezBIxiFGSzIG1392YyIOn 9SI1kC/KMNwEtUzN9A5VMJyw+k0dP0hpY/ySPGDxS/AF7q/aTqIOV4BCQ/durQezER4p W0Eg== X-Gm-Message-State: AOAM531aubQMttlPWrlgYRMmM224aQJqBZIIYPJwyQxfBpLins0CF/Bs nKlBxo+FABr7l7JbitbNtef5hmrL3P37YQ== X-Received: by 2002:a65:68d1:: with SMTP id k17mr11078434pgt.285.1629322155508; Wed, 18 Aug 2021 14:29:15 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/14] tcg/arm: Remove fallback definition of __ARM_ARCH Date: Wed, 18 Aug 2021 11:28:59 -1000 Message-Id: <20210818212912.396794-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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.23 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" GCC since 4.8 provides the definition and we now require 7.5. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 19 ------------------- 1 file changed, 19 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index d113b7f8db..18bb16c784 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -26,25 +26,6 @@ #ifndef ARM_TCG_TARGET_H #define ARM_TCG_TARGET_H -/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */ -#ifndef __ARM_ARCH -# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ - || defined(__ARM_ARCH_7EM__) -# define __ARM_ARCH 7 -# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \ - || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) -# define __ARM_ARCH 6 -# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5E__) \ - || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) -# define __ARM_ARCH 5 -# else -# define __ARM_ARCH 4 -# endif -#endif - extern int arm_arch; #if defined(__ARM_ARCH_5T__) \ From patchwork Wed Aug 18 21:29:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499017 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059933jab; Wed, 18 Aug 2021 14:39:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAmnu5OrFaMYPzbg8VqT4/5PdxPtXJI5kCncefvCHJtU8FbO5oAYDGHlIOLfjJefA3D057 X-Received: by 2002:a25:4986:: with SMTP id w128mr13231404yba.7.1629322785377; Wed, 18 Aug 2021 14:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322785; cv=none; d=google.com; s=arc-20160816; b=A+7iyg/OdQDy2ZrcU93kE1/FZXzLG5GxkVJgGpkpIM4nkmiRJUNi9N4HL83eFzJ8pF /Wz5vqBVWDAn7xaBSh3+6KhPLT66myPNsxTinhkPwSiAo73G48bjzohVobjASeDJkZNk rjIHjfSx6Wlll0NjBS1F4JhIUbaTRQpG83mBeFGc1TL4hF/Y7GJk///jCVhiveUyGuLj 2kWApU2v1lAJpqPO4tgXn3WpCF3JLpOHxrX4/pNk9Hj4osKmwgZsDxvh9Oy75hByOFTx QMWvhvSZ80HaB0wOz2mlH8Sgr6a5v1w5mc81kmsxwCz/i3NmMiopWdlzm3wAWgHGvBx6 QeRA== 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=jvTjQd8+KKu37EfaBk52Wctzm/Jsx7FXZmS8XohP8ks=; b=gEiTrl1wo8Xu68GNYBoOUs6cad7rcMHZWffNMab/7OrrTLnUHhqF+vDQXcCnvspwB8 rgzWyZ9cGAyIFVYnFBVvjNUOYkA6kyWVA1imwlI0YSLOUx1CevFkW5e4Imp1YU+R6exz xViGpiYlm1PRFOhglaGS+YuNNCG2/w3AMCagdYBFveGIcIonlFIqEwyKtYUJeOZKgcLI E2PkuSufuCUp0aEN2KK37Vm9uM+CxRJzBjnatH9ZA2EqktUifbLicjN4MhWvPrb4Domn bcwL7Smb2O3l5/UPqiwZmwnHulGimTyU10/m4Yl91LUu44dfR2Qr7yQhewu9IEjqKh0U O6nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i5JRD8Rj; 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 i7si622234ybl.73.2021.08.18.14.39.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:39: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=i5JRD8Rj; 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]:37124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTHk-0005bT-NW for patch@linaro.org; Wed, 18 Aug 2021 17:39:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7h-0005mW-KX for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:21 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:36519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7d-0005hU-MT for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:21 -0400 Received: by mail-pj1-x102e.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so9893009pjr.1 for ; Wed, 18 Aug 2021 14:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jvTjQd8+KKu37EfaBk52Wctzm/Jsx7FXZmS8XohP8ks=; b=i5JRD8RjOtedHY2l5ucOq8S93XZQIA+jScVu+sJQzuJ3FXl7JzrCiuhTLddHyylfg+ ew9GI9538RvxG1n4OTv54WPQH9eR1LP36ZTUUprw3gCX0eBjBAt3iYjeLaPXxTlSbT7r wGxhJzMsrGFZj5imm5siJBwduwokim6al4NW2Dl5vWu+YHL/+W5u3JRcyo5DMB0OG9ym HQTzkiJl57xlvY2iJ7QlYWWOf66YM8PRYVH7Ba6u+lXnqH+tYoi0yXeSXOt1yognxUzb Rpot6HJ6ErhVWzeXdM3tS4F/F1yuezmaOp72y2WZ9DIGd1gtLk6YHX22N9brlYJu36wZ /AkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jvTjQd8+KKu37EfaBk52Wctzm/Jsx7FXZmS8XohP8ks=; b=ryIHX2p2FdEbKgJcys1NVtkNHdrIO/P9FQZBgrAxy3GomW/B7wIvbe77lIzLrKhEIA nVp+i93wOeTuk3NRf/7yWW6CpxG4favvZuAnhedvUXDwldi/Qtogm03lyyqu6TWCR4T2 kL0sspn2B9rhMT2RMa2gYC+V5Kw6HGEMUEfd/DM+4Cgn7yn6bUn5RAdWJOPSZyaKrHep yiP/brXVhkrakeuAidfFEM/w3lWOONhhJTalwSH98bMrTm8hMmKRq51kdVsNxO2jEpZL CLL61XCuogpo66b3YP9MIO9HPbHMK4tiG0oORBa7th7dWloETyXzNUd1csCi2DhMxDDI nDZQ== X-Gm-Message-State: AOAM530jqyT4yMeINmCmmW7hYkr+d0bPEHOnmmtnCbQbvGkKLgwuCuYb rxh3zead1uA5Q/RyinRayn6GjQf0W/Vdgg== X-Received: by 2002:a17:902:e84f:b0:12d:830c:97a1 with SMTP id t15-20020a170902e84f00b0012d830c97a1mr8882077plg.27.1629322156413; Wed, 18 Aug 2021 14:29:16 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/14] tcg/arm: Standardize on tcg_out__{reg, imm} Date: Wed, 18 Aug 2021 11:29:00 -1000 Message-Id: <20210818212912.396794-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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.23 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" Some of the functions specified _reg, some _imm, and some left it blank. Make it clearer to which we are referring. Split tcg_out_b_reg from tcg_out_bx_reg, to indicate when we do not actually require BX semantics. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index cbe3057a9d..0578f9749b 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -525,19 +525,19 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return 0; } -static inline void tcg_out_b(TCGContext *s, int cond, int32_t offset) +static inline void tcg_out_b_imm(TCGContext *s, int cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0a000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static inline void tcg_out_bl(TCGContext *s, int cond, int32_t offset) +static inline void tcg_out_bl_imm(TCGContext *s, int cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0b000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static inline void tcg_out_blx(TCGContext *s, int cond, int rn) +static inline void tcg_out_blx_reg(TCGContext *s, int cond, int rn) { tcg_out32(s, (cond << 28) | 0x012fff30 | rn); } @@ -568,13 +568,19 @@ static inline void tcg_out_mov_reg(TCGContext *s, int cond, int rd, int rm) } } -static inline void tcg_out_bx(TCGContext *s, int cond, TCGReg rn) +static void tcg_out_bx_reg(TCGContext *s, int cond, TCGReg rn) { - /* Unless the C portion of QEMU is compiled as thumb, we don't - actually need true BX semantics; merely a branch to an address - held in a register. */ + tcg_out32(s, (cond << 28) | 0x012fff10 | rn); +} + +static void tcg_out_b_reg(TCGContext *s, int cond, TCGReg rn) +{ + /* + * Unless the C portion of QEMU is compiled as thumb, we don't need + * true BX semantics; merely a branch to an address held in a register. + */ if (use_armv5t_instructions) { - tcg_out32(s, (cond << 28) | 0x012fff10 | rn); + tcg_out_bx_reg(s, cond, rn); } else { tcg_out_mov_reg(s, cond, TCG_REG_PC, rn); } @@ -1215,7 +1221,7 @@ static void tcg_out_goto(TCGContext *s, int cond, const tcg_insn_unit *addr) ptrdiff_t disp = tcg_pcrel_diff(s, addr); if ((addri & 1) == 0 && disp - 8 < 0x01fffffd && disp - 8 > -0x01fffffd) { - tcg_out_b(s, cond, disp); + tcg_out_b_imm(s, cond, disp); return; } tcg_out_movi_pool(s, cond, TCG_REG_PC, addri); @@ -1236,11 +1242,11 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr) } tcg_out_blx_imm(s, disp); } else { - tcg_out_bl(s, COND_AL, disp); + tcg_out_bl_imm(s, COND_AL, disp); } } else if (use_armv7_instructions) { tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addri); - tcg_out_blx(s, COND_AL, TCG_REG_TMP); + tcg_out_blx_reg(s, COND_AL, TCG_REG_TMP); } else { /* ??? Know that movi_pool emits exactly 1 insn. */ tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R14, TCG_REG_PC, 0); @@ -1254,7 +1260,7 @@ static inline void tcg_out_goto_label(TCGContext *s, int cond, TCGLabel *l) tcg_out_goto(s, cond, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr, R_ARM_PC24, l, 0); - tcg_out_b(s, cond, 0); + tcg_out_b_imm(s, cond, 0); } } @@ -1823,7 +1829,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) /* This a conditional BL only to load a pointer within this opcode into LR for the slow path. We will not be using the value for a tail call. */ label_ptr = s->code_ptr; - tcg_out_bl(s, COND_NE, 0); + tcg_out_bl_imm(s, COND_NE, 0); tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, addend); @@ -1929,7 +1935,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) /* The conditional call must come last, as we're going to return here. */ label_ptr = s->code_ptr; - tcg_out_bl(s, COND_NE, 0); + tcg_out_bl_imm(s, COND_NE, 0); add_qemu_ldst_label(s, false, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); @@ -1982,7 +1988,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } break; case INDEX_op_goto_ptr: - tcg_out_bx(s, COND_AL, args[0]); + tcg_out_b_reg(s, COND_AL, args[0]); break; case INDEX_op_br: tcg_out_goto_label(s, COND_AL, arg_label(args[0])); @@ -3065,7 +3071,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); - tcg_out_bx(s, COND_AL, tcg_target_call_iarg_regs[1]); + tcg_out_b_reg(s, COND_AL, tcg_target_call_iarg_regs[1]); /* * Return path for goto_ptr. Set return value to 0, a-la exit_tb, From patchwork Wed Aug 18 21:29:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499008 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1053801jab; Wed, 18 Aug 2021 14:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYZZzRZVRNa4zSddE7NtGIXLzB/XM8UYcQws5xTcEjD9RgfinEJP6hZGrtS+/V4UfPISrn X-Received: by 2002:a02:970d:: with SMTP id x13mr9778056jai.57.1629322222531; Wed, 18 Aug 2021 14:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322222; cv=none; d=google.com; s=arc-20160816; b=VPQNaGPPkSg2XVCUz0jFwL053x2MOsVI2jRsufvy/wLczbnH5MaOcqkjlWkLvmwlKP EBeflm+Igi6zi9IEUNlbmkMVO+l97nXxcxf3GxWCPKYz6N+QEbq/huQUHWCtHGmGYIhe ynoQ30ttuwrmz4XJhL5jN0l8PaLWNvewHJz3Obkc6EDkeCl5teOTLH3dKSpS7uMRtKf7 p72/G0Wrzrahl2qLbmJVvIS2B6za6/ro/7qH6NA4ikC04APtN0m5GNQnDH0ADB0MPf7C U7JHHGuEdrrMAedsbzBKrCxKtV/UZep78ET1UITPvt2i82ESVNY1gOtODfVnj5o2ArEn 9zwA== 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=jLXGAbCLwSue+rsTYVcpzuuQk6hL0q5RdOPZ/L6m2sM=; b=hAPsLisiIjs+8Knx0gsZ0Gh8n4myIxyDAFHw7WAfTdEgWyVtOpWt0aw5bDKOhnFbjJ Csl47CIQY/9zd8F12GmZ7sDhlE0HbDk+IzlRk+4eEMkEJkDyIzOgH0glU2AANAs+D5Gh wbGk++lHZQWab4W8HeRzUB4iuWgFJmGJcz8Z6z3KvSGJKqDvVGuUV6fq0+wevw5T0S49 vBCmFOL0UpzIn19Rs3LNCZAmqRcDEnb4opLKBGc+QYBAL8exFZkmFfHdW40Tc7v528py kDel0uEFf5SFVAovBnAGYxbOhf+ExywvrB5u/YWccfd7bwRXUW0pu+COBd7uiMH60EfI bHxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GEdlg1sv; 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 c1si752755jap.87.2021.08.18.14.30.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:30:22 -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=GEdlg1sv; 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]:41218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGT8f-0005ou-U0 for patch@linaro.org; Wed, 18 Aug 2021 17:30:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7g-0005lj-4a for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:20 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:45748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7e-0005hg-PL for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:19 -0400 Received: by mail-pg1-x529.google.com with SMTP id n18so3705917pgm.12 for ; Wed, 18 Aug 2021 14:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jLXGAbCLwSue+rsTYVcpzuuQk6hL0q5RdOPZ/L6m2sM=; b=GEdlg1sveHuZngaKhebNtbyxZRKU5PtermHZo8ynQB+sprF+SA5qt9NRlNTuvgwghw QdvxlfzxuJzpmb6+b+ta1s8yvApaL3WhS5ORY3JHgVpeJ9APb20TV9GdlSvRgfPDH70p ugqAW3UrfDi/VKh1aw1xFxf4dQq6rWmFympO55TcYOcB/D/0g7jcNplkQV/yhRQoBil3 lWojFn/9lUTqsSBNUFXWL0Xs6g/XlwuTH7Z120MPHDPZP85FJaYGHMF/ZlnmhW1eJxc4 x7JbJVVkO+PUQtG6t1t5y2yzi+67OgAwkCM02Gnu/qd0vuY9+YvMHqHOo/nTzWCCJvVh hwBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLXGAbCLwSue+rsTYVcpzuuQk6hL0q5RdOPZ/L6m2sM=; b=I8Ib45xLeTZ0+QyunePB1tMl59VIQSLFTPJPhihUhijS/0e721ArU5ENQrOCPSHV7h Fo+cxWR3gbVPDXaPzjrftJQbahkGgWeJdaxUfOHVKKwiaZqaSSkFqqt694xgjRM+fLUa TYlO9/oB9kBbDaGpQuE8KYbQq1B23W6UmFepPyxPiJAvKv5TEwXRbPzGu3EVH43AlANn 4uZkxLDczQYtVQmSdwkKnYMGR671Lme9rxTR9nMC4Jv+IClupqTpbxARyw+pbtOHsnA7 g3hDwV1wPG4HR+4dJZQC2sBMbJkU852Y7VaITBIzK49VHmlRCp6nfYhaTkfoXqbaLsQq tKgA== X-Gm-Message-State: AOAM5317rqOWFx7dCSaWHmpALdAN4qWeNdsPZeLcLKZMC+lidIOWT0Hy bvU2n589HcvuTGcskbPOHCF3q2CVVy/ywA== X-Received: by 2002:a62:9288:0:b0:3e1:c44f:a1b7 with SMTP id o130-20020a629288000000b003e1c44fa1b7mr11502539pfd.63.1629322157442; Wed, 18 Aug 2021 14:29:17 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/14] tcg/arm: Simplify use_armvt5_instructions Date: Wed, 18 Aug 2021 11:29:01 -1000 Message-Id: <20210818212912.396794-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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.23 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" According to the Arm ARM DDI 0406C, section A1.3, the valid variants are ARMv5T, ARMv5TE, ARMv5TEJ -- there is no ARMv5 without Thumb. Therefore simplify the test from preprocessor ifdefs to base architecture revision. Retain the "t" in the name to minimize churn. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 18bb16c784..f41b809554 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -28,13 +28,7 @@ extern int arm_arch; -#if defined(__ARM_ARCH_5T__) \ - || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) -# define use_armv5t_instructions 1 -#else -# define use_armv5t_instructions use_armv6_instructions -#endif - +#define use_armv5t_instructions (__ARM_ARCH >= 5 || arm_arch >= 5) #define use_armv6_instructions (__ARM_ARCH >= 6 || arm_arch >= 6) #define use_armv7_instructions (__ARM_ARCH >= 7 || arm_arch >= 7) From patchwork Wed Aug 18 21:29:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499014 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1058853jab; Wed, 18 Aug 2021 14:37:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJvyXMj1xAk3eD25pAd72cn4zKYk/weyUW4QBUCCB0mT4+UkQxPCn2uskhOemoq1Mih1vN X-Received: by 2002:a05:620a:3187:: with SMTP id bi7mr360522qkb.415.1629322673618; Wed, 18 Aug 2021 14:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322673; cv=none; d=google.com; s=arc-20160816; b=PUZiCcxBfP1lLZH8u4yVpUEA0plcgy4OXGSGeQP72x2lOfKNQuUKnqXaB4izt3pjgh qMhvIRe/6YLMxMtXebbyTUOYTlfMVfNXS+MSVJ8JK4KaX9XMXkVlRWXQ40RSREk0yUHJ U7H8jLhijhpFiN8r3YzywSYapdE9X/UYWAOYD5NGhiD3UdekHVjp8EOFopudZ1NXqgM+ QHAomGktFO5HlsRHUs50jNVZ95U8Nxkzs/Z4Va2a0nfw3qVrM2XO3Q9k2APrAIAuX26j bWCNxHsm6Gd4Ow9zs/17NDRMNq1p/egXu5j32+Ayt2KRqs6O1f17u7lwf88H46MPDJSB FUZg== 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=+U0KsNEvHwE3GkrSYf995PkcGQk0Ki7THUCDOfcXQAU=; b=gBnosr9lqW4je+XG1eFsSFOrt4mi+JDv7BzD1VIFF7wWFGQLatHOgI76ANrL9ZQKoS aZ5LHn2x4T1I6RtbgdNLzI8xUbSMt6Le5jR1Dj4dplwnaN/RpsgFq9hX+dUz9qpZka4N dOPlfU7yZjF6BOsxMT6e9Uv7f2A7mdpc1q7dykM6ObyDb+GRaoDZRc8krypLbWBVjJVp /zewzC95amZ6v6CECptl1ndJiIxWP++DEjnMXeBGo5iT13ewwVrnuANLg8+PBCGUBO2l 5jLST77Ra4MutKbcJ/7JyWeqwn7LCafBFyp+PEnSFKSjiQAhD8Hgv+QJpC8xk9rtRCAd zaRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iXI+M9xY; 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 s16si744582qkp.136.2021.08.18.14.37.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:37:53 -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=iXI+M9xY; 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]:57966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTFw-0000bz-SL for patch@linaro.org; Wed, 18 Aug 2021 17:37:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7h-0005lo-AG for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:21 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:39463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7f-0005iz-N0 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:21 -0400 Received: by mail-pl1-x630.google.com with SMTP id l11so2673228plk.6 for ; Wed, 18 Aug 2021 14:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+U0KsNEvHwE3GkrSYf995PkcGQk0Ki7THUCDOfcXQAU=; b=iXI+M9xYljG+sw2vUV32d0yZyvTFVLbjBsiNcH6FgxD6uZ/DcHv8FqRQoW6W7PMAxT pDo+XhNfQOgPlkZ8PLj6LREErixoQnRzzGVrJhC+eFExJx1JqcEd2LcEbcb3Db/Ic9ba hlPyXWZrhkH2DZdrYn56futSVzoCK0OVMSG5DOkCD4GGTY+p47ITEwrR5RIlwtSydyuq IzMZ7Izz9DSA1CcMwO0xKBKcM0p7ZxxvQ732uZxpZZATkFr3QFqVb4DwsCnUT+UCIeQR nDKpnVMfSWNMn4TIHemJhnRqPA2lOtfTBygAaRxa3P01vx377NJrWH9klBzRC/xH1au7 T7oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+U0KsNEvHwE3GkrSYf995PkcGQk0Ki7THUCDOfcXQAU=; b=s+b/yLxY9ws23AtwJ0zD8Pp8F5U5FT3JRxegV5yPDJXQZaGxcNm6tG29rWlqoxrTrf 1so/f4/Otio8zXjopL1PTa9Nb53gTbDq1Jl7qyw+B6UW7iC7w12pIbu0xx82qj/ghi3i QCJhMgogCs7RO9EcvrwLaiBnkdPFu0RoN9fRBtMQ9DmU8TH06cE3PhPytSuawNiRTfuE kDjJcFFWWC1uZzW1EHLN0FHCgnx0dBpNieZHET8z+Fdqw1Tj13PTAm/JYBCRsY6uvl0m HHZ8jBjkHx2XFEs5RxWa0uJXOcNUBsStiKQW0zhmQxoEGzE/ftJhzy+7brzFJVP4Vi0y f9OQ== X-Gm-Message-State: AOAM5316eEqDsjAPmVtWg5u0VGrFCw7VxR85Y15rbxX/0gSKIozABZXt B0qzC5QDQGAV7O64TPiwe0biEQCzbdGggA== X-Received: by 2002:a17:90a:29a5:: with SMTP id h34mr7515078pjd.69.1629322158365; Wed, 18 Aug 2021 14:29:18 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/14] tcg/arm: Support armv4t in tcg_out_goto and tcg_out_call Date: Wed, 18 Aug 2021 11:29:02 -1000 Message-Id: <20210818212912.396794-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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.23 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" ARMv4T has BX as its only interworking instruction. In order to support testing of different architecture revisions with a qemu binary that may have been built for, say ARMv6T2, fill in the blank required to make calls to helpers in thumb mode. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 49 ++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 0578f9749b..87df812bb5 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1211,7 +1211,8 @@ static inline void tcg_out_st8(TCGContext *s, int cond, tcg_out_st8_12(s, cond, rd, rn, offset); } -/* The _goto case is normally between TBs within the same code buffer, and +/* + * The _goto case is normally between TBs within the same code buffer, and * with the code buffer limited to 16MB we wouldn't need the long case. * But we also use it for the tail-call to the qemu_ld/st helpers, which does. */ @@ -1219,38 +1220,56 @@ static void tcg_out_goto(TCGContext *s, int cond, const tcg_insn_unit *addr) { intptr_t addri = (intptr_t)addr; ptrdiff_t disp = tcg_pcrel_diff(s, addr); + bool arm_mode = !(addri & 1); - if ((addri & 1) == 0 && disp - 8 < 0x01fffffd && disp - 8 > -0x01fffffd) { + if (arm_mode && disp - 8 < 0x01fffffd && disp - 8 > -0x01fffffd) { tcg_out_b_imm(s, cond, disp); return; } - tcg_out_movi_pool(s, cond, TCG_REG_PC, addri); + + /* LDR is interworking from v5t. */ + if (arm_mode || use_armv5t_instructions) { + tcg_out_movi_pool(s, cond, TCG_REG_PC, addri); + return; + } + + /* else v4t */ + tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addri); + tcg_out_bx_reg(s, COND_AL, TCG_REG_TMP); } -/* The call case is mostly used for helpers - so it's not unreasonable - * for them to be beyond branch range */ +/* + * The call case is mostly used for helpers - so it's not unreasonable + * for them to be beyond branch range. + */ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr) { intptr_t addri = (intptr_t)addr; ptrdiff_t disp = tcg_pcrel_diff(s, addr); + bool arm_mode = !(addri & 1); if (disp - 8 < 0x02000000 && disp - 8 >= -0x02000000) { - if (addri & 1) { - /* Use BLX if the target is in Thumb mode */ - if (!use_armv5t_instructions) { - tcg_abort(); - } - tcg_out_blx_imm(s, disp); - } else { + if (arm_mode) { tcg_out_bl_imm(s, COND_AL, disp); + return; } - } else if (use_armv7_instructions) { + if (use_armv5t_instructions) { + tcg_out_blx_imm(s, disp); + return; + } + } + + if (use_armv5t_instructions) { tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addri); tcg_out_blx_reg(s, COND_AL, TCG_REG_TMP); - } else { + } else if (arm_mode) { /* ??? Know that movi_pool emits exactly 1 insn. */ - tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R14, TCG_REG_PC, 0); + tcg_out_mov_reg(s, COND_AL, TCG_REG_R14, TCG_REG_PC); tcg_out_movi_pool(s, COND_AL, TCG_REG_PC, addri); + } else { + tcg_out_movi32(s, COND_AL, TCG_REG_TMP, addri); + tcg_out_mov_reg(s, COND_AL, TCG_REG_R14, TCG_REG_PC); + tcg_out_bx_reg(s, COND_AL, TCG_REG_TMP); } } From patchwork Wed Aug 18 21:29:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499019 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1061264jab; Wed, 18 Aug 2021 14:42:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvVoID+ozfZtWfRWHMAgntCuvvNiJzH9Q7PIscwXRSFm8nrD0NrJ3/y/A8ylRh6SszA1FP X-Received: by 2002:a37:d54:: with SMTP id 81mr389732qkn.103.1629322920673; Wed, 18 Aug 2021 14:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322920; cv=none; d=google.com; s=arc-20160816; b=gzn2J4uvvBKmEnYQhU+Wf6TD6AEJ+6H1hMJ5NPQDYnWsMUwc3t8kuwe7cDi5gW4JMb AUHX2biwPjqi4qWKcpxlh63FMYpirNmDU4Ulk3QMjir9KSVNYnoutIM/hHdp6oxyCLNr aQcHmX90tpxQBY0gHmRXw+RHwjEOxDS1DlY+/PjRZP4IpQdL5Ybw/ADTI0km6P9C0uPB 6xE0pCcf+7DFu9tL3h962ByCyVDtD0JSaJTGToBEwTYOLt4UDJFpnfI/hdHOURerXv6s ibdCOFdlXR/sPXsHOGiqDkqDRDJyBSF8mk5uK4SECSBrjHv246gFvKqqk/0Xci5wVgnM tEKQ== 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=Eg6xgC0Zn9gwcbgRPdMs7fC32gwJkdzHxMMdYwWwU48=; b=qhnUdVrQGAd6JnUZg4cWWZBsd+++QiP8uJ4C6a09GXNVsZzkR63+bOqaORPGkYwsBT t4KwBR2HCNwVMAs1dd+yDxQozpVxAto1vbNOoJOjUquUALO8qwzah79iDCBQel8tH+dr pdqyvqa7IdYjzsRWZyWf52To8k17Isw/vt6kvSbm8AQ+V88cyaYTa2YRsLXaC6Ils8uE fJmnY1FDbVSiT6RNuj1MvDI7Zzt9CsZcP2I73sRT0UGUAyHY/pUpQixcIMfGvnmRe5xS 4/VRApTGBeEwXaim2NkI75usjVUpA6Bc9i8l6WacosNKRdZlPH8jd0sH3Czy3qAjDkVS Uvuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lzqU6AbY; 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 1si820453qtz.1.2021.08.18.14.42.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:42:00 -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=lzqU6AbY; 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]:41914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTJw-0000WB-2z for patch@linaro.org; Wed, 18 Aug 2021 17:42:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7i-0005nP-8T for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:22 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:43914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7g-0005jk-OW for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:21 -0400 Received: by mail-pg1-x533.google.com with SMTP id r2so3707343pgl.10 for ; Wed, 18 Aug 2021 14:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Eg6xgC0Zn9gwcbgRPdMs7fC32gwJkdzHxMMdYwWwU48=; b=lzqU6AbYnic27Qu+JRNkYp2wEg5vm3lsRjgvxjYO1Vt5JpnTMaaj8f+eNd2uEXJkaz JInq2JrJbLNzZsLWB7vpfmCAZ/xGrmoSjshpaBr2Oi3KqceSHVuhV1j5axtVp79O+uVr ag0oYpEXYOIFPcfWplGwsWDiGwrMgzKMmMQQOPTV7C7jijhJZ9nTMKTYwWfsInbm3Mpa SkjVgv1aAMfyJHcp8M9kpf29x5+s30udWrYApoIkaPaS4zyxMr4gunWmMgfjbKDmAlFE O8ExFR+YNBitM0oON+jS8T2SMIW4F2OjlvLbp6nm/H9gPU66CujKsZWfZlZmcwdacLOD hpIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eg6xgC0Zn9gwcbgRPdMs7fC32gwJkdzHxMMdYwWwU48=; b=pOhxSHHAvIJZgAmbHn+F45E1hgDSZ3VV0at0ViBZRhJXamzrIU0+5KFydDs1HKpHWx daWb4p2qWSJj4jXlBMJeBB/uuTyAMTgYb8Lh5HxKKGMMWjnb7l0q8ZBnPJINI6XOofxL phJl+3AyMY3PT8coHz3KkualmDakSil/X97aIDhv9Ux9dPIYEeS4pv+lYKiqSF/7lT7f V0cP7zVC98S/+Z/vHoHHmt9J4La04lh2z6Emi4HmoUy/TVxYEUKDDO4UbVpGl1dpZiyT ACOag29o5kKmEdaE+yjZgmw7iw7Z7rgjC5ea+Dns5BDnwtQodzaMa/Uh2BgKNQj85Oe5 SY9g== X-Gm-Message-State: AOAM5306WMsp8jos5T+6vG5oEZj+DKVsPcDk339KHfw9wO3JJGMGv09C 8SzOExl2vuay5qIasWVPim5qosDP1cf+jw== X-Received: by 2002:a63:164a:: with SMTP id 10mr10873862pgw.161.1629322159470; Wed, 18 Aug 2021 14:29:19 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/14] tcg/arm: Examine QEMU_TCG_DEBUG environment variable Date: Wed, 18 Aug 2021 11:29:03 -1000 Message-Id: <20210818212912.396794-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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.23 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" Use the environment variable to test an older ISA from the one supported by the host. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 8 +++++++- tcg/arm/tcg-target.c.inc | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index f41b809554..e47720a85b 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -28,9 +28,15 @@ extern int arm_arch; +#ifdef CONFIG_DEBUG_TCG +#define use_armv5t_instructions (arm_arch >= 5) +#define use_armv6_instructions (arm_arch >= 6) +#define use_armv7_instructions (arm_arch >= 7) +#else #define use_armv5t_instructions (__ARM_ARCH >= 5 || arm_arch >= 5) #define use_armv6_instructions (__ARM_ARCH >= 6 || arm_arch >= 6) #define use_armv7_instructions (__ARM_ARCH >= 7 || arm_arch >= 7) +#endif #undef TCG_TARGET_STACK_GROWSUP #define TCG_TARGET_INSN_UNIT_SIZE 4 @@ -83,7 +89,7 @@ typedef enum { #else extern bool use_idiv_instructions; #endif -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON__) && !defined(CONFIG_DEBUG_TCG) #define use_neon_instructions 1 #else extern bool use_neon_instructions; diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 87df812bb5..0c7e4f8411 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -2455,6 +2455,38 @@ static void tcg_target_init(TCGContext *s) } } + /* + * For debugging/testing purposes, allow the ISA to be reduced + * (but not extended) from the set detected above. + */ +#ifdef CONFIG_DEBUG_TCG + { + char *opt = g_strdup(getenv("QEMU_TCG_DEBUG")); + if (opt) { + for (char *o = strtok(opt, ","); o ; o = strtok(NULL, ",")) { + if (o[0] == 'v' && + o[1] >= '4' && + o[1] <= '0' + arm_arch && + o[2] == 0) { + arm_arch = o[1] - '0'; + continue; + } + if (strcmp(o, "!neon") == 0) { + use_neon_instructions = false; + continue; + } + if (strcmp(o, "help") == 0) { + printf("QEMU_TCG_DEBUG={,} where is\n" + " v select ARMv\n" + " !neon disable ARM NEON\n"); + exit(0); + } + } + g_free(opt); + } + } +#endif + tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS; tcg_target_call_clobber_regs = 0; From patchwork Wed Aug 18 21:29:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499009 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1053851jab; Wed, 18 Aug 2021 14:30:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVKyATHr2sEJ/vcApjDhRBwJPexuwKQQZck4P6e6CXV8cmTUzwESpKhE4GMHntqJMFc80H X-Received: by 2002:ae9:c115:: with SMTP id z21mr343058qki.482.1629322226540; Wed, 18 Aug 2021 14:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322226; cv=none; d=google.com; s=arc-20160816; b=BQbQPgzCOLYkKVtg4Iw+snFbiLIrj0CtHWAmqPBGREkv20O9m3qXU2PDQXaUZJS6or XZRRVdpNDeCe1dtJ0r8Ympj/0YdrVBLLGtrq9h7Rt8BLLzO8OtQ1HkAd2C5NYVhnOf89 HwD5oWMFwnsqHeO9rZzcrW+76mptfXxForCE0cBaXzQRw0PbhaL2niTl5oc1cjZq3FJR kQyMHztDH4nAMnunA304UYBNru53DwBw9m4FavRY3oIGe4DEYLhFefp7YoeDCOyo2jMZ wTpVyNJyrVRVd5hO0kIrwBkYOsNJOo+rHhuP/Cte1ukYqUhiJ4EYJJ2g+d3Cnc5+46iV liMw== 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=Stidml/odPUvC+YHiMlAiiUsdbljrJSn16BoAbCClEk=; b=VMoSspkDQ4x9Z/RL8reoUqC0VzzwmGLObDOyt60HjuJq6lETg+ei0S8wzte+fdu99f RpxGUgJbXpk2/FbndPOEo0kWP55/RK20KxxmL5WDW6skaVgl4tEkF9o+sBlGeiQI2kLJ M0/r5js+g0kDuFI7nuMwo77FiRxnGGQyMKoDy4SYyPovGXFyeDeUMX9fiLyaDC/VMncL Y40im5TOqATGC2UkgazrFJD8VHQAo5jmKck0HUyrT0UJemtYRvNXq4AjWGfaH2z3rQ+E A7V2B11X3kJL+nSSZMWoTM72XgUXasIU7Amzc9tCk4zxvXTHeumRxFvwmdr2ViOaqj0m c2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k9PvBaGJ; 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 s20si382215qki.373.2021.08.18.14.30.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:30:26 -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=k9PvBaGJ; 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]:41438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGT8j-0005xu-RE for patch@linaro.org; Wed, 18 Aug 2021 17:30:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7j-0005ph-GW for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:23 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:36425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7h-0005kK-OM for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:23 -0400 Received: by mail-pf1-x42e.google.com with SMTP id m26so3503261pff.3 for ; Wed, 18 Aug 2021 14:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Stidml/odPUvC+YHiMlAiiUsdbljrJSn16BoAbCClEk=; b=k9PvBaGJ1d+Chbb7Bg5M3aj1SAybrUF78zNs58IMS2yjy7ebEzfpgoiu7TBTaNE1h8 hO/2HtoiYyCtLmNY6ypGf2HV0lqTWIC+Fd0qCKPTjNa7glD9JWFwRUS4dJ8eq2twxAws 06W0r4Kf+Oyvon/vx92v3P3hmyDuul52zs/3Ss2Ca8Ho7glQHQ45GLyvEfjm0xZ2JvBJ vJJWPieSrdrcR9+9L+yJo0Yrix8iiPK0kE2PiKFK8mXKiIeRTDH7eZed+jN8moV6x9oR C3iIXI6ZiaQTLVODLwqHRMZjyEhGxd1QuPGlXx8IIF9aiEnRznJ9pwLXhPFdfXYQX0Ma RSGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Stidml/odPUvC+YHiMlAiiUsdbljrJSn16BoAbCClEk=; b=msc5ZXfrmYdeQiQBxrX7NxZOPMTO2lWei5FnVSf/fMHvEsRn/MeWFZ/vkkPYIipx9S WwW7RXDHQjNyv96okNeos+c3AddtSnF8BVrEcWBXgjMCjqgJBOn1B89qttyA2NwwmOMl AfQNeqfHJt3aojn5H6lFu9zzO+B7VBEtGRvFO84ZqoR85Y2Z8QqBzril7b9r7YJXHTPt bHojce+/kw2XagG8X8uq+iitmwKHyP8l1Li5+L13fmACLrw/xCHf1yTzhkWSjKkdO0PB PVJk/qIrHk8gvgn4jYAIpcSp0LyptH6v5YBD4ZOOIXEVopE3IbOb4g1KsPik+S6rdvat 7N3w== X-Gm-Message-State: AOAM5307CoaFQ2NPATSW/UorogpL0xN/CEbYhnjeJdNtFNLuElM+3kOw SQ5RrqFFvVSiss7lZipPFuiu0C2r7Xb3Tw== X-Received: by 2002:a63:d34f:: with SMTP id u15mr710238pgi.200.1629322160435; Wed, 18 Aug 2021 14:29:20 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu Date: Wed, 18 Aug 2021 11:29:04 -1000 Message-Id: <20210818212912.396794-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-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.23 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" >From armv6, the architecture supports unaligned accesses. All we need to do is perform the correct alignment check in tcg_out_tlb_read and not use LDRD/STRD when the access is not aligned. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 69 ++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 31 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 0c7e4f8411..c55167cc84 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -34,13 +34,6 @@ bool use_idiv_instructions; bool use_neon_instructions; #endif -/* ??? Ought to think about changing CONFIG_SOFTMMU to always defined. */ -#ifdef CONFIG_SOFTMMU -# define USING_SOFTMMU 1 -#else -# define USING_SOFTMMU 0 -#endif - #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", @@ -1526,15 +1519,20 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, int fast_off = TLB_MASK_TABLE_OFS(mem_index); int mask_off = fast_off + offsetof(CPUTLBDescFast, mask); int table_off = fast_off + offsetof(CPUTLBDescFast, table); - unsigned s_bits = opc & MO_SIZE; - unsigned a_bits = get_alignment_bits(opc); + unsigned s_mask = (1 << (opc & MO_SIZE)) - 1; + unsigned a_mask = (1 << get_alignment_bits(opc)) - 1; + TCGReg t_addr; /* - * We don't support inline unaligned acceses, but we can easily - * support overalignment checks. + * For v7, support for unaligned accesses is mandatory. + * For v6, support for unaligned accesses is enabled by SCTLR.U, + * which is enabled by (at least) Linux and FreeBSD. + * For v4 and v5, unaligned accesses are... complicated, and + * unhelped by Linux having a global not per-process flag + * for unaligned handling. */ - if (a_bits < s_bits) { - a_bits = s_bits; + if (!use_armv6_instructions && a_mask < s_mask) { + a_mask = s_mask; } /* Load env_tlb(env)->f[mmu_idx].{mask,table} into {r0,r1}. */ @@ -1578,27 +1576,32 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, /* * Check alignment, check comparators. - * Do this in no more than 3 insns. Use MOVW for v7, if possible, + * 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 byte. */ + 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 && TARGET_PAGE_BITS <= 16) { - tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << a_bits) - 1)); - - tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask); + tcg_out_movi32(s, COND_AL, TCG_REG_TMP, ~(TARGET_PAGE_MASK | a_mask)); tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, - addrlo, TCG_REG_TMP, 0); + 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_bits) { - tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, - (1 << a_bits) - 1); + 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, addrlo, + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, t_addr, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); - tcg_out_dat_reg(s, (a_bits ? COND_EQ : COND_AL), ARITH_CMP, + tcg_out_dat_reg(s, (a_mask ? COND_EQ : COND_AL), ARITH_CMP, 0, TCG_REG_R2, TCG_REG_TMP, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); } @@ -1763,8 +1766,9 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, tcg_out_ld32_r(s, COND_AL, datalo, addrlo, addend); break; case MO_Q: - /* Avoid ldrd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions + /* LDRD requires alignment; double-check that. */ + if (use_armv6_instructions + && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, addend); } else if (datalo != addend) { @@ -1806,8 +1810,9 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); break; case MO_Q: - /* Avoid ldrd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions + /* LDRD requires alignment; double-check that. */ + if (use_armv6_instructions + && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_ldrd_8(s, COND_AL, datalo, addrlo, 0); } else if (datalo == addrlo) { @@ -1882,8 +1887,9 @@ static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, tcg_out_st32_r(s, cond, datalo, addrlo, addend); break; case MO_64: - /* Avoid strd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions + /* STRD requires alignment; double-check that. */ + if (use_armv6_instructions + && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_strd_r(s, cond, datalo, addrlo, addend); } else { @@ -1914,8 +1920,9 @@ static inline void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); break; case MO_64: - /* Avoid strd for user-only emulation, to handle unaligned. */ - if (USING_SOFTMMU && use_armv6_instructions + /* STRD requires alignment; double-check that. */ + if (use_armv6_instructions + && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_strd_8(s, COND_AL, datalo, addrlo, 0); } else { From patchwork Wed Aug 18 21:29:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499012 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1056749jab; Wed, 18 Aug 2021 14:34:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRXAPRvB3glB1hlL0LbvVgExbDkMALmTM4qRNwObxaO4FpL40r6NX4hyJa2B+i0D9bdbWS X-Received: by 2002:ab0:494a:: with SMTP id a10mr8504956uad.90.1629322470581; Wed, 18 Aug 2021 14:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322470; cv=none; d=google.com; s=arc-20160816; b=RCl1HCIb5El3TBELAdI5RrpAC/7P1e8xPiuCQwQeNQz3Ocuipsdsf1EhN/kktnrIto gnd1AnYxRKlxBBdRz8Y4CJT3OTKnCCUU2kEC+Vvp3soYCJ6qstqEmOOfQWy3fjDclgp5 4IgQ3fPvRuiqtV9oISLLYsenm/e09tyqy23bZCbj5IRFs73P2zbSme8WUU+dEa+9Ri8J JXoj0jO33Xveo8zVnbJmIdFBcqBr1qHHyPPkgzbmL+rQ2HtsFMi4Ks4JOaCdZ6EEFg+N ELADy5JIO2O651Q9l9sB3AHXYNkLn8+S/F6HvROhxVlyM4J0/Iq32gJWZYdjDKucCeyT LNtg== 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=bLtXt+lT9me4raRszPf/cWzutepwm37BmFJxuVb8lnI=; b=XELnerd+fe+7sJ7cJImY4xj04qoMcB1coMr8b3xBQsKsJ3W/En3T8jmuAsbZ8XtHGx 80wj2z88yumgSv7PSspnQP7nZnuz3PakNrjHfdIkrWr6IAmBLoM4Bn493uUDFpT16ZHg mRr8IHW7fEedpYrVOZ84P08p/tNOLwzsqvp0x5u2ec2LHYdwT7b2FFmm0fql0NpQ1U7S ysxzS1gdHOyVQ1PGuNWHAhO40Ls/KI/MKv6MycbrnDQl0aHGAxsNMEwRCvGysd0PZpA3 V0Pok/LwakKhS+UIE8CVCsihCM23ylBfaWPWErpIliJBuVIz8oeXuCYzUg+Nj2bmMCIb 61Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T5CZyFag; 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 r7si527243vsn.203.2021.08.18.14.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:34: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=T5CZyFag; 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]:49732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTCg-0003Iy-0b for patch@linaro.org; Wed, 18 Aug 2021 17:34:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7k-0005qw-4R for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:24 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:34313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7i-0005lH-Kw for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:23 -0400 Received: by mail-pl1-x62f.google.com with SMTP id u1so2698300plr.1 for ; Wed, 18 Aug 2021 14:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bLtXt+lT9me4raRszPf/cWzutepwm37BmFJxuVb8lnI=; b=T5CZyFag8HBOBK/jIfxFy3NYgEqQb57tjwrAYxfiX4sgZH5lLQq8jpt8JaOWtbZXXQ 2vTHJAoB8WIvQ/kFwzFAohRJoN2wjnQ4Wwp9A0RwCmtSMywpnt+dMu3GvurNT1IM6SBX iX/RpV9qgBktXAD64mJ67TsaeDz7/4J2S003dYon3qTL/oJQGw6/VGgqSrMSWMUiDhMs gfOyZ6i3vMzvNuVP+oEFBwHiumLuauGHuzztqorkrwM9s8DW8ecMEWqUu0HyE7pMi6W5 yUkUAd/gP84A8O6k2oZ72jq7gmCZwaP48lL5i0C8OtNSWEZnKF791Jc+L7o8+H4XgyQf notA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bLtXt+lT9me4raRszPf/cWzutepwm37BmFJxuVb8lnI=; b=nPvO+iO+PC7XTSPs4jgABy9ncdCAti9RT7qy4CQg8peWNSSD831wMC7S1qAJ4Vhax5 9TXdIitVn6118ywiIhw7uLd9wDHIVsqd2R3oUs1UeYSZ9nXN7BQKoSglo+Vx/VjvDmbK ZY2CWGsr0ibrCOCbDiT5k5n5Q9aq0FuS3dvE39o+GB3vBxJrw85dW/IP7QGa/fnQ9WRK kTuD3BgTOuz7gbnlFD89ElWdYvyyHFXCED3pEgd+aE67hCPDcUVZ8WRWWtJpLVhddK4R cVNfiVmg4tobJRJB1NjksoqvhMLz/bckFtPWwy8Eka1RxJx671/r5uR04CPxpQ0Rg0Iu cGzA== X-Gm-Message-State: AOAM533gPuvYEa61x/O8Fo60jSiw+x7pqS1TajJxdI+9ovoiQ4a+SKmD KbLqMDZiLR8siZRRDBWL11dA5vhSxg3L5A== X-Received: by 2002:a17:90b:14b:: with SMTP id em11mr11372869pjb.125.1629322161354; Wed, 18 Aug 2021 14:29:21 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/14] tcg/arm: Split out tcg_out_ldstm Date: Wed, 18 Aug 2021 11:29:05 -1000 Message-Id: <20210818212912.396794-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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.23 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" Expand these hard-coded instructions symbolically. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index c55167cc84..63b786a3e5 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -134,6 +134,9 @@ typedef enum { INSN_CLZ = 0x016f0f10, INSN_RBIT = 0x06ff0f30, + INSN_LDMIA = 0x08b00000, + INSN_STMDB = 0x09200000, + INSN_LDR_IMM = 0x04100000, INSN_LDR_REG = 0x06100000, INSN_STR_IMM = 0x04000000, @@ -586,6 +589,12 @@ static inline void tcg_out_dat_imm(TCGContext *s, (rn << 16) | (rd << 12) | im); } +static void tcg_out_ldstm(TCGContext *s, int cond, int opc, + TCGReg rn, uint16_t mask) +{ + tcg_out32(s, (cond << 28) | opc | (rn << 16) | mask); +} + /* Note that this routine is used for both LDR and LDRH formats, so we do not wish to include an immediate shift at this point. */ static void tcg_out_memop_r(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, @@ -3119,7 +3128,10 @@ static void tcg_target_qemu_prologue(TCGContext *s) { /* Calling convention requires us to save r4-r11 and lr. */ /* stmdb sp!, { r4 - r11, lr } */ - tcg_out32(s, (COND_AL << 28) | 0x092d4ff0); + tcg_out_ldstm(s, COND_AL, INSN_STMDB, TCG_REG_CALL_STACK, + (1 << TCG_REG_R4) | (1 << TCG_REG_R5) | (1 << TCG_REG_R6) | + (1 << TCG_REG_R7) | (1 << TCG_REG_R8) | (1 << TCG_REG_R9) | + (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_R14)); /* Reserve callee argument and tcg temp space. */ tcg_out_dat_rI(s, COND_AL, ARITH_SUB, TCG_REG_CALL_STACK, @@ -3147,7 +3159,10 @@ static void tcg_out_epilogue(TCGContext *s) TCG_REG_CALL_STACK, STACK_ADDEND, 1); /* ldmia sp!, { r4 - r11, pc } */ - tcg_out32(s, (COND_AL << 28) | 0x08bd8ff0); + tcg_out_ldstm(s, COND_AL, INSN_LDMIA, TCG_REG_CALL_STACK, + (1 << TCG_REG_R4) | (1 << TCG_REG_R5) | (1 << TCG_REG_R6) | + (1 << TCG_REG_R7) | (1 << TCG_REG_R8) | (1 << TCG_REG_R9) | + (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_PC)); } typedef struct { From patchwork Wed Aug 18 21:29:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499015 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1058999jab; Wed, 18 Aug 2021 14:38:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDKD4QaA6ub+/pq9cBEi8xtFyr4J/i+Y9VDPL8E/he1lZxyJEznHp3Clo5s0DuX24C+wob X-Received: by 2002:ac8:66da:: with SMTP id m26mr9624183qtp.273.1629322688166; Wed, 18 Aug 2021 14:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322688; cv=none; d=google.com; s=arc-20160816; b=TNOsuuM85VzaqpxGzzvzg1RoV3td5z7zDfaJb0rcFGp6uOByzbjznOj9pXK0iJktIB TYuRd3nbM+Ooj0+GBmn4qbN+IlXJW+4SpGSvBw5D2kHAKRbxhmqX4zfAhsz21HUPHhAs hAFWiukYrRw2ToQu5CYqQ0SiS3W46j/KuVAWA8dPXFCKjYXEOX4n9IEk7/MS5pDFzVi1 /cvks1RfEAH3/l+vnp/1PS1S7R5vMc7xI7W3aqPil3nQLLDB7QglTX6072mrXCLRIRe7 1kYkFnLDSeSUqQ433gYD2BNFc9XfKtYebA6gy2DzGdFkhfd3osMZDQpYgb2XPuTr/beD t86A== 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=KIB4swRzSKHTsS4CjRPcvYvnWWs4lm8C1kDoEwAC9Xc=; b=vSaDGkRS0tU4EzHdLQHxMsNY+TaSvoYz6QH0qLKKqTO88Cxp16oTrva4+Uz1tyep1U 8lDMwqTJ01Bx4zVS4U7wGw3Jv9Hh1YjYVZNUjzUArtNrqRBqh4wQLSlqLH8WVyx60LLm yRKCeWc3a/FlHORTmkeXJ08gnXstlve0cYTAj11OJPNz63Zjgvq+xilkUSORSIT1kYNJ oavt74reaokV3HPswZuAYPbB8YLiuOEyqsG9EBSgCwTauUjKhIVx0hdDiL4s/vIp8Bik +cJROv8+RSx2YkzIODEqTACL24pWcSftZcP+D2U/h8xXP5xfYcdiCFky7DI/k/cHNvbJ mEKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i5k8/k/g"; 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 n18si791881qvk.99.2021.08.18.14.38.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:38: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="i5k8/k/g"; 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]:58200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTGA-0000lD-VN for patch@linaro.org; Wed, 18 Aug 2021 17:38:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7m-0005wE-59 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:26 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:46629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7k-0005m0-2z for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:25 -0400 Received: by mail-pg1-x532.google.com with SMTP id k14so3704040pga.13 for ; Wed, 18 Aug 2021 14:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KIB4swRzSKHTsS4CjRPcvYvnWWs4lm8C1kDoEwAC9Xc=; b=i5k8/k/g9tB/nrwbtfO4LI3Ec6Vv7mPiYlMvU2r+CUNpN9AQih2JeKfT+x+5n93h5a xtW0keHTvAvRAQynTcUpiPhox8yxTstggOMJ7DVCNgfNzwqtw4b2kMgRHIc6C9LUjI95 jAZbmRuUa/LwbdbTmzMCm6Z6UDYoVq942cCFbhDUUnYfRKNYtjMoYOH87Fel3Q2GHSZ7 ++zO3EFjNRIyRyJD87QodHPmBmU4PiIoahYUoO1LK6tBi29CSvHd/hwVOKEHpNQMUK1y nQTGPJUh4Djj5/mtrwFqc+h1W+qvu8AaF5nnJjnLib/yD03F9EGm2ISaO3XE4dHwI68L +OQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KIB4swRzSKHTsS4CjRPcvYvnWWs4lm8C1kDoEwAC9Xc=; b=l/JkrZ0zDTcn7Ojek1QLOwjuK0PWkY0jtdXjplIvw0SvmPfMz2KSAlweY53/treED5 DRdzpS1MtG4iz4OM6AVXJ5iEnzlD/exLcnJGHMZYEh+HZa8tZvZRK4gfZ8EZ9gS8/HuP 7hGXpBo0aMy2l7V/3O49h+LkJC3+AhXQZ2i8lzSrdcgGxXkZ7NQNTwBs58uvywVw9iph RCsiE6ZFohewwhsAtucckXLsh1ZpAWc9ZyGjmWdd3Fiboezgfjww6U0nO5S+lUEcpbk0 P2Cspky4uJeTl6AUcFdyE1/uP2VJRruaRXyhQie+8xnxxQfD5jv3HKNjn6jpuWLcdWg/ vKRw== X-Gm-Message-State: AOAM53272siDWcmVqYSjQAbmVW4BTUab/YKNG1gomyG4OMC8rIkUFnBa YpCa6awyMDx6vgbY+zKza3aorS0Z2NUMyg== X-Received: by 2002:a65:6894:: with SMTP id e20mr10538191pgt.419.1629322162700; Wed, 18 Aug 2021 14:29:22 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/14] tcg/arm: Simplify usage of encode_imm Date: Wed, 18 Aug 2021 11:29:06 -1000 Message-Id: <20210818212912.396794-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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.23 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" We have already computed the rotated value of the imm8 portion of the complete imm12 encoding. No sense leaving the combination of rot + rotation to the caller. Create an encode_imm12_nofail helper that performs an assert. This removes the final use of the local "rotl" function, which duplicated our generic "rol32" function. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 141 +++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 64 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 63b786a3e5..265370b2ee 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -305,10 +305,10 @@ static bool reloc_pc8(tcg_insn_unit *src_rw, const tcg_insn_unit *target) { const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); ptrdiff_t offset = tcg_ptr_byte_diff(target, src_rx) - 8; - int rot = encode_imm(offset); + int imm12 = encode_imm(offset); - if (rot >= 0) { - *src_rw = deposit32(*src_rw, 0, 12, rol32(offset, rot) | (rot << 7)); + if (imm12 >= 0) { + *src_rw = deposit32(*src_rw, 0, 12, imm12); return true; } return false; @@ -362,33 +362,52 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, (ALL_GENERAL_REGS & ~((1 << TCG_REG_R0) | (1 << TCG_REG_R1))) #endif -static inline uint32_t rotl(uint32_t val, int n) -{ - return (val << n) | (val >> (32 - n)); -} - -/* ARM immediates for ALU instructions are made of an unsigned 8-bit - right-rotated by an even amount between 0 and 30. */ +/* + * ARM immediates for ALU instructions are made of an unsigned 8-bit + * right-rotated by an even amount between 0 and 30. + * + * Return < 0 if @imm cannot be encoded, else the entire imm12 field. + */ static int encode_imm(uint32_t imm) { - int shift; + uint32_t rot, imm8; - /* simple case, only lower bits */ - if ((imm & ~0xff) == 0) - return 0; - /* then try a simple even shift */ - shift = ctz32(imm) & ~1; - if (((imm >> shift) & ~0xff) == 0) - return 32 - shift; - /* now try harder with rotations */ - if ((rotl(imm, 2) & ~0xff) == 0) - return 2; - if ((rotl(imm, 4) & ~0xff) == 0) - return 4; - if ((rotl(imm, 6) & ~0xff) == 0) - return 6; - /* imm can't be encoded */ + /* Simple case, no rotation required. */ + if ((imm & ~0xff) == 0) { + return imm; + } + + /* Next, try a simple even shift. */ + rot = ctz32(imm) & ~1; + imm8 = imm >> rot; + rot = 32 - rot; + if ((imm8 & ~0xff) == 0) { + goto found; + } + + /* + * Finally, try harder with rotations. + * The ctz test above will have taken care of rotates >= 8. + */ + for (rot = 2; rot < 8; rot += 2) { + imm8 = rol32(imm, rot); + if ((imm8 & ~0xff) == 0) { + goto found; + } + } + /* Fail: imm cannot be encoded. */ return -1; + + found: + /* Note that rot is even, and we discard bit 0 by shifting by 7. */ + return rot << 7 | imm8; +} + +static int encode_imm_nofail(uint32_t imm) +{ + int ret = encode_imm(imm); + tcg_debug_assert(ret >= 0); + return ret; } static inline int check_fit_imm(uint32_t imm) @@ -775,20 +794,18 @@ static void tcg_out_movi_pool(TCGContext *s, int cond, int rd, uint32_t arg) static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) { - int rot, diff, opc, sh1, sh2; + int imm12, diff, opc, sh1, sh2; uint32_t tt0, tt1, tt2; /* Check a single MOV/MVN before anything else. */ - rot = encode_imm(arg); - if (rot >= 0) { - tcg_out_dat_imm(s, cond, ARITH_MOV, rd, 0, - rotl(arg, rot) | (rot << 7)); + imm12 = encode_imm(arg); + if (imm12 >= 0) { + tcg_out_dat_imm(s, cond, ARITH_MOV, rd, 0, imm12); return; } - rot = encode_imm(~arg); - if (rot >= 0) { - tcg_out_dat_imm(s, cond, ARITH_MVN, rd, 0, - rotl(~arg, rot) | (rot << 7)); + imm12 = encode_imm(~arg); + if (imm12 >= 0) { + tcg_out_dat_imm(s, cond, ARITH_MVN, rd, 0, imm12); return; } @@ -796,17 +813,15 @@ static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) or within the TB, which is immediately before the code block. */ diff = tcg_pcrel_diff(s, (void *)arg) - 8; if (diff >= 0) { - rot = encode_imm(diff); - if (rot >= 0) { - tcg_out_dat_imm(s, cond, ARITH_ADD, rd, TCG_REG_PC, - rotl(diff, rot) | (rot << 7)); + imm12 = encode_imm(diff); + if (imm12 >= 0) { + tcg_out_dat_imm(s, cond, ARITH_ADD, rd, TCG_REG_PC, imm12); return; } } else { - rot = encode_imm(-diff); - if (rot >= 0) { - tcg_out_dat_imm(s, cond, ARITH_SUB, rd, TCG_REG_PC, - rotl(-diff, rot) | (rot << 7)); + imm12 = encode_imm(-diff); + if (imm12 >= 0) { + tcg_out_dat_imm(s, cond, ARITH_SUB, rd, TCG_REG_PC, imm12); return; } } @@ -838,6 +853,8 @@ static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) sh2 = ctz32(tt1) & ~1; tt2 = tt1 & ~(0xff << sh2); if (tt2 == 0) { + int rot; + rot = ((32 - sh1) << 7) & 0xf00; tcg_out_dat_imm(s, cond, opc, rd, 0, ((tt0 >> sh1) & 0xff) | rot); rot = ((32 - sh2) << 7) & 0xf00; @@ -850,37 +867,35 @@ static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) tcg_out_movi_pool(s, cond, rd, arg); } +/* + * Emit either the reg,imm or reg,reg form of a data-processing insn. + * rhs must satisfy the "rI" constraint. + */ static inline void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst, TCGArg lhs, TCGArg rhs, int rhs_is_const) { - /* Emit either the reg,imm or reg,reg form of a data-processing insn. - * rhs must satisfy the "rI" constraint. - */ if (rhs_is_const) { - int rot = encode_imm(rhs); - tcg_debug_assert(rot >= 0); - tcg_out_dat_imm(s, cond, opc, dst, lhs, rotl(rhs, rot) | (rot << 7)); + tcg_out_dat_imm(s, cond, opc, dst, lhs, encode_imm_nofail(rhs)); } else { tcg_out_dat_reg(s, cond, opc, dst, lhs, rhs, SHIFT_IMM_LSL(0)); } } +/* + * Emit either the reg,imm or reg,reg form of a data-processing insn. + * rhs must satisfy the "rIK" constraint. + */ static void tcg_out_dat_rIK(TCGContext *s, int cond, int opc, int opinv, TCGReg dst, TCGReg lhs, TCGArg rhs, bool rhs_is_const) { - /* Emit either the reg,imm or reg,reg form of a data-processing insn. - * rhs must satisfy the "rIK" constraint. - */ if (rhs_is_const) { - int rot = encode_imm(rhs); - if (rot < 0) { - rhs = ~rhs; - rot = encode_imm(rhs); - tcg_debug_assert(rot >= 0); + int imm12 = encode_imm(rhs); + if (imm12 < 0) { + imm12 = encode_imm_nofail(~rhs); opc = opinv; } - tcg_out_dat_imm(s, cond, opc, dst, lhs, rotl(rhs, rot) | (rot << 7)); + tcg_out_dat_imm(s, cond, opc, dst, lhs, imm12); } else { tcg_out_dat_reg(s, cond, opc, dst, lhs, rhs, SHIFT_IMM_LSL(0)); } @@ -894,14 +909,12 @@ static void tcg_out_dat_rIN(TCGContext *s, int cond, int opc, int opneg, * rhs must satisfy the "rIN" constraint. */ if (rhs_is_const) { - int rot = encode_imm(rhs); - if (rot < 0) { - rhs = -rhs; - rot = encode_imm(rhs); - tcg_debug_assert(rot >= 0); + int imm12 = encode_imm(rhs); + if (imm12 < 0) { + imm12 = encode_imm_nofail(-rhs); opc = opneg; } - tcg_out_dat_imm(s, cond, opc, dst, lhs, rotl(rhs, rot) | (rot << 7)); + tcg_out_dat_imm(s, cond, opc, dst, lhs, imm12); } else { tcg_out_dat_reg(s, cond, opc, dst, lhs, rhs, SHIFT_IMM_LSL(0)); } From patchwork Wed Aug 18 21:29:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499013 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1056966jab; Wed, 18 Aug 2021 14:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhIWkHGCKtD1aVfmP0sgtoT4PDhAb7AGXoFYrN8CF0VFgRmvFvycFDUkO8nyZ9Mu79rp2E X-Received: by 2002:ab0:36a8:: with SMTP id v8mr8665746uat.113.1629322491636; Wed, 18 Aug 2021 14:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322491; cv=none; d=google.com; s=arc-20160816; b=gOvXLI+zVZVuxD8TMTTKK2dyhUZW5ieHW2HljA1EMmgj/nCbBlanmf/YRjZye3EHWD Lgvp+kDh0S7qjRq1rtSwEvn2RAtRa4hq3OE1OybqYTG8Z623lBLf1VOP7OMwZ2EzCmvb bxYi+vaZbRz9JhwHpMvPbIPLZMiQRglpgS37VVv0CV2P6QM/A7QNP8pJRUsXTinOMljB Uo+8pt1jyLyqmuDms6eb84WG/ttNgKBet1ry93FIpb5RAwyeZ/Uf9RzhgIrtHz2q900e FcS707wk8gmB72UTIoBXsrMBRxtxL/IvwrD2LalkEDkFBXapdX9WjAjowXO6HX6oDLPi CKPg== 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=NF/gBnSaaHV6NiCUTT8/7w/1j/EXyA7+Vpcz9nr4IuM=; b=raTS8/kSq6C0UEaQkn6Gv+IPwPxjWK50JoYEJoYy2lAjv0En8SEkWpEgtd955JSElb y4ud2idd3txqoTFRDI6TpiyLJpF+fD9RqO+/FaP6nzwFu+ZgWMgsmpIA/NVT43xX8UAz BHwb2nI7++8DnRdTOjIyhHgAY8PeTL/Amce28MfufZCysx0ekzwuVEgqp/suruWUFqyD 9806JvD+qb5HaOJyvyCijfO+8S7ZNnoBY3RuDcZtKSrT8DTnXS6TKNSJsh0WjJjdVtdO VMeJHusqQsn4fMCYaEylufp+PjK5/QPDIqpVZ2Sp3cj1Vl9wMz/jZWJZg/Ov8vLy8lWt BHCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HV3C5D8w; 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 g21si1067209vkd.5.2021.08.18.14.34.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:34: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=HV3C5D8w; 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]:50080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTD0-0003XX-PM for patch@linaro.org; Wed, 18 Aug 2021 17:34:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7o-000630-2p for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:28 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:40753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7l-0005ms-7q for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:27 -0400 Received: by mail-pf1-x430.google.com with SMTP id y190so3506788pfg.7 for ; Wed, 18 Aug 2021 14:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NF/gBnSaaHV6NiCUTT8/7w/1j/EXyA7+Vpcz9nr4IuM=; b=HV3C5D8wM+8+cZHZ1c/XPn9d6bceM+PVpUyqs9Muj/AJmmsLtMNqj70rUa+YA5wBaX MJYUgRxS0cVEwiAWKtwL9mb7eTSk4/aWca1y4ftJXUyfVvflcX832TmnilEVlQ/4DwKQ Zgz9n/8YNVNXjGM1ijL/zNvHRwgYKGzPwGUJBCHzdvygbvRF6z6fBHxe9xJOr9pT/w18 Gzhm28nERW+5upR0CrbAuP/7Xf8cmYdts8A+BDnkBKGlmSo/RIh9V8xjChJUH3Icq+Ba q2TjeFtR+PsCQzoNqFMYQaKZupM0gYk6SfKZLS0NF9EtyoJ8AYZ8GGGA0YF9sqcSV02m YTxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NF/gBnSaaHV6NiCUTT8/7w/1j/EXyA7+Vpcz9nr4IuM=; b=oZUsLAYvF/mpz3r1w5vNBK0JB7TQ05+8fM3AFOaVJh8kcq1XUGnXXsDeLxum4ATLPn zkpZZwLz/vQSbFCjoPcW2lMeA0FCKLwuibUpYdq8JBVF7U4qJ+5GHHdeIZh5s10IAA/4 hMNFhKd99GL+UI6P4moue0Y7DnPCc173jD8ljmAxcSKVepgGcoW5j+QR2Zo2gNdZvZ5J 49t9pj4kUWqaRJrBCNELuJHKyX2L8lhD8W78w2saJsfBRnZzDWn+WE17ui/ispjeSaPM LnLxyuo0/Rw+5tdn5Ot0jKjqj5etOtc5AzuGQJ34aMINCpWrc6RIZleY/mmLLErbfBLj arxA== X-Gm-Message-State: AOAM531Xp7MeHfmyDEEFO0QzdkfS6oiP5GJT3HYpAFZOV8mX/zAnCnLC WCi0txhegywOgGCNdZdUbhzXG4VR4Dkqyw== X-Received: by 2002:a63:1b60:: with SMTP id b32mr1244791pgm.422.1629322163813; Wed, 18 Aug 2021 14:29:23 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 09/14] tcg/arm: Drop inline markers Date: Wed, 18 Aug 2021 11:29:07 -1000 Message-Id: <20210818212912.396794-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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.23 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" Let the compiler decide about inlining. Remove tcg_out_nop as unused. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 234 +++++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 120 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 265370b2ee..327032f0df 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -410,7 +410,7 @@ static int encode_imm_nofail(uint32_t imm) return ret; } -static inline int check_fit_imm(uint32_t imm) +static bool check_fit_imm(uint32_t imm) { return encode_imm(imm) >= 0; } @@ -540,42 +540,37 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return 0; } -static inline void tcg_out_b_imm(TCGContext *s, int cond, int32_t offset) +static void tcg_out_b_imm(TCGContext *s, int cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0a000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static inline void tcg_out_bl_imm(TCGContext *s, int cond, int32_t offset) +static void tcg_out_bl_imm(TCGContext *s, int cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0b000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static inline void tcg_out_blx_reg(TCGContext *s, int cond, int rn) +static void tcg_out_blx_reg(TCGContext *s, int cond, int rn) { tcg_out32(s, (cond << 28) | 0x012fff30 | rn); } -static inline void tcg_out_blx_imm(TCGContext *s, int32_t offset) +static void tcg_out_blx_imm(TCGContext *s, int32_t offset) { tcg_out32(s, 0xfa000000 | ((offset & 2) << 23) | (((offset - 8) >> 2) & 0x00ffffff)); } -static inline void tcg_out_dat_reg(TCGContext *s, +static void tcg_out_dat_reg(TCGContext *s, int cond, int opc, int rd, int rn, int rm, int shift) { tcg_out32(s, (cond << 28) | (0 << 25) | opc | (rn << 16) | (rd << 12) | shift | rm); } -static inline void tcg_out_nop(TCGContext *s) -{ - tcg_out32(s, INSN_NOP); -} - -static inline void tcg_out_mov_reg(TCGContext *s, int cond, int rd, int rm) +static void tcg_out_mov_reg(TCGContext *s, int cond, int rd, int rm) { /* Simple reg-reg move, optimising out the 'do nothing' case */ if (rd != rm) { @@ -601,8 +596,8 @@ static void tcg_out_b_reg(TCGContext *s, int cond, TCGReg rn) } } -static inline void tcg_out_dat_imm(TCGContext *s, - int cond, int opc, int rd, int rn, int im) +static void tcg_out_dat_imm(TCGContext *s, int cond, int opc, + int rd, int rn, int im) { tcg_out32(s, (cond << 28) | (1 << 25) | opc | (rn << 16) | (rd << 12) | im); @@ -647,141 +642,141 @@ static void tcg_out_memop_12(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, (rn << 16) | (rt << 12) | imm12); } -static inline void tcg_out_ld32_12(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm12) +static void tcg_out_ld32_12(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_LDR_IMM, rt, rn, imm12, 1, 0); } -static inline void tcg_out_st32_12(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm12) +static void tcg_out_st32_12(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_STR_IMM, rt, rn, imm12, 1, 0); } -static inline void tcg_out_ld32_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld32_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDR_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_st32_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_st32_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STR_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_ldrd_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_ldrd_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRD_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_ldrd_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ldrd_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRD_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_ldrd_rwb(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void __attribute__((unused)) +tcg_out_ldrd_rwb(TCGContext *s, int cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRD_REG, rt, rn, rm, 1, 1, 1); } -static inline void tcg_out_strd_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_strd_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_STRD_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_strd_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_strd_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRD_REG, rt, rn, rm, 1, 1, 0); } /* Register pre-increment with base writeback. */ -static inline void tcg_out_ld32_rwb(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld32_rwb(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDR_REG, rt, rn, rm, 1, 1, 1); } -static inline void tcg_out_st32_rwb(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_st32_rwb(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STR_REG, rt, rn, rm, 1, 1, 1); } -static inline void tcg_out_ld16u_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_ld16u_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRH_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_st16_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_st16_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_STRH_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_ld16u_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld16u_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRH_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_st16_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_st16_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRH_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_ld16s_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_ld16s_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRSH_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_ld16s_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld16s_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRSH_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_ld8_12(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm12) +static void tcg_out_ld8_12(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_LDRB_IMM, rt, rn, imm12, 1, 0); } -static inline void tcg_out_st8_12(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm12) +static void tcg_out_st8_12(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_STRB_IMM, rt, rn, imm12, 1, 0); } -static inline void tcg_out_ld8_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld8_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRB_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_st8_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_st8_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRB_REG, rt, rn, rm, 1, 1, 0); } -static inline void tcg_out_ld8s_8(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, int imm8) +static void tcg_out_ld8s_8(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRSB_IMM, rt, rn, imm8, 1, 0); } -static inline void tcg_out_ld8s_r(TCGContext *s, int cond, TCGReg rt, - TCGReg rn, TCGReg rm) +static void tcg_out_ld8s_r(TCGContext *s, int cond, TCGReg rt, + TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRSB_REG, rt, rn, rm, 1, 1, 0); } @@ -871,8 +866,8 @@ static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rI" constraint. */ -static inline void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst, - TCGArg lhs, TCGArg rhs, int rhs_is_const) +static void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst, + TCGArg lhs, TCGArg rhs, int rhs_is_const) { if (rhs_is_const) { tcg_out_dat_imm(s, cond, opc, dst, lhs, encode_imm_nofail(rhs)); @@ -920,8 +915,8 @@ static void tcg_out_dat_rIN(TCGContext *s, int cond, int opc, int opneg, } } -static inline void tcg_out_mul32(TCGContext *s, int cond, TCGReg rd, - TCGReg rn, TCGReg rm) +static void tcg_out_mul32(TCGContext *s, int cond, TCGReg rd, + TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && d == n then UNPREDICTABLE; */ if (!use_armv6_instructions && rd == rn) { @@ -938,8 +933,8 @@ static inline void tcg_out_mul32(TCGContext *s, int cond, TCGReg rd, tcg_out32(s, (cond << 28) | 0x90 | (rd << 16) | (rm << 8) | rn); } -static inline void tcg_out_umull32(TCGContext *s, int cond, TCGReg rd0, - TCGReg rd1, TCGReg rn, TCGReg rm) +static void tcg_out_umull32(TCGContext *s, int cond, TCGReg rd0, + TCGReg rd1, TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && (dHi == n || dLo == n) then UNPREDICTABLE; */ if (!use_armv6_instructions && (rd0 == rn || rd1 == rn)) { @@ -957,8 +952,8 @@ static inline void tcg_out_umull32(TCGContext *s, int cond, TCGReg rd0, (rd1 << 16) | (rd0 << 12) | (rm << 8) | rn); } -static inline void tcg_out_smull32(TCGContext *s, int cond, TCGReg rd0, - TCGReg rd1, TCGReg rn, TCGReg rm) +static void tcg_out_smull32(TCGContext *s, int cond, TCGReg rd0, + TCGReg rd1, TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && (dHi == n || dLo == n) then UNPREDICTABLE; */ if (!use_armv6_instructions && (rd0 == rn || rd1 == rn)) { @@ -976,18 +971,17 @@ static inline void tcg_out_smull32(TCGContext *s, int cond, TCGReg rd0, (rd1 << 16) | (rd0 << 12) | (rm << 8) | rn); } -static inline void tcg_out_sdiv(TCGContext *s, int cond, int rd, int rn, int rm) +static void tcg_out_sdiv(TCGContext *s, int cond, int rd, int rn, int rm) { tcg_out32(s, 0x0710f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static inline void tcg_out_udiv(TCGContext *s, int cond, int rd, int rn, int rm) +static void tcg_out_udiv(TCGContext *s, int cond, int rd, int rn, int rm) { tcg_out32(s, 0x0730f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static inline void tcg_out_ext8s(TCGContext *s, int cond, - int rd, int rn) +static void tcg_out_ext8s(TCGContext *s, int cond, int rd, int rn) { if (use_armv6_instructions) { /* sxtb */ @@ -1000,14 +994,13 @@ static inline void tcg_out_ext8s(TCGContext *s, int cond, } } -static inline void tcg_out_ext8u(TCGContext *s, int cond, - int rd, int rn) +static void __attribute__((unused)) +tcg_out_ext8u(TCGContext *s, int cond, int rd, int rn) { tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff); } -static inline void tcg_out_ext16s(TCGContext *s, int cond, - int rd, int rn) +static void tcg_out_ext16s(TCGContext *s, int cond, int rd, int rn) { if (use_armv6_instructions) { /* sxth */ @@ -1020,8 +1013,7 @@ static inline void tcg_out_ext16s(TCGContext *s, int cond, } } -static inline void tcg_out_ext16u(TCGContext *s, int cond, - int rd, int rn) +static void tcg_out_ext16u(TCGContext *s, int cond, int rd, int rn) { if (use_armv6_instructions) { /* uxth */ @@ -1101,7 +1093,7 @@ static void tcg_out_bswap16(TCGContext *s, int cond, int rd, int rn, int flags) ? SHIFT_IMM_ASR(8) : SHIFT_IMM_LSR(8))); } -static inline void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) { if (use_armv6_instructions) { /* rev */ @@ -1118,8 +1110,8 @@ static inline void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) } } -static inline void tcg_out_deposit(TCGContext *s, int cond, TCGReg rd, - TCGArg a1, int ofs, int len, bool const_a1) +static void tcg_out_deposit(TCGContext *s, int cond, TCGReg rd, + TCGArg a1, int ofs, int len, bool const_a1) { if (const_a1) { /* bfi becomes bfc with rn == 15. */ @@ -1130,24 +1122,24 @@ static inline void tcg_out_deposit(TCGContext *s, int cond, TCGReg rd, | (ofs << 7) | ((ofs + len - 1) << 16)); } -static inline void tcg_out_extract(TCGContext *s, int cond, TCGReg rd, - TCGArg a1, int ofs, int len) +static void tcg_out_extract(TCGContext *s, int cond, TCGReg rd, + TCGArg a1, int ofs, int len) { /* ubfx */ tcg_out32(s, 0x07e00050 | (cond << 28) | (rd << 12) | a1 | (ofs << 7) | ((len - 1) << 16)); } -static inline void tcg_out_sextract(TCGContext *s, int cond, TCGReg rd, - TCGArg a1, int ofs, int len) +static void tcg_out_sextract(TCGContext *s, int cond, TCGReg rd, + TCGArg a1, int ofs, int len) { /* sbfx */ tcg_out32(s, 0x07a00050 | (cond << 28) | (rd << 12) | a1 | (ofs << 7) | ((len - 1) << 16)); } -static inline void tcg_out_ld32u(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_ld32u(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1156,8 +1148,8 @@ static inline void tcg_out_ld32u(TCGContext *s, int cond, tcg_out_ld32_12(s, cond, rd, rn, offset); } -static inline void tcg_out_st32(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_st32(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1166,8 +1158,8 @@ static inline void tcg_out_st32(TCGContext *s, int cond, tcg_out_st32_12(s, cond, rd, rn, offset); } -static inline void tcg_out_ld16u(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_ld16u(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1176,8 +1168,8 @@ static inline void tcg_out_ld16u(TCGContext *s, int cond, tcg_out_ld16u_8(s, cond, rd, rn, offset); } -static inline void tcg_out_ld16s(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_ld16s(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1186,8 +1178,8 @@ static inline void tcg_out_ld16s(TCGContext *s, int cond, tcg_out_ld16s_8(s, cond, rd, rn, offset); } -static inline void tcg_out_st16(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_st16(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1196,8 +1188,8 @@ static inline void tcg_out_st16(TCGContext *s, int cond, tcg_out_st16_8(s, cond, rd, rn, offset); } -static inline void tcg_out_ld8u(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_ld8u(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1206,8 +1198,8 @@ static inline void tcg_out_ld8u(TCGContext *s, int cond, tcg_out_ld8_12(s, cond, rd, rn, offset); } -static inline void tcg_out_ld8s(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_ld8s(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1216,8 +1208,8 @@ static inline void tcg_out_ld8s(TCGContext *s, int cond, tcg_out_ld8s_8(s, cond, rd, rn, offset); } -static inline void tcg_out_st8(TCGContext *s, int cond, - int rd, int rn, int32_t offset) +static void tcg_out_st8(TCGContext *s, int cond, + int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1288,7 +1280,7 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr) } } -static inline void tcg_out_goto_label(TCGContext *s, int cond, TCGLabel *l) +static void tcg_out_goto_label(TCGContext *s, int cond, TCGLabel *l) { if (l->has_value) { tcg_out_goto(s, cond, l->u.value_ptr); @@ -1298,7 +1290,7 @@ static inline void tcg_out_goto_label(TCGContext *s, int cond, TCGLabel *l) } } -static inline void tcg_out_mb(TCGContext *s, TCGArg a0) +static void tcg_out_mb(TCGContext *s, TCGArg a0) { if (use_armv7_instructions) { tcg_out32(s, INSN_DMB_ISH); @@ -1764,9 +1756,9 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) } #endif /* SOFTMMU */ -static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, - TCGReg datalo, TCGReg datahi, - TCGReg addrlo, TCGReg addend) +static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, + TCGReg datalo, TCGReg datahi, + TCGReg addrlo, TCGReg addend) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1808,9 +1800,9 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, } } -static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, - TCGReg datalo, TCGReg datahi, - TCGReg addrlo) +#ifndef CONFIG_SOFTMMU +static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg datalo, + TCGReg datahi, TCGReg addrlo) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1849,6 +1841,7 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, g_assert_not_reached(); } } +#endif static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) { @@ -1891,9 +1884,9 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) #endif } -static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, - TCGReg datalo, TCGReg datahi, - TCGReg addrlo, TCGReg addend) +static void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, + TCGReg datalo, TCGReg datahi, + TCGReg addrlo, TCGReg addend) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1924,9 +1917,9 @@ static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, } } -static inline void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, - TCGReg datalo, TCGReg datahi, - TCGReg addrlo) +#ifndef CONFIG_SOFTMMU +static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo, + TCGReg datahi, TCGReg addrlo) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1956,6 +1949,7 @@ static inline void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, g_assert_not_reached(); } } +#endif static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) { @@ -2000,9 +1994,9 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) static void tcg_out_epilogue(TCGContext *s); -static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, - const TCGArg args[TCG_MAX_OP_ARGS], - const int const_args[TCG_MAX_OP_ARGS]) +static void tcg_out_op(TCGContext *s, TCGOpcode opc, + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_ARGS]) { TCGArg a0, a1, a2, a3, a4, a5; int c; @@ -2591,8 +2585,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, } } -static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, - TCGReg base, intptr_t ofs) +static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, + TCGReg base, intptr_t ofs) { return false; } From patchwork Wed Aug 18 21:29:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499016 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059077jab; Wed, 18 Aug 2021 14:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMbmG6v9Ia29WtgUlbmvDJFR0FIqCxq/ulwj+AG+jGIJbRXPl6h/sXZs2sWEbp4QAopwok X-Received: by 2002:a25:3625:: with SMTP id d37mr15930307yba.140.1629322697256; Wed, 18 Aug 2021 14:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322697; cv=none; d=google.com; s=arc-20160816; b=WxSoOoiZ9yRoyzq+Co9VHcOQhur7Y/Fkd7g/37c/Y3fn34obYCgJVlZvmBcCoZDs5W CVD2soVLd9hGmDAgPizYVfEjtACgINW6wbuf9OtSUh7HKoj+nYFE4hDlv8eTsazC12wO gsQpTu8W0Njdx3URXHW7l9ekwgnKjbNCf6UJmltI5kyoEoARFJ4tT2ta1Knaus6r7jBt xqou+XmxFhrkheY7KniWUQ6cR+KAOBwh6WmVbnsODlv4zmDDWkQRgvO4DeVJ8mfLOwR6 OGcHy4NIvAYtvJIrZ0mkj6qtfrGOftQ8aV+C1XyGQzaOmvEUBLrZDI68OyFxELgxZZho 30UQ== 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=jV+G7p9ouJb31HAFw2iToImKMbvLL+XKO9L5VZWCgWg=; b=mkKa9MTNnuhCjN0b78aGx+/ITsrF2te3b94S3MK8cchhH59h7Pz1oUQ0HurBkYdwc2 v4xCZ2aW7pm8PBvBGLWWgKtfoOxhR3mWsjZOgZZYkkexoip7VdGhaGVbFWNBZLYCZ43d DQG6F6D/KEQ1VzYB8UT6jRZ+20uJHEgXlgf6MkQ0a9Z5QX/oCmN1akzCZVcGUP4fiBtW FMrUipiv9eUpL5JHZqdYK5lJnR5dJfy6UJTbVhR+ONN4lvGgzVvjZME/qlYt0JmjI2wT 2eLYDdLd6YMGAY8Y6T9iT85e0lh0xdo1AfpHsHpgsaRxprmgiZAqAH5KnZwX+sz0wtn6 InrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iiDF2/yi"; 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 p140si662858ybc.443.2021.08.18.14.38.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:38: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="iiDF2/yi"; 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]:58846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTGK-0001I5-Is for patch@linaro.org; Wed, 18 Aug 2021 17:38:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7o-000667-V0 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:28 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:41814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7m-0005np-8G for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:28 -0400 Received: by mail-pj1-x1033.google.com with SMTP id fa24-20020a17090af0d8b0290178bfa69d97so3396365pjb.0 for ; Wed, 18 Aug 2021 14:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jV+G7p9ouJb31HAFw2iToImKMbvLL+XKO9L5VZWCgWg=; b=iiDF2/yiowVdlnUSgE8kbP6E4aYYxcfpm8piOjtK51OdXrLwcDp0LWCOoBDrMlWDkW 2m2786ueqzxTx3rJLRd/hhFyUVk64kkH+AT+DC1I2H23ORpajnxuGPrNQvZVHj8XG61W ILlSS1b0acZXWDnuh+HfmIHI2+vHDza8H3JqeqXgxdW9zC9o+mSXpOiaxtA1sUBQYnlf 6xhssfpdc9a1PF7EA2ym6JeFVmRawZJb+15ZALpdTiJrAaYmibEwzZHsiuefXBxf9zpD +pg7FpN0TGBjOR3iqnLpfkLoMOnhooN3cx4Wi8ADttuukHDSgSsktXRukS8zZjqvwPod 33+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jV+G7p9ouJb31HAFw2iToImKMbvLL+XKO9L5VZWCgWg=; b=WkZ/fGD8XOtohf1SH0DFwjoVHJ1ElmdTgKEDaseUdMReVLz2+rLObnFa8mWq5r8tWl pPQGBbck5JlfM0XcKQQCu13jhEs9aPfET1vzDaxNip2Z1kh43thPJfupG+9z+X/xuQwN eeAnk0swLh7ij8D/LIO/CmuU4Dp84S4gixvqYTwMCiuL/ZdZajIg3sJ1AsfacrtJawRW +NNmWVF8dtnj6xMGmVuLmZ4NMLAnFKDA7WX14D/m7DzHX4by5kxLNlK7nLmaU4/z3cUS BcbXLNm4HhbuNnijkkez8uGJ24p8PXN69T3Ge3bGXJRhdzQ0w19DH+1kaYr8biSN1G2/ cEzg== X-Gm-Message-State: AOAM5320n9Dvk2bUOIb+ZmgasETKEcUkPLYct+jLOY1f5CjNpj7Y2ira liTsE/Vn3wnPeNRAP7LtznZ9twZ5yxB1Nw== X-Received: by 2002:a17:90a:7d02:: with SMTP id g2mr11238909pjl.168.1629322164789; Wed, 18 Aug 2021 14:29:24 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 10/14] tcg/arm: Give enum arm_cond_code_e a typedef and use it Date: Wed, 18 Aug 2021 11:29:08 -1000 Message-Id: <20210818212912.396794-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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.23 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" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 136 +++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 68 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 327032f0df..b20c313615 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -85,7 +85,7 @@ static const int tcg_target_call_oarg_regs[2] = { #define TCG_REG_TMP TCG_REG_R12 #define TCG_VEC_TMP TCG_REG_Q15 -enum arm_cond_code_e { +typedef enum { COND_EQ = 0x0, COND_NE = 0x1, COND_CS = 0x2, /* Unsigned greater or equal */ @@ -101,7 +101,7 @@ enum arm_cond_code_e { COND_GT = 0xc, COND_LE = 0xd, COND_AL = 0xe, -}; +} ARMCond; #define TO_CPSR (1 << 20) @@ -540,19 +540,19 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) return 0; } -static void tcg_out_b_imm(TCGContext *s, int cond, int32_t offset) +static void tcg_out_b_imm(TCGContext *s, ARMCond cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0a000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_bl_imm(TCGContext *s, int cond, int32_t offset) +static void tcg_out_bl_imm(TCGContext *s, ARMCond cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0b000000 | (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_blx_reg(TCGContext *s, int cond, int rn) +static void tcg_out_blx_reg(TCGContext *s, ARMCond cond, int rn) { tcg_out32(s, (cond << 28) | 0x012fff30 | rn); } @@ -563,14 +563,14 @@ static void tcg_out_blx_imm(TCGContext *s, int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_dat_reg(TCGContext *s, - int cond, int opc, int rd, int rn, int rm, int shift) +static void tcg_out_dat_reg(TCGContext *s, ARMCond cond, int opc, int rd, + int rn, int rm, int shift) { tcg_out32(s, (cond << 28) | (0 << 25) | opc | (rn << 16) | (rd << 12) | shift | rm); } -static void tcg_out_mov_reg(TCGContext *s, int cond, int rd, int rm) +static void tcg_out_mov_reg(TCGContext *s, ARMCond cond, int rd, int rm) { /* Simple reg-reg move, optimising out the 'do nothing' case */ if (rd != rm) { @@ -578,12 +578,12 @@ static void tcg_out_mov_reg(TCGContext *s, int cond, int rd, int rm) } } -static void tcg_out_bx_reg(TCGContext *s, int cond, TCGReg rn) +static void tcg_out_bx_reg(TCGContext *s, ARMCond cond, TCGReg rn) { tcg_out32(s, (cond << 28) | 0x012fff10 | rn); } -static void tcg_out_b_reg(TCGContext *s, int cond, TCGReg rn) +static void tcg_out_b_reg(TCGContext *s, ARMCond cond, TCGReg rn) { /* * Unless the C portion of QEMU is compiled as thumb, we don't need @@ -596,14 +596,14 @@ static void tcg_out_b_reg(TCGContext *s, int cond, TCGReg rn) } } -static void tcg_out_dat_imm(TCGContext *s, int cond, int opc, +static void tcg_out_dat_imm(TCGContext *s, ARMCond cond, int opc, int rd, int rn, int im) { tcg_out32(s, (cond << 28) | (1 << 25) | opc | (rn << 16) | (rd << 12) | im); } -static void tcg_out_ldstm(TCGContext *s, int cond, int opc, +static void tcg_out_ldstm(TCGContext *s, ARMCond cond, int opc, TCGReg rn, uint16_t mask) { tcg_out32(s, (cond << 28) | opc | (rn << 16) | mask); @@ -611,14 +611,14 @@ static void tcg_out_ldstm(TCGContext *s, int cond, int opc, /* Note that this routine is used for both LDR and LDRH formats, so we do not wish to include an immediate shift at this point. */ -static void tcg_out_memop_r(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, +static void tcg_out_memop_r(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rt, TCGReg rn, TCGReg rm, bool u, bool p, bool w) { tcg_out32(s, (cond << 28) | opc | (u << 23) | (p << 24) | (w << 21) | (rn << 16) | (rt << 12) | rm); } -static void tcg_out_memop_8(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, +static void tcg_out_memop_8(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rt, TCGReg rn, int imm8, bool p, bool w) { bool u = 1; @@ -630,7 +630,7 @@ static void tcg_out_memop_8(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, (rn << 16) | (rt << 12) | ((imm8 & 0xf0) << 4) | (imm8 & 0xf)); } -static void tcg_out_memop_12(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, +static void tcg_out_memop_12(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rt, TCGReg rn, int imm12, bool p, bool w) { bool u = 1; @@ -642,152 +642,152 @@ static void tcg_out_memop_12(TCGContext *s, int cond, ARMInsn opc, TCGReg rt, (rn << 16) | (rt << 12) | imm12); } -static void tcg_out_ld32_12(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld32_12(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_LDR_IMM, rt, rn, imm12, 1, 0); } -static void tcg_out_st32_12(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st32_12(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_STR_IMM, rt, rn, imm12, 1, 0); } -static void tcg_out_ld32_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld32_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDR_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_st32_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st32_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STR_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_ldrd_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ldrd_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRD_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_ldrd_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ldrd_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRD_REG, rt, rn, rm, 1, 1, 0); } static void __attribute__((unused)) -tcg_out_ldrd_rwb(TCGContext *s, int cond, TCGReg rt, TCGReg rn, TCGReg rm) +tcg_out_ldrd_rwb(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRD_REG, rt, rn, rm, 1, 1, 1); } -static void tcg_out_strd_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_strd_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_STRD_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_strd_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_strd_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRD_REG, rt, rn, rm, 1, 1, 0); } /* Register pre-increment with base writeback. */ -static void tcg_out_ld32_rwb(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld32_rwb(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDR_REG, rt, rn, rm, 1, 1, 1); } -static void tcg_out_st32_rwb(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st32_rwb(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STR_REG, rt, rn, rm, 1, 1, 1); } -static void tcg_out_ld16u_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld16u_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRH_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_st16_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st16_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_STRH_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_ld16u_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld16u_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRH_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_st16_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st16_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRH_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_ld16s_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld16s_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRSH_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_ld16s_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld16s_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRSH_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_ld8_12(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld8_12(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_LDRB_IMM, rt, rn, imm12, 1, 0); } -static void tcg_out_st8_12(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st8_12(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm12) { tcg_out_memop_12(s, cond, INSN_STRB_IMM, rt, rn, imm12, 1, 0); } -static void tcg_out_ld8_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld8_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRB_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_st8_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_st8_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_STRB_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_ld8s_8(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld8s_8(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, int imm8) { tcg_out_memop_8(s, cond, INSN_LDRSB_IMM, rt, rn, imm8, 1, 0); } -static void tcg_out_ld8s_r(TCGContext *s, int cond, TCGReg rt, +static void tcg_out_ld8s_r(TCGContext *s, ARMCond cond, TCGReg rt, TCGReg rn, TCGReg rm) { tcg_out_memop_r(s, cond, INSN_LDRSB_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_movi_pool(TCGContext *s, int cond, int rd, uint32_t arg) +static void tcg_out_movi_pool(TCGContext *s, ARMCond cond, int rd, uint32_t arg) { new_pool_label(s, arg, R_ARM_PC13, s->code_ptr, 0); tcg_out_ld32_12(s, cond, rd, TCG_REG_PC, 0); } -static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) +static void tcg_out_movi32(TCGContext *s, ARMCond cond, int rd, uint32_t arg) { int imm12, diff, opc, sh1, sh2; uint32_t tt0, tt1, tt2; @@ -866,7 +866,7 @@ static void tcg_out_movi32(TCGContext *s, int cond, int rd, uint32_t arg) * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rI" constraint. */ -static void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst, +static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, int opc, TCGArg dst, TCGArg lhs, TCGArg rhs, int rhs_is_const) { if (rhs_is_const) { @@ -880,7 +880,7 @@ static void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst, * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rIK" constraint. */ -static void tcg_out_dat_rIK(TCGContext *s, int cond, int opc, int opinv, +static void tcg_out_dat_rIK(TCGContext *s, ARMCond cond, int opc, int opinv, TCGReg dst, TCGReg lhs, TCGArg rhs, bool rhs_is_const) { @@ -896,7 +896,7 @@ static void tcg_out_dat_rIK(TCGContext *s, int cond, int opc, int opinv, } } -static void tcg_out_dat_rIN(TCGContext *s, int cond, int opc, int opneg, +static void tcg_out_dat_rIN(TCGContext *s, ARMCond cond, int opc, int opneg, TCGArg dst, TCGArg lhs, TCGArg rhs, bool rhs_is_const) { @@ -915,7 +915,7 @@ static void tcg_out_dat_rIN(TCGContext *s, int cond, int opc, int opneg, } } -static void tcg_out_mul32(TCGContext *s, int cond, TCGReg rd, +static void tcg_out_mul32(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && d == n then UNPREDICTABLE; */ @@ -933,7 +933,7 @@ static void tcg_out_mul32(TCGContext *s, int cond, TCGReg rd, tcg_out32(s, (cond << 28) | 0x90 | (rd << 16) | (rm << 8) | rn); } -static void tcg_out_umull32(TCGContext *s, int cond, TCGReg rd0, +static void tcg_out_umull32(TCGContext *s, ARMCond cond, TCGReg rd0, TCGReg rd1, TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && (dHi == n || dLo == n) then UNPREDICTABLE; */ @@ -952,7 +952,7 @@ static void tcg_out_umull32(TCGContext *s, int cond, TCGReg rd0, (rd1 << 16) | (rd0 << 12) | (rm << 8) | rn); } -static void tcg_out_smull32(TCGContext *s, int cond, TCGReg rd0, +static void tcg_out_smull32(TCGContext *s, ARMCond cond, TCGReg rd0, TCGReg rd1, TCGReg rn, TCGReg rm) { /* if ArchVersion() < 6 && (dHi == n || dLo == n) then UNPREDICTABLE; */ @@ -971,17 +971,17 @@ static void tcg_out_smull32(TCGContext *s, int cond, TCGReg rd0, (rd1 << 16) | (rd0 << 12) | (rm << 8) | rn); } -static void tcg_out_sdiv(TCGContext *s, int cond, int rd, int rn, int rm) +static void tcg_out_sdiv(TCGContext *s, ARMCond cond, int rd, int rn, int rm) { tcg_out32(s, 0x0710f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static void tcg_out_udiv(TCGContext *s, int cond, int rd, int rn, int rm) +static void tcg_out_udiv(TCGContext *s, ARMCond cond, int rd, int rn, int rm) { tcg_out32(s, 0x0730f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static void tcg_out_ext8s(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_ext8s(TCGContext *s, ARMCond cond, int rd, int rn) { if (use_armv6_instructions) { /* sxtb */ @@ -995,12 +995,12 @@ static void tcg_out_ext8s(TCGContext *s, int cond, int rd, int rn) } static void __attribute__((unused)) -tcg_out_ext8u(TCGContext *s, int cond, int rd, int rn) +tcg_out_ext8u(TCGContext *s, ARMCond cond, int rd, int rn) { tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff); } -static void tcg_out_ext16s(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_ext16s(TCGContext *s, ARMCond cond, int rd, int rn) { if (use_armv6_instructions) { /* sxth */ @@ -1013,7 +1013,7 @@ static void tcg_out_ext16s(TCGContext *s, int cond, int rd, int rn) } } -static void tcg_out_ext16u(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_ext16u(TCGContext *s, ARMCond cond, int rd, int rn) { if (use_armv6_instructions) { /* uxth */ @@ -1026,7 +1026,7 @@ static void tcg_out_ext16u(TCGContext *s, int cond, int rd, int rn) } } -static void tcg_out_bswap16(TCGContext *s, int cond, int rd, int rn, int flags) +static void tcg_out_bswap16(TCGContext *s, ARMCond cond, int rd, int rn, int flags) { if (use_armv6_instructions) { if (flags & TCG_BSWAP_OS) { @@ -1093,7 +1093,7 @@ static void tcg_out_bswap16(TCGContext *s, int cond, int rd, int rn, int flags) ? SHIFT_IMM_ASR(8) : SHIFT_IMM_LSR(8))); } -static void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) +static void tcg_out_bswap32(TCGContext *s, ARMCond cond, int rd, int rn) { if (use_armv6_instructions) { /* rev */ @@ -1110,7 +1110,7 @@ static void tcg_out_bswap32(TCGContext *s, int cond, int rd, int rn) } } -static void tcg_out_deposit(TCGContext *s, int cond, TCGReg rd, +static void tcg_out_deposit(TCGContext *s, ARMCond cond, TCGReg rd, TCGArg a1, int ofs, int len, bool const_a1) { if (const_a1) { @@ -1122,7 +1122,7 @@ static void tcg_out_deposit(TCGContext *s, int cond, TCGReg rd, | (ofs << 7) | ((ofs + len - 1) << 16)); } -static void tcg_out_extract(TCGContext *s, int cond, TCGReg rd, +static void tcg_out_extract(TCGContext *s, ARMCond cond, TCGReg rd, TCGArg a1, int ofs, int len) { /* ubfx */ @@ -1130,7 +1130,7 @@ static void tcg_out_extract(TCGContext *s, int cond, TCGReg rd, | (ofs << 7) | ((len - 1) << 16)); } -static void tcg_out_sextract(TCGContext *s, int cond, TCGReg rd, +static void tcg_out_sextract(TCGContext *s, ARMCond cond, TCGReg rd, TCGArg a1, int ofs, int len) { /* sbfx */ @@ -1138,7 +1138,7 @@ static void tcg_out_sextract(TCGContext *s, int cond, TCGReg rd, | (ofs << 7) | ((len - 1) << 16)); } -static void tcg_out_ld32u(TCGContext *s, int cond, +static void tcg_out_ld32u(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { @@ -1148,7 +1148,7 @@ static void tcg_out_ld32u(TCGContext *s, int cond, tcg_out_ld32_12(s, cond, rd, rn, offset); } -static void tcg_out_st32(TCGContext *s, int cond, +static void tcg_out_st32(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { @@ -1158,7 +1158,7 @@ static void tcg_out_st32(TCGContext *s, int cond, tcg_out_st32_12(s, cond, rd, rn, offset); } -static void tcg_out_ld16u(TCGContext *s, int cond, +static void tcg_out_ld16u(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { @@ -1168,7 +1168,7 @@ static void tcg_out_ld16u(TCGContext *s, int cond, tcg_out_ld16u_8(s, cond, rd, rn, offset); } -static void tcg_out_ld16s(TCGContext *s, int cond, +static void tcg_out_ld16s(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { @@ -1178,7 +1178,7 @@ static void tcg_out_ld16s(TCGContext *s, int cond, tcg_out_ld16s_8(s, cond, rd, rn, offset); } -static void tcg_out_st16(TCGContext *s, int cond, +static void tcg_out_st16(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { @@ -1188,7 +1188,7 @@ static void tcg_out_st16(TCGContext *s, int cond, tcg_out_st16_8(s, cond, rd, rn, offset); } -static void tcg_out_ld8u(TCGContext *s, int cond, +static void tcg_out_ld8u(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { @@ -1198,7 +1198,7 @@ static void tcg_out_ld8u(TCGContext *s, int cond, tcg_out_ld8_12(s, cond, rd, rn, offset); } -static void tcg_out_ld8s(TCGContext *s, int cond, +static void tcg_out_ld8s(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { @@ -1208,7 +1208,7 @@ static void tcg_out_ld8s(TCGContext *s, int cond, tcg_out_ld8s_8(s, cond, rd, rn, offset); } -static void tcg_out_st8(TCGContext *s, int cond, +static void tcg_out_st8(TCGContext *s, ARMCond cond, int rd, int rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { @@ -1223,7 +1223,7 @@ static void tcg_out_st8(TCGContext *s, int cond, * with the code buffer limited to 16MB we wouldn't need the long case. * But we also use it for the tail-call to the qemu_ld/st helpers, which does. */ -static void tcg_out_goto(TCGContext *s, int cond, const tcg_insn_unit *addr) +static void tcg_out_goto(TCGContext *s, ARMCond cond, const tcg_insn_unit *addr) { intptr_t addri = (intptr_t)addr; ptrdiff_t disp = tcg_pcrel_diff(s, addr); @@ -1280,7 +1280,7 @@ static void tcg_out_call(TCGContext *s, const tcg_insn_unit *addr) } } -static void tcg_out_goto_label(TCGContext *s, int cond, TCGLabel *l) +static void tcg_out_goto_label(TCGContext *s, ARMCond cond, TCGLabel *l) { if (l->has_value) { tcg_out_goto(s, cond, l->u.value_ptr); @@ -1884,7 +1884,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) #endif } -static void tcg_out_qemu_st_index(TCGContext *s, int cond, MemOp opc, +static void tcg_out_qemu_st_index(TCGContext *s, ARMCond cond, MemOp opc, TCGReg datalo, TCGReg datahi, TCGReg addrlo, TCGReg addend) { From patchwork Wed Aug 18 21:29:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499018 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060021jab; Wed, 18 Aug 2021 14:39:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4OKYgH9Re9GuLF4aqvr0wmzveIRvKMVKZ/jXByOAsnua6LKpyP6DZjP19qGABB4NN17wJ X-Received: by 2002:a25:e0c2:: with SMTP id x185mr14288320ybg.69.1629322794163; Wed, 18 Aug 2021 14:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322794; cv=none; d=google.com; s=arc-20160816; b=ZkZsubmL1klwIO8h7GqhjUEPd/Oae8LmfenOScKOC/UZQXq05aHlN5elJGxcA+rWqW iuNt36aPJmHcIP2AldZA2a/p1rDo5V8lAn3L7UtyF99KiXF1Gsh7KaPf97/GhT1PsJzq 8mp7Fo17y/9vov7pYV5JO5Cx7iSMxGbtjVDQDblfqaVKMSe2KjusnqKE3TobuTZnf28i 1JGU4HuUfWedYrkOS9+V8Lx686HBQxbtIOCgRT6J5+FGm7GLuC+MbWuFh+snYIpehoI+ xXMrD+kKyGlE/srhcYRs1m4EPct08vCOMF7MdKiF/ZSJMw6sdmb9uZ9KRsPEoZw65ML5 qniQ== 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=4ML6y7H6wqkUViLdFf24+VFsSyj9FBO2oO9/0ZfWQE0=; b=W+Vk4SaPYeH5cLHjWszLnrp0fdUQ2qDd88+k70YE9NEQ5IvqciYRJNfnn3oxQQp95Y B09xUdCohZJm4Ltg2rkJKb/Vqu6tRUiMKV2m2Bgm5kWIwXEeWpdMhzH7WSoX6vr5fAcl W9yRiiAjSsFIPbwghdx6TTFM+VLGz0q3COrTFLtWcNszNHo3x5taTULuAAr+MVKYMWXq OAsfPhqWl12oTMRjvpKB4gxz4+0mcymWonxbBAh1MraYWHSIKBuZpoQFPVL1s8K9289Q cmT4yeMswJxsdbCnVQuHmAOpocQcGmxDJrjfEKXIfJNaHxJOpbCcTL0my4lqnTEjSe9X oU9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ac2g6rsx; 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 z4si833277yba.72.2021.08.18.14.39.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:39: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=ac2g6rsx; 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]:38062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTHt-0006D0-Jm for patch@linaro.org; Wed, 18 Aug 2021 17:39:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7q-0006DT-QX for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:30 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:45775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7n-0005oF-1v for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:30 -0400 Received: by mail-pj1-x1036.google.com with SMTP id m24-20020a17090a7f98b0290178b1a81700so3300492pjl.4 for ; Wed, 18 Aug 2021 14:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4ML6y7H6wqkUViLdFf24+VFsSyj9FBO2oO9/0ZfWQE0=; b=ac2g6rsxNklpad1s9f7B8Zi8bght+mPkQWYW7m3C4wyfEto7kEVjRTUqWQm0PzYirA SXow364WxHig4aJV0wiLHsy/J9nN9KuFPgFqUxBf4PCG2Zn/0ebnYOi3ioydEkOMD3lm NyBhOwTlZtPHHsIOCcsvQBDQlq+mFFc7LgSnuOSWJ/+JXx/aOEAwlYpJjNc2zqXdlfy6 Er4tA/1+nY7bhOO0+BeJQrz7AG+tAj7+LpVxiyQyr0rJ/I/Sue4e3gqXij8VRFuE30Uu 5T9ugAbNvZIomPtCTsLSyF3xTFZ3RI29Sle5a8mMbTOw0ORzjgNw7G0raJo6gn9UsOgT 3b+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ML6y7H6wqkUViLdFf24+VFsSyj9FBO2oO9/0ZfWQE0=; b=RQuygiU/y7yG//rWLlJVBueFCQv6RnQhTRYPVL1Zgqy0+t1iixio7sUZeaijEvulXI tFFDT+0ktAPx1UubPaudGFP+jPmXsKcS2/DfDd/zBIqmzAzfEVcpi5cMO9WWn3lOMWJa bdHWV7ZOiJPS/MXGUcqybm9K4O5MN0c6e3cWEj+RYQoriQqHJHIsZBRkqPYi67KAvv8N X87mit8dCd8Bf65RGuUKUafcHaoG0Wn7UBLmE4nxRj120AWsuJA+xETPvWbp2hdhEWqb tT22+Mrd6ciP0xV8uvu8SMoGxMjTPXO/M5QjgW1t595Y4WuljtdVrXt3s+u98zJ3ycld tRvg== X-Gm-Message-State: AOAM533mp5/fP8kbIr9US3JIgxhjVHyWFoYIGdotj3z3ohjs6g8FsQzK mn3ZQ8+KraGwhdQjrzF3JgWjo3fhndJ+4w== X-Received: by 2002:a17:90a:6684:: with SMTP id m4mr11493738pjj.226.1629322165743; Wed, 18 Aug 2021 14:29:25 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/14] tcg/arm: More use of the ARMInsn enum Date: Wed, 18 Aug 2021 11:29:09 -1000 Message-Id: <20210818212912.396794-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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.23 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" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index b20c313615..2f55b94ada 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -563,7 +563,7 @@ static void tcg_out_blx_imm(TCGContext *s, int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_dat_reg(TCGContext *s, ARMCond cond, int opc, int rd, +static void tcg_out_dat_reg(TCGContext *s, ARMCond cond, ARMInsn opc, int rd, int rn, int rm, int shift) { tcg_out32(s, (cond << 28) | (0 << 25) | opc | @@ -596,14 +596,14 @@ static void tcg_out_b_reg(TCGContext *s, ARMCond cond, TCGReg rn) } } -static void tcg_out_dat_imm(TCGContext *s, ARMCond cond, int opc, +static void tcg_out_dat_imm(TCGContext *s, ARMCond cond, ARMInsn opc, int rd, int rn, int im) { tcg_out32(s, (cond << 28) | (1 << 25) | opc | (rn << 16) | (rd << 12) | im); } -static void tcg_out_ldstm(TCGContext *s, ARMCond cond, int opc, +static void tcg_out_ldstm(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rn, uint16_t mask) { tcg_out32(s, (cond << 28) | opc | (rn << 16) | mask); @@ -630,8 +630,8 @@ static void tcg_out_memop_8(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rt, (rn << 16) | (rt << 12) | ((imm8 & 0xf0) << 4) | (imm8 & 0xf)); } -static void tcg_out_memop_12(TCGContext *s, ARMCond cond, ARMInsn opc, TCGReg rt, - TCGReg rn, int imm12, bool p, bool w) +static void tcg_out_memop_12(TCGContext *s, ARMCond cond, ARMInsn opc, + TCGReg rt, TCGReg rn, int imm12, bool p, bool w) { bool u = 1; if (imm12 < 0) { @@ -866,7 +866,7 @@ static void tcg_out_movi32(TCGContext *s, ARMCond cond, int rd, uint32_t arg) * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rI" constraint. */ -static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, int opc, TCGArg dst, +static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, ARMInsn opc, TCGArg dst, TCGArg lhs, TCGArg rhs, int rhs_is_const) { if (rhs_is_const) { @@ -880,8 +880,8 @@ static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, int opc, TCGArg dst, * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rIK" constraint. */ -static void tcg_out_dat_rIK(TCGContext *s, ARMCond cond, int opc, int opinv, - TCGReg dst, TCGReg lhs, TCGArg rhs, +static void tcg_out_dat_rIK(TCGContext *s, ARMCond cond, ARMInsn opc, + ARMInsn opinv, TCGReg dst, TCGReg lhs, TCGArg rhs, bool rhs_is_const) { if (rhs_is_const) { @@ -896,8 +896,8 @@ static void tcg_out_dat_rIK(TCGContext *s, ARMCond cond, int opc, int opinv, } } -static void tcg_out_dat_rIN(TCGContext *s, ARMCond cond, int opc, int opneg, - TCGArg dst, TCGArg lhs, TCGArg rhs, +static void tcg_out_dat_rIN(TCGContext *s, ARMCond cond, ARMInsn opc, + ARMInsn opneg, TCGArg dst, TCGArg lhs, TCGArg rhs, bool rhs_is_const) { /* Emit either the reg,imm or reg,reg form of a data-processing insn. From patchwork Wed Aug 18 21:29:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499021 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1062412jab; Wed, 18 Aug 2021 14:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIB9pukombpbbDooHBX8XoMbkxYpCKK6P998PSrreKqc/gH8R8tBQhgdsbS8WeFrgCCf/0 X-Received: by 2002:ac8:7d8b:: with SMTP id c11mr9482960qtd.120.1629323033148; Wed, 18 Aug 2021 14:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629323033; cv=none; d=google.com; s=arc-20160816; b=pIC2JmIZb0Dt1pLBZfhXdnOQBiE2DH3+Iw6usg2R6Z5PvRAa9ysenRpvxcIAIE/d87 vsHXeGFSxbCp6UdW0UM+ehqEfVmVrWs/aDGevpbPQfCBBDS9lH12A36YkXE6hzEAgB8c wUWGNBehbPmjqQj3lb097gm03W4FFMH3UzGtBcR3sc1AHXMZXNwnAY6VIBy/kvWSc/jf K4rpCIOnGPGuDAE9uN+PC1ZgvC4dRQGf2OmbChiV3L72fQx6u+eQEPJymqCTp1pyWNB1 W3gzgdt0crSPw55F0Wf0MK9/yALQN8NGppcejB7P6nqtsFYdo3ZUASR2QRB21GD6ct+4 HNCA== 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=lPzInzzVO/z+oKSuWjc2o6V9Y5FWRuoifTPh6+wBc3g=; b=djr4+kPY3JorC5y1IQWnXuOb9JMoPR0R/KaCuQ6/KP6/APCiHY11QEXWbbed8dzVhA QTjGzpOSYCbMUNwaDl1BxtRsnzzF3qPOXDjjvGsH8oqyQ1mOXkRLJeIFWryYWpI9Z0Ub sFmbycnFT+HPZsjvJtJ/cFFnMoe0k9igQ+KjjwvxP9X8B1e28vHzU/07wfNvvXL5Ik/X kUcHvC9ZtzJLhOctFCbNpL6vdA2lvIW6armNmK1OMBwNPd/qhigS9/0TGbKB9l9ZMNVS MEEzQ4DYjFtnMG8Aw9JgHRAoxc8Bf4ZWpslZXZ7QHGIpk9N9QcSfP1c6Rq37LyANz8yj TcIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uie7nLFF; 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 jo3si795023qvb.209.2021.08.18.14.43.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:43:53 -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=uie7nLFF; 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]:46502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTLk-0003ZF-Fv for patch@linaro.org; Wed, 18 Aug 2021 17:43:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7r-0006Gs-LB for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:31 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:34306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7o-0005od-3i for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:31 -0400 Received: by mail-pg1-x534.google.com with SMTP id x4so3709116pgh.1 for ; Wed, 18 Aug 2021 14:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=lPzInzzVO/z+oKSuWjc2o6V9Y5FWRuoifTPh6+wBc3g=; b=uie7nLFF8q9mum9Q/8HR+29AiBZw3HuUBRKO2IfLHCgY4gEa+MD0ecfxOFiyX7wdy4 3sZNoilEnzVRoS2WIW0N7QlTmFmEb3cur82EiHlDwR3vl6NffAFcPewpigD6sl/4ghYJ SXAlWRy9XhefFgdfUyNMhRMSfDmB/26fDCyan09cN6YPvUlsImTS3LaN6oyytRQK2IeN SjTatlRPalCC2Kx1nAWbaVDv10YjI6LxvS1RgyrPW3WDTw+rGuAmkHtEXFAQ+oGX8Ziq 8X/7F8swMmIlA7M7tD9MQTC92+8D0IZjlswG7WzesDTP4fhlzjmSA2xt/3VTJEbtA5US dpAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lPzInzzVO/z+oKSuWjc2o6V9Y5FWRuoifTPh6+wBc3g=; b=Q8joX/5USLPh3EbeSgbNo04mtLKw3Wh9ffkGVXiuvmk0xwKreTjT+LJXIuiyZhDMOz uhvGox6RQQxG8Xk3lDNXzNXNEN0czmcVAclhXDzbXNqWbj+nO88yLcRCMqwKc8ung8zS FC3ARdSH2YUCcLSo95jbXL02IYCCh70n+ldSfU5pqcVbjZClKofltsCMA9bzrN3E7L/Q NrgQm9p/ejJNVq/KBhGI5ISVdTNnnTqe3iwUzhrFjAUqPB2SAOTyLK8tOrEVfra4eSgM h3UiCFjX3bu+6JpfOl+sfXrOuhJMLKNnZ2XZdSU8drlArqIuuXOuC5tdcksXx7DIVJ7v fD0g== X-Gm-Message-State: AOAM531c8LHXo561BIERDnUqaFYg0wPbIpJUDyJALrRKvwsRNM7/h8W4 G4HThIVDOUpajGzJIp+Um/1zy20mlGECEw== X-Received: by 2002:a63:1056:: with SMTP id 22mr10766490pgq.178.1629322166769; Wed, 18 Aug 2021 14:29:26 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 12/14] tcg/arm: More use of the TCGReg enum Date: Wed, 18 Aug 2021 11:29:10 -1000 Message-Id: <20210818212912.396794-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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.23 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" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 65 +++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 30 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 2f55b94ada..35bd4c68d6 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -552,7 +552,7 @@ static void tcg_out_bl_imm(TCGContext *s, ARMCond cond, int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_blx_reg(TCGContext *s, ARMCond cond, int rn) +static void tcg_out_blx_reg(TCGContext *s, ARMCond cond, TCGReg rn) { tcg_out32(s, (cond << 28) | 0x012fff30 | rn); } @@ -563,14 +563,14 @@ static void tcg_out_blx_imm(TCGContext *s, int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } -static void tcg_out_dat_reg(TCGContext *s, ARMCond cond, ARMInsn opc, int rd, - int rn, int rm, int shift) +static void tcg_out_dat_reg(TCGContext *s, ARMCond cond, ARMInsn opc, + TCGReg rd, TCGReg rn, TCGReg rm, int shift) { tcg_out32(s, (cond << 28) | (0 << 25) | opc | (rn << 16) | (rd << 12) | shift | rm); } -static void tcg_out_mov_reg(TCGContext *s, ARMCond cond, int rd, int rm) +static void tcg_out_mov_reg(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rm) { /* Simple reg-reg move, optimising out the 'do nothing' case */ if (rd != rm) { @@ -597,7 +597,7 @@ static void tcg_out_b_reg(TCGContext *s, ARMCond cond, TCGReg rn) } static void tcg_out_dat_imm(TCGContext *s, ARMCond cond, ARMInsn opc, - int rd, int rn, int im) + TCGReg rd, TCGReg rn, int im) { tcg_out32(s, (cond << 28) | (1 << 25) | opc | (rn << 16) | (rd << 12) | im); @@ -781,13 +781,15 @@ static void tcg_out_ld8s_r(TCGContext *s, ARMCond cond, TCGReg rt, tcg_out_memop_r(s, cond, INSN_LDRSB_REG, rt, rn, rm, 1, 1, 0); } -static void tcg_out_movi_pool(TCGContext *s, ARMCond cond, int rd, uint32_t arg) +static void tcg_out_movi_pool(TCGContext *s, ARMCond cond, + TCGReg rd, uint32_t arg) { new_pool_label(s, arg, R_ARM_PC13, s->code_ptr, 0); tcg_out_ld32_12(s, cond, rd, TCG_REG_PC, 0); } -static void tcg_out_movi32(TCGContext *s, ARMCond cond, int rd, uint32_t arg) +static void tcg_out_movi32(TCGContext *s, ARMCond cond, + TCGReg rd, uint32_t arg) { int imm12, diff, opc, sh1, sh2; uint32_t tt0, tt1, tt2; @@ -866,8 +868,8 @@ static void tcg_out_movi32(TCGContext *s, ARMCond cond, int rd, uint32_t arg) * Emit either the reg,imm or reg,reg form of a data-processing insn. * rhs must satisfy the "rI" constraint. */ -static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, ARMInsn opc, TCGArg dst, - TCGArg lhs, TCGArg rhs, int rhs_is_const) +static void tcg_out_dat_rI(TCGContext *s, ARMCond cond, ARMInsn opc, + TCGReg dst, TCGReg lhs, TCGArg rhs, int rhs_is_const) { if (rhs_is_const) { tcg_out_dat_imm(s, cond, opc, dst, lhs, encode_imm_nofail(rhs)); @@ -897,7 +899,7 @@ static void tcg_out_dat_rIK(TCGContext *s, ARMCond cond, ARMInsn opc, } static void tcg_out_dat_rIN(TCGContext *s, ARMCond cond, ARMInsn opc, - ARMInsn opneg, TCGArg dst, TCGArg lhs, TCGArg rhs, + ARMInsn opneg, TCGReg dst, TCGReg lhs, TCGArg rhs, bool rhs_is_const) { /* Emit either the reg,imm or reg,reg form of a data-processing insn. @@ -971,17 +973,19 @@ static void tcg_out_smull32(TCGContext *s, ARMCond cond, TCGReg rd0, (rd1 << 16) | (rd0 << 12) | (rm << 8) | rn); } -static void tcg_out_sdiv(TCGContext *s, ARMCond cond, int rd, int rn, int rm) +static void tcg_out_sdiv(TCGContext *s, ARMCond cond, + TCGReg rd, TCGReg rn, TCGReg rm) { tcg_out32(s, 0x0710f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static void tcg_out_udiv(TCGContext *s, ARMCond cond, int rd, int rn, int rm) +static void tcg_out_udiv(TCGContext *s, ARMCond cond, + TCGReg rd, TCGReg rn, TCGReg rm) { tcg_out32(s, 0x0730f010 | (cond << 28) | (rd << 16) | rn | (rm << 8)); } -static void tcg_out_ext8s(TCGContext *s, ARMCond cond, int rd, int rn) +static void tcg_out_ext8s(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn) { if (use_armv6_instructions) { /* sxtb */ @@ -995,12 +999,12 @@ static void tcg_out_ext8s(TCGContext *s, ARMCond cond, int rd, int rn) } static void __attribute__((unused)) -tcg_out_ext8u(TCGContext *s, ARMCond cond, int rd, int rn) +tcg_out_ext8u(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn) { tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff); } -static void tcg_out_ext16s(TCGContext *s, ARMCond cond, int rd, int rn) +static void tcg_out_ext16s(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn) { if (use_armv6_instructions) { /* sxth */ @@ -1013,7 +1017,7 @@ static void tcg_out_ext16s(TCGContext *s, ARMCond cond, int rd, int rn) } } -static void tcg_out_ext16u(TCGContext *s, ARMCond cond, int rd, int rn) +static void tcg_out_ext16u(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn) { if (use_armv6_instructions) { /* uxth */ @@ -1026,7 +1030,8 @@ static void tcg_out_ext16u(TCGContext *s, ARMCond cond, int rd, int rn) } } -static void tcg_out_bswap16(TCGContext *s, ARMCond cond, int rd, int rn, int flags) +static void tcg_out_bswap16(TCGContext *s, ARMCond cond, + TCGReg rd, TCGReg rn, int flags) { if (use_armv6_instructions) { if (flags & TCG_BSWAP_OS) { @@ -1093,7 +1098,7 @@ static void tcg_out_bswap16(TCGContext *s, ARMCond cond, int rd, int rn, int fla ? SHIFT_IMM_ASR(8) : SHIFT_IMM_LSR(8))); } -static void tcg_out_bswap32(TCGContext *s, ARMCond cond, int rd, int rn) +static void tcg_out_bswap32(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn) { if (use_armv6_instructions) { /* rev */ @@ -1123,23 +1128,23 @@ static void tcg_out_deposit(TCGContext *s, ARMCond cond, TCGReg rd, } static void tcg_out_extract(TCGContext *s, ARMCond cond, TCGReg rd, - TCGArg a1, int ofs, int len) + TCGReg rn, int ofs, int len) { /* ubfx */ - tcg_out32(s, 0x07e00050 | (cond << 28) | (rd << 12) | a1 + tcg_out32(s, 0x07e00050 | (cond << 28) | (rd << 12) | rn | (ofs << 7) | ((len - 1) << 16)); } static void tcg_out_sextract(TCGContext *s, ARMCond cond, TCGReg rd, - TCGArg a1, int ofs, int len) + TCGReg rn, int ofs, int len) { /* sbfx */ - tcg_out32(s, 0x07a00050 | (cond << 28) | (rd << 12) | a1 + tcg_out32(s, 0x07a00050 | (cond << 28) | (rd << 12) | rn | (ofs << 7) | ((len - 1) << 16)); } static void tcg_out_ld32u(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1149,7 +1154,7 @@ static void tcg_out_ld32u(TCGContext *s, ARMCond cond, } static void tcg_out_st32(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1159,7 +1164,7 @@ static void tcg_out_st32(TCGContext *s, ARMCond cond, } static void tcg_out_ld16u(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1169,7 +1174,7 @@ static void tcg_out_ld16u(TCGContext *s, ARMCond cond, } static void tcg_out_ld16s(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1179,7 +1184,7 @@ static void tcg_out_ld16s(TCGContext *s, ARMCond cond, } static void tcg_out_st16(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1189,7 +1194,7 @@ static void tcg_out_st16(TCGContext *s, ARMCond cond, } static void tcg_out_ld8u(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1199,7 +1204,7 @@ static void tcg_out_ld8u(TCGContext *s, ARMCond cond, } static void tcg_out_ld8s(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xff || offset < -0xff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); @@ -1209,7 +1214,7 @@ static void tcg_out_ld8s(TCGContext *s, ARMCond cond, } static void tcg_out_st8(TCGContext *s, ARMCond cond, - int rd, int rn, int32_t offset) + TCGReg rd, TCGReg rn, int32_t offset) { if (offset > 0xfff || offset < -0xfff) { tcg_out_movi32(s, cond, TCG_REG_TMP, offset); From patchwork Wed Aug 18 21:29:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499010 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1055086jab; Wed, 18 Aug 2021 14:32:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcyiatra33QJP1Id5t+5fJIOBOhdPmgSzvdFfv7DKLXnPRSmz+ta1gPigjv8M3UtcJVhFQ X-Received: by 2002:ab0:7391:: with SMTP id l17mr8591456uap.102.1629322332195; Wed, 18 Aug 2021 14:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322332; cv=none; d=google.com; s=arc-20160816; b=hw8HGf3ZcgL7Ln4uDiBLTjFfF3qzg9V0VUXuTuMxpDZkStCm2NqezCwXtxdZlUM8z4 Kdxq4wkkUUIwmpdhmVxtdSrOoSJNxDt46VZQhBkh3ANrLEcQn9YmSmkcc1q3NpjN02cF Az6XLV8JZV6Ye//bZqx0GzfalDjV2dUn8w+r3Fs9oILQNVM1hx8xqKkaLa0+Q1GyC+p1 oGVtTytvaRo4ErW+bnQfxCjl3DhwEcJWyADhqQJoIetmzGc4rkcFAzhKFDh2E7tZvhiE sQkIxZFJtjNO+12UPvIMzJ2cGs2zQ/0kv6GteKrfEwEFhrx6yLcv5TChXYyctQsV0mUs InrQ== 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=s5r7qpgniveSM3WnTFZrHgwHVXy2cCAVB+CqYnFl+i0=; b=iC6xlTgw/yddgtcaD9OecbLDr6h7X7IAU66/KXM4I/LZpe0vogMjNGClwbLiA6YKGi sTaHybxN2Vm97YvgKEVuIFDINbA0px3znUoRMzFaoPaCcn+skgdlK+h7c88fCJTGpV+u 3/377mq3xOZjQoQBVaFsk64j6DwG3gFwxGLwCi/dMoSDuIFB22WKP3cGMxXp4YzIfABC Jj3GauXz7NjXq2qx7n6lvgJ7Lg8ICjOLlcxHaMaVqXZfy0bKxDzw+vLivmReXzDxCL6k /SRKGpQZslZDynJIX2Bw3Y8Gyuu4kgwq2Bv7bKUuO1O5NDKv0NF422PTczFJjsuGVsk7 Fhxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fk1Wn10s; 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 t6si1206915vka.54.2021.08.18.14.32.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:32:12 -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=fk1Wn10s; 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]:44372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTAR-0007vz-FD for patch@linaro.org; Wed, 18 Aug 2021 17:32:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7q-0006DE-Qu for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:30 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:43000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7o-0005pQ-SW for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:30 -0400 Received: by mail-pl1-x62c.google.com with SMTP id w6so2648453plg.9 for ; Wed, 18 Aug 2021 14:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s5r7qpgniveSM3WnTFZrHgwHVXy2cCAVB+CqYnFl+i0=; b=fk1Wn10sX9NfJfmq/7NwvLCRzkhW0M1EIIPKwPaKAnCM1r9Gk7yg/CI7Ro1/tkxT8O SBlHg7zlaR2Qr1hOEe7cOkTiL43jDgtncqNIas0MfgEj0h9A//zq4y5gw+qrgRhFFVuT af1tl0jeC3maK1qC0NFPWCFBiH7nXpHBkDl2VyGJOTxqq0BZU1s2Wv6gMuSqY6XiaB5g 8+oZfSySIj5UBs4BJs8zv+fZJtu9pdhz00rRjUWBCvKpCPKnDXefaFLIUxfZpuC9JMLx 0ayk0Mhnkr9SgQz9vAOQqdYpE0sRNy33PdOl89xfPrM3Dw2nhoNJV4MwsBcBCD99wKRQ 5gFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s5r7qpgniveSM3WnTFZrHgwHVXy2cCAVB+CqYnFl+i0=; b=VtDpNPQPc6dV6SndF60Ama+NkBbtcpKZuaLteczDxxiG/dACxGpTZxbm05eN1ohuZ1 f0+ySnEGQCcleDcuu48UxmS870BRGZTdTipixq15Sx3agZnoB4w5T+lHgXAnSBl5zQtU lM5HPU6AFjFx4o9p3NLWVpOEWspEl/voNrhnGAAVnCRYZGnWnzgLUm+JAfa9vHjI7Yy4 dVQy7c3dOcTt8IF0AasSc1BVcMg/HJSIxCweIh0QQrqmtkGsqlL++SFBnPBr65pZhslz cKhegdYCnsLCan/oqTc7gEh2P2q5nMIOFfRkr7cTdi//sOoWVwFNZOpcizYEatsEXX6N a0SA== X-Gm-Message-State: AOAM533LlkLVHd7BD0ZSLeeWh9JUOKzvC+vNFV+sZK+oikA4An7o5+ky 8WWAv7+DDf8kUwb5kmxVzLm1exYQCNHRrw== X-Received: by 2002:a17:90b:4b4d:: with SMTP id mi13mr11877540pjb.20.1629322167640; Wed, 18 Aug 2021 14:29:27 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 13/14] tcg/arm: Reserve a register for guest_base Date: Wed, 18 Aug 2021 11:29:11 -1000 Message-Id: <20210818212912.396794-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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.23 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" Reserve a register for the guest_base using aarch64 for reference. By doing so, we do not have to recompute it for every memory load. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 35bd4c68d6..2728035177 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -84,6 +84,9 @@ static const int tcg_target_call_oarg_regs[2] = { #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, @@ -1763,7 +1766,8 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, TCGReg datalo, TCGReg datahi, - TCGReg addrlo, TCGReg addend) + TCGReg addrlo, TCGReg addend, + bool scratch_addend) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1790,7 +1794,7 @@ static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, addend); - } else if (datalo != addend) { + } else if (scratch_addend) { tcg_out_ld32_rwb(s, COND_AL, datalo, addend, addrlo); tcg_out_ld32_12(s, COND_AL, datahi, addend, 4); } else { @@ -1875,14 +1879,14 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) label_ptr = s->code_ptr; tcg_out_bl_imm(s, COND_NE, 0); - tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, addend); + tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, addend, true); add_qemu_ldst_label(s, true, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); #else /* !CONFIG_SOFTMMU */ if (guest_base) { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, guest_base); - tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, TCG_REG_TMP); + tcg_out_qemu_ld_index(s, opc, datalo, datahi, + addrlo, TCG_REG_GUEST_BASE, false); } else { tcg_out_qemu_ld_direct(s, opc, datalo, datahi, addrlo); } @@ -1891,7 +1895,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) static void tcg_out_qemu_st_index(TCGContext *s, ARMCond cond, MemOp opc, TCGReg datalo, TCGReg datahi, - TCGReg addrlo, TCGReg addend) + TCGReg addrlo, TCGReg addend, + bool scratch_addend) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1912,9 +1917,14 @@ static void tcg_out_qemu_st_index(TCGContext *s, ARMCond cond, MemOp opc, && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { tcg_out_strd_r(s, cond, datalo, addrlo, addend); - } else { + } else if (scratch_addend) { tcg_out_st32_rwb(s, cond, datalo, addend, addrlo); tcg_out_st32_12(s, cond, datahi, addend, 4); + } else { + tcg_out_dat_reg(s, cond, ARITH_ADD, TCG_REG_TMP, + addend, addrlo, SHIFT_IMM_LSL(0)); + tcg_out_st32_12(s, cond, datalo, TCG_REG_TMP, 0); + tcg_out_st32_12(s, cond, datahi, TCG_REG_TMP, 4); } break; default: @@ -1978,7 +1988,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) mem_index = get_mmuidx(oi); addend = tcg_out_tlb_read(s, addrlo, addrhi, opc, mem_index, 0); - tcg_out_qemu_st_index(s, COND_EQ, opc, datalo, datahi, addrlo, addend); + tcg_out_qemu_st_index(s, COND_EQ, opc, datalo, datahi, + addrlo, addend, true); /* The conditional call must come last, as we're going to return here. */ label_ptr = s->code_ptr; @@ -1988,9 +1999,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) s->code_ptr, label_ptr); #else /* !CONFIG_SOFTMMU */ if (guest_base) { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, guest_base); - tcg_out_qemu_st_index(s, COND_AL, opc, datalo, - datahi, addrlo, TCG_REG_TMP); + tcg_out_qemu_st_index(s, COND_AL, opc, datalo, datahi, + addrlo, TCG_REG_GUEST_BASE, false); } else { tcg_out_qemu_st_direct(s, opc, datalo, datahi, addrlo); } @@ -3153,6 +3163,13 @@ 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) { + 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 Wed Aug 18 21:29:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499020 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1061386jab; Wed, 18 Aug 2021 14:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX/SGbSUmTej9WdULhyr6n/JPyS89fAFqD/trq+NaCBSZKjOQw+iUirIt39QSngwoxet5F X-Received: by 2002:a37:749:: with SMTP id 70mr359571qkh.461.1629322933649; Wed, 18 Aug 2021 14:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629322933; cv=none; d=google.com; s=arc-20160816; b=KU7b3t6S+IXx9SYIgAxcGoeD2XHuxD0Mx8WB4GEfe1y8z15pJRxKvHOzsMBl0QADzN u54vs2IFy79bQaerVo83K47gH+YdH+Ps2KTmxZngOYSo72vDeByLv7JOF5SXKvqwwhqb nchGB95EzjAx3OeM9prgHVefoo/s0HB7pnybOhIQZvPCOpJJiCrUhd4fSoXCXiy6bLB6 uplwt27DTihwdfQakyQD2IcegCZGQpRuzU5qKPx7GfngZFtpLruj/z4gK0KbDWchQr7Q jbk9rbFvk5GSpG5yZCRDDBW4CxfhWu4yProSjmtSeIVxEmSo/GKfF1ZohkMYrgMKrdLp ksvg== 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=Q5i+88+W8J5jrTIxMK8HSdJnmF3iUhh3YBbOpnD+6ds=; b=BCwA3f786LLkjrQvuyB7wI/YMu2vrmpAhROwJx8qAXv3XioofRmsrnCT1pku8FgU3v XABG3/5p4newm7m/qBIA02nTPJ2GHEErJ5oYOpduHBQClYoapj47O//z8HfTnFGxMlvF nkXXP/fhhHArhxAxas1d2gdDgo44E5P5z53PjBfEWusb4huD+8jJoA2eXlT8il/MrVxW O1LEqd46SGAMhbRkbQSRX6Lsqd+iACghUAbQ/TnYpqdnJC9bMnTfoGAde2k1aHYAAb/V 6gVf7Zt6L0xEArvH0MBv0soGiNsSNhpuoOy4ll1MtdQPrvoQ2G/QugKvCQ03ZxgVjdsk b+Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rscbsps4; 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 v11si753122qkp.92.2021.08.18.14.42.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 14:42: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=Rscbsps4; 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]:42518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGTK9-0000uf-2H for patch@linaro.org; Wed, 18 Aug 2021 17:42:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGT7s-0006MK-V5 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:33 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:43848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGT7p-0005pr-Ul for qemu-devel@nongnu.org; Wed, 18 Aug 2021 17:29:32 -0400 Received: by mail-pj1-x102a.google.com with SMTP id qe12-20020a17090b4f8c00b00179321cbae7so3333938pjb.2 for ; Wed, 18 Aug 2021 14:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Q5i+88+W8J5jrTIxMK8HSdJnmF3iUhh3YBbOpnD+6ds=; b=Rscbsps4+KD70N0STKVf9lBApyuLcfB+d+GXphfXTmQsXoxPOd8iwyvRvT0a5BN5fJ V55G4mRet2ulDXnDEe79PYOgFOwOLRMRCPIrAlhX3W9LzU4X0R5ihnamR5INCsvvy0fW QmK+QkL/lQbr1aK1klhUssSHtu5ci0KndsgkJvQ6+NUKext1+dFfhEPcgCbdztGLFSGc YE869L/tRejUyhqqdyYJYpRw6lWY51sJ65nS1w7zDjJ+SePkfDpZE5O/SSws7KoQuhvJ Z1nakdOePgk7LFv1d7hzZC5VM7tgsg+1osvqOSeUmAY8s9L7f2IGnlmzF7EfK4Y55G/o iKBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q5i+88+W8J5jrTIxMK8HSdJnmF3iUhh3YBbOpnD+6ds=; b=fc0CRliuQ0t5ggDiX/wswfU0MriCQTT0O2KyFR1i6M5aVC01ERNZzHP7U1DFzNiA3/ dbovGJVJFvqsYr55LQBFddP7BrAc3ALxfeo/GvAluNMoMXaNzAGSC/bWBsBPGUbBCXpZ Ha7WJs+cAkWcCRZfsLQK3o4DeaZ2A2pKULALGelXlF6m2TZmdq5n5ZyBn26ALuXGbvPM XD13SNwg1wT3t7lApp/rEBeupJQZmR5fUDm6cbWLKJqVsf/GfbEGgkK4s8UbN3Uadecf ZFWiawCebCnuIWJ7u3bFhNfZREmheG/zQCHkJ0zns1z//trtQs9Ced0icUjYZyfQ62Fb jdnQ== X-Gm-Message-State: AOAM531F6POQHjLKoaLjjqMqegq2FyePZkfcKD9kVM/6Lv67K82HyD5Z cJ5qdpiFvHiOc47mKjLt/NxvYR525ep5cw== X-Received: by 2002:a17:902:7c15:b029:12c:78ec:bb61 with SMTP id x21-20020a1709027c15b029012c78ecbb61mr8979693pll.61.1629322168514; Wed, 18 Aug 2021 14:29:28 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id y19sm751965pfe.71.2021.08.18.14.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:29:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/14] tcg/arm: Support raising sigbus for user-only Date: Wed, 18 Aug 2021 11:29:12 -1000 Message-Id: <20210818212912.396794-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818212912.396794-1-richard.henderson@linaro.org> References: <20210818212912.396794-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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.23 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" For v6+, use ldm/stm, ldrd/strd for the normal case of alignment matching the access size. Otherwise, emit a test + branch sequence invoking helper_unaligned_{ld,st}. For v4+v5, use piecewise load and stores to implement misalignment. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 - tcg/arm/tcg-target.c.inc | 364 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 340 insertions(+), 26 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index e47720a85b..fa75fd3626 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -159,9 +159,7 @@ extern bool use_neon_instructions; /* not defined -- call should be eliminated at compile time */ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t); -#ifdef CONFIG_SOFTMMU #define TCG_TARGET_NEED_LDST_LABELS -#endif #define TCG_TARGET_NEED_POOL_LABELS #endif diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 2728035177..278639be44 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -23,6 +23,7 @@ */ #include "elf.h" +#include "../tcg-ldst.c.inc" #include "../tcg-pool.c.inc" int arm_arch = __ARM_ARCH; @@ -86,6 +87,7 @@ static const int tcg_target_call_oarg_regs[2] = { #define TCG_VEC_TMP TCG_REG_Q15 #ifndef CONFIG_SOFTMMU #define TCG_REG_GUEST_BASE TCG_REG_R11 +#define TCG_REG_TMP2 TCG_REG_R14 #endif typedef enum { @@ -137,7 +139,9 @@ typedef enum { INSN_CLZ = 0x016f0f10, INSN_RBIT = 0x06ff0f30, + INSN_LDM = 0x08900000, INSN_LDMIA = 0x08b00000, + INSN_STM = 0x08800000, INSN_STMDB = 0x09200000, INSN_LDR_IMM = 0x04100000, @@ -1428,8 +1432,6 @@ static void tcg_out_vldst(TCGContext *s, ARMInsn insn, } #ifdef CONFIG_SOFTMMU -#include "../tcg-ldst.c.inc" - /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * int mmu_idx, uintptr_t ra) */ @@ -1762,6 +1764,74 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_goto(s, COND_AL, qemu_st_helpers[opc & MO_SIZE]); return true; } +#else + +static void tcg_out_test_alignment(TCGContext *s, bool is_ld, TCGReg addrlo, + TCGReg addrhi, unsigned a_bits) +{ + unsigned a_mask = (1 << a_bits) - 1; + TCGLabelQemuLdst *label = new_ldst_label(s); + + label->is_ld = is_ld; + label->addrlo_reg = addrlo; + label->addrhi_reg = addrhi; + + /* We are expecting a_bits to max out at 7, and can easily support 8. */ + tcg_debug_assert(a_mask <= 0xff); + /* tst addr, #mask */ + tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, a_mask); + + /* blne slow_path */ + label->label_ptr[0] = s->code_ptr; + tcg_out_bl_imm(s, COND_NE, 0); + + label->raddr = tcg_splitwx_to_rx(s->code_ptr); +} + +static bool tcg_out_fail_alignment(TCGContext *s, TCGLabelQemuLdst *l) +{ + if (!reloc_pc24(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { + return false; + } + + if (TARGET_LONG_BITS == 64) { + /* 64-bit target address is aligned into R2:R3. */ + if (l->addrhi_reg != TCG_REG_R2) { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R2, l->addrlo_reg); + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R3, l->addrhi_reg); + } else if (l->addrlo_reg != TCG_REG_R3) { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R3, l->addrhi_reg); + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R2, l->addrlo_reg); + } else { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R1, TCG_REG_R2); + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R2, TCG_REG_R3); + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R3, TCG_REG_R1); + } + } else { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_R1, l->addrlo_reg); + } + tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_R0, TCG_AREG0); + + /* + * Tail call to the helper, with the return address back inline, + * just for the clarity of the debugging traceback -- the helper + * cannot return. We have used BLNE to arrive here, so LR is + * already set. + */ + tcg_out_goto(s, COND_AL, (const void *) + (l->is_ld ? helper_unaligned_ld : helper_unaligned_st)); + return true; +} + +static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + return tcg_out_fail_alignment(s, l); +} + +static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + return tcg_out_fail_alignment(s, l); +} #endif /* SOFTMMU */ static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, @@ -1811,45 +1881,175 @@ static void tcg_out_qemu_ld_index(TCGContext *s, MemOp opc, #ifndef CONFIG_SOFTMMU static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg datalo, - TCGReg datahi, TCGReg addrlo) + TCGReg datahi, TCGReg addrlo, uint8_t ofs) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SSIZE) { case MO_UB: - tcg_out_ld8_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld8_12(s, COND_AL, datalo, addrlo, ofs); break; case MO_SB: - tcg_out_ld8s_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld8s_8(s, COND_AL, datalo, addrlo, ofs); break; case MO_UW: - tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld16u_8(s, COND_AL, datalo, addrlo, ofs); break; case MO_SW: - tcg_out_ld16s_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld16s_8(s, COND_AL, datalo, addrlo, ofs); break; case MO_UL: - tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld32_12(s, COND_AL, datalo, addrlo, ofs); break; case MO_Q: /* LDRD requires alignment; double-check that. */ if (use_armv6_instructions && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { - tcg_out_ldrd_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_ldrd_8(s, COND_AL, datalo, addrlo, ofs); } else if (datalo == addrlo) { - tcg_out_ld32_12(s, COND_AL, datahi, addrlo, 4); - tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_ld32_12(s, COND_AL, datahi, addrlo, ofs + 4); + tcg_out_ld32_12(s, COND_AL, datalo, addrlo, ofs); } else { - tcg_out_ld32_12(s, COND_AL, datalo, addrlo, 0); - tcg_out_ld32_12(s, COND_AL, datahi, addrlo, 4); + tcg_out_ld32_12(s, COND_AL, datalo, addrlo, ofs); + tcg_out_ld32_12(s, COND_AL, datahi, addrlo, ofs + 4); } break; default: g_assert_not_reached(); } } + +/* + * There are a some interesting special cases for which we can get + * the alignment check for free with the instruction. For MO_16, + * we would need to enlist ARMv8 load-acquire halfword (LDAH). + */ +static bool tcg_out_qemu_ld_align(TCGContext *s, MemOp opc, TCGReg datalo, + TCGReg datahi, TCGReg addrlo, + unsigned a_bits) +{ + unsigned s_bits = opc & MO_SIZE; + + /* LDM enforces 4-byte alignment. */ + if (a_bits == MO_32 && s_bits >= MO_32) { + TCGReg tmphi, tmplo; + + if (guest_base) { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP, addrlo, + TCG_REG_GUEST_BASE, SHIFT_IMM_LSL(0)); + addrlo = TCG_REG_TMP; + } + + if (s_bits == MO_32) { + /* ldm addrlo, { datalo } */ + tcg_out_ldstm(s, COND_AL, INSN_LDM, addrlo, 1 << datalo); + return true; + } + /* else MO_64... */ + + /* + * LDM loads in mask order, so we want the second part to be loaded + * into a higher register number. Note that both R12 and R14 are + * reserved, so we always have a maximum regno to use. + */ + tmplo = datalo; + tmphi = datahi; + if (MO_BSWAP == MO_LE) { + if (datalo > datahi) { + tmphi = TCG_REG_TMP; + } + } else { + if (datalo < datahi) { + tmplo = TCG_REG_TMP; + } + } + + /* ldm addrlo, { tmplo, tmphi } */ + tcg_out_ldstm(s, COND_AL, INSN_LDM, addrlo, 1 << tmplo | 1 << tmphi); + + tcg_out_mov(s, TCG_TYPE_I32, datahi, tmphi); + tcg_out_mov(s, TCG_TYPE_I32, datalo, tmplo); + return true; + } + + /* LDRD enforces 8-byte alignment. */ + if (a_bits == MO_64 && s_bits == MO_64 + && (datalo & 1) == 0 && datahi == datalo + 1) { + if (guest_base) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, guest_base); + tcg_out_ldrd_r(s, COND_AL, datalo, addrlo, TCG_REG_TMP); + } else { + tcg_out_ldrd_8(s, COND_AL, datalo, addrlo, 0); + } + return true; + } + return false; +} + +static void tcg_out_qemu_ld_unalign(TCGContext *s, MemOp opc, + TCGReg datalo, TCGReg datahi, + TCGReg addrlo, unsigned a_bits) +{ + unsigned s_bits = opc & MO_SIZE; + unsigned s_size = 1 << s_bits; + unsigned a_size = 1 << a_bits; + bool init = true; + unsigned i; + + if (guest_base) { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP2, addrlo, + TCG_REG_GUEST_BASE, SHIFT_IMM_LSL(0)); + addrlo = TCG_REG_TMP2; + } + + /* + * Perform the load in units of a_size. + */ + if (MO_BSWAP == MO_LE) { + for (i = 0; i < s_size; ) { + if (init) { + tcg_out_qemu_ld_direct(s, a_bits, datalo, 0, addrlo, i); + init = false; + } else { + /* + * Note that MO_SIGN will only be set for MO_16, and we + * want the sign bit for the second byte, when !init. + */ + tcg_out_qemu_ld_direct(s, a_bits | (opc & MO_SIZE), + TCG_REG_TMP, 0, addrlo, i); + tcg_out_dat_reg(s, COND_AL, ARITH_ORR, + datalo, datalo, TCG_REG_TMP, + SHIFT_IMM_LSL(i * 8)); + } + i += a_size; + if (s_size == 8 && i == 4) { + datalo = datahi; + init = true; + } + } + } else { + for (i = 0; i < s_size; ) { + if (init) { + /* See above, only reversed for big-endian. */ + tcg_out_qemu_ld_direct(s, a_bits | (opc & MO_SIZE), + datahi, 0, addrlo, i); + init = false; + } else { + tcg_out_qemu_ld_direct(s, a_bits, TCG_REG_TMP, 0, addrlo, i); + tcg_out_dat_reg(s, COND_AL, ARITH_ORR, + datahi, TCG_REG_TMP, datahi, + SHIFT_IMM_LSL(a_size * 8)); + } + i += a_size; + if (s_size == 8 && i == 4) { + datahi = datalo; + init = true; + } + } + } +} #endif static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) @@ -1861,6 +2061,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) int mem_index; TCGReg addend; tcg_insn_unit *label_ptr; +#else + unsigned a_bits, s_bits; #endif datalo = *args++; @@ -1884,11 +2086,23 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) add_qemu_ldst_label(s, true, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); #else /* !CONFIG_SOFTMMU */ - if (guest_base) { + a_bits = get_alignment_bits(opc); + s_bits = opc & MO_SIZE; + + if (use_armv6_instructions && + tcg_out_qemu_ld_align(s, datalo, datahi, addrlo, a_bits, s_bits)) { + return; + } + if (a_bits) { + tcg_out_test_alignment(s, true, addrlo, addrhi, a_bits); + } + if (!use_armv6_instructions && a_bits < MO_32) { + tcg_out_qemu_ld_unalign(s, opc, datalo, datahi, addrlo, a_bits); + } else if (guest_base) { tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, TCG_REG_GUEST_BASE, false); } else { - tcg_out_qemu_ld_direct(s, opc, datalo, datahi, addrlo); + tcg_out_qemu_ld_direct(s, opc, datalo, datahi, addrlo, 0); } #endif } @@ -1934,36 +2148,122 @@ static void tcg_out_qemu_st_index(TCGContext *s, ARMCond cond, MemOp opc, #ifndef CONFIG_SOFTMMU static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo, - TCGReg datahi, TCGReg addrlo) + TCGReg datahi, TCGReg addrlo, uint8_t ofs) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); switch (opc & MO_SIZE) { case MO_8: - tcg_out_st8_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_st8_12(s, COND_AL, datalo, addrlo, ofs); break; case MO_16: - tcg_out_st16_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_st16_8(s, COND_AL, datalo, addrlo, ofs); break; case MO_32: - tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); + tcg_out_st32_12(s, COND_AL, datalo, addrlo, ofs); break; case MO_64: /* STRD requires alignment; double-check that. */ if (use_armv6_instructions && get_alignment_bits(opc) >= MO_64 && (datalo & 1) == 0 && datahi == datalo + 1) { - tcg_out_strd_8(s, COND_AL, datalo, addrlo, 0); + tcg_out_strd_8(s, COND_AL, datalo, addrlo, ofs); } else { - tcg_out_st32_12(s, COND_AL, datalo, addrlo, 0); - tcg_out_st32_12(s, COND_AL, datahi, addrlo, 4); + tcg_out_st32_12(s, COND_AL, datalo, addrlo, ofs); + tcg_out_st32_12(s, COND_AL, datahi, addrlo, ofs + 4); } break; default: g_assert_not_reached(); } } + +static bool tcg_out_qemu_st_align(TCGContext *s, TCGReg datalo, + TCGReg datahi, TCGReg addrlo, + unsigned a_bits, unsigned s_bits) +{ + /* STM enforces 4-byte alignment. */ + if (a_bits == MO_32) { + uint16_t mask = 1 << datalo; + + switch (s_bits) { + case MO_64: + /* + * STM stores in mask order, so we want the second part to be + * in a higher register number. Note that both R12 and R14 + * are reserved, so we always have a maximum regno to use. + */ + if (MO_BSWAP == MO_LE) { + if (datalo > datahi) { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_TMP, datahi); + datahi = TCG_REG_TMP; + } + } else { + if (datalo < datahi) { + tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_TMP, datalo); + datalo = TCG_REG_TMP; + } + } + mask = 1 << datalo | 1 << datahi; + /* fall through */ + + case MO_32: + if (guest_base) { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP2, addrlo, + TCG_REG_GUEST_BASE, SHIFT_IMM_LSL(0)); + addrlo = TCG_REG_TMP2; + } + tcg_out_ldstm(s, COND_AL, INSN_STM, addrlo, mask); + return true; + } + return false; + } + + /* STRD enforces 8-byte alignment. */ + if (a_bits == MO_64 && s_bits == MO_64 + && (datalo & 1) == 0 && datahi == datalo + 1) { + if (guest_base) { + tcg_out_strd_r(s, COND_AL, datalo, addrlo, TCG_REG_GUEST_BASE); + } else { + tcg_out_strd_8(s, COND_AL, datalo, addrlo, 0); + } + return true; + } + return false; +} + +static void tcg_out_qemu_st_unalign(TCGContext *s, MemOp opc, + TCGReg datalo, TCGReg datahi, + TCGReg addrlo, unsigned a_bits) +{ + int s_bits = opc & MO_SIZE; + int s_size = 1 << s_bits; + int a_size = 1 << a_bits; + int i; + + if (guest_base) { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_TMP2, addrlo, + TCG_REG_GUEST_BASE, SHIFT_IMM_LSL(0)); + addrlo = TCG_REG_TMP2; + } + + /* + * Perform the store in units of a_size. + */ + for (i = 0; i < s_size; i += a_size) { + int shift = (MO_BSWAP == MO_LE ? i : s_size - a_size - i) * 8; + TCGReg t = (i < 32 ? datalo : datahi); + + shift &= 31; + if (shift) { + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, t, + SHIFT_IMM_LSR(shift)); + t = TCG_REG_TMP; + } + tcg_out_qemu_st_direct(s, a_bits, t, 0, addrlo, i); + } +} #endif static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) @@ -1975,6 +2275,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) int mem_index; TCGReg addend; tcg_insn_unit *label_ptr; +#else + unsigned a_bits, s_bits; #endif datalo = *args++; @@ -1998,11 +2300,22 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is64) add_qemu_ldst_label(s, false, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); #else /* !CONFIG_SOFTMMU */ - if (guest_base) { + a_bits = get_alignment_bits(opc); + s_bits = opc & MO_SIZE; + + if (tcg_out_qemu_st_align(s, datalo, datahi, addrlo, a_bits, s_bits)) { + return; + } + if (a_bits) { + tcg_out_test_alignment(s, true, addrlo, addrhi, a_bits); + } + if (!use_armv6_instructions && a_bits < MO_32) { + tcg_out_qemu_st_unalign(s, opc, datalo, datahi, addrlo, a_bits); + } else if (guest_base) { tcg_out_qemu_st_index(s, COND_AL, opc, datalo, datahi, addrlo, TCG_REG_GUEST_BASE, false); } else { - tcg_out_qemu_st_direct(s, opc, datalo, datahi, addrlo); + tcg_out_qemu_st_direct(s, opc, datalo, datahi, addrlo, 0); } #endif } @@ -2558,6 +2871,9 @@ static void tcg_target_init(TCGContext *s) tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP); tcg_regset_set_reg(s->reserved_regs, TCG_REG_PC); tcg_regset_set_reg(s->reserved_regs, TCG_VEC_TMP); +#ifndef CONFIG_SOFTMMU + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP2); +#endif } static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg,