From patchwork Wed May 3 06:57:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 678591 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp902798wrs; Wed, 3 May 2023 00:06:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7d7PJQWxmqyZWCnQkM7NLVK5JMXzQUp1zrw78Z2ev9+D6kI8gKNIlE6bsjLMcxU+jtFx5D X-Received: by 2002:a05:6214:2609:b0:5a6:24f6:724d with SMTP id gu9-20020a056214260900b005a624f6724dmr9389788qvb.13.1683097616602; Wed, 03 May 2023 00:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683097616; cv=none; d=google.com; s=arc-20160816; b=V1fN3S6zCjNSsTQEMiNM4V+advQFrIVtN8PYftH/55tS2MPhe0FRUDSaAj2+X5AKJt UEe8LmrbCtv9FIhd6er1uNfA4nWtr/ciASC6iDboS0JZ7BBBePCsyqd5+bqFSQ7J/H9G C43J8t4rPY0+xRD5Rvc36NomaFiMxQks0xdWGJwbrBH16EiIA94U2HsfqiJOnxvOvBXA TeGyX725+FW84TpwXtTvZb6Pc5cdmX2ohZykGhxuyjHUotIQis+bi+9sJAdG6b+q+LpN qh9jShUqQS33tAOsn2BfCmO9882H4Eong0hr/qtxh6IObbJGw5IgTydskinGqFKQMpAk 0rmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=s3Kvvji1lo30VOJQkNIC+0dERcdVMSlSNE0nSr5zHXb5/q8jkppD9UHk/RkaeHX3ne 8V56RL8BIjU+XPvXtDUMQUsuqxQl7CK5qMRrKTQ484XiALhYTc1MMi6/BfTA4WegW89x 61cvRf/CVf4lxLrXcDjYJG4O2SM7cBkpxeSkbWTXzkaptCxdQqxCUHJFYAz9xfOgl+xK sZMO/29raDcXdvT0swjtfsToLQ2Zqr0OaWUboDmWBIgRHcFQMlggA8CVlI81n03j2Hb6 jo8Emck/h8koGC1fkMxydZF1ANcajvx9uNcCU8wWdG2gLl+hYh/d9ov24MDglFjNVSg/ /vvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MGiG4dTe; 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 r8-20020a056214212800b0061b5fa926b1si1840645qvc.185.2023.05.03.00.06.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 May 2023 00:06:56 -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=MGiG4dTe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pu6SI-0001C7-Ro; Wed, 03 May 2023 02:59:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pu6Ro-0000FY-7M for qemu-devel@nongnu.org; Wed, 03 May 2023 02:58:49 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pu6R6-0001z9-Jq for qemu-devel@nongnu.org; Wed, 03 May 2023 02:58:43 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f315735514so10512735e9.1 for ; Tue, 02 May 2023 23:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683097079; x=1685689079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=MGiG4dTeI/0nQJhf4YjQWwHGV7/+mKmN23xZaSezoMDSCW4f5Jt5OrLUrfJFRAOrf4 j2EVFhNYjeMkNT14rIVE08uVDiG4kyzIRuy7vpg6TRSkcxJKFaeWkRaALK3uCnYzOyRl tX2m+d9zoz+1+oeoxDf2K+SjomfueoQb22And00WxNR4UE72Ak589QaLhgpqrQxM2Iw2 eJj0BEOxIaA+Se3fx9RW8vNLELQm0PO5W9MfJWPLxVSJj40+QU0ZNnZ2ee3udLUbRLiu i3kJKmUFVeqPj6oxuQYS2vkHMzLGKmDrvVGji3sjkN/Cpqu2/a7MKMn4IifXbhBPaB7e wM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683097079; x=1685689079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=j4Wt91+rAXXHiGaIiobik1EeoK7K0zJgLBSutQJhrBo2vHXSYO/iMOXRJf1PjIppJo 32mAiamokCowfAYBMEZNduG5KupDRU2dzzUgTRpIEar0vw1Dwe7H+uUQ3IxURW8pcIb/ GU8j8rzdLxcxY8zlBOvqavfu/+BB3O1WXQd+kpy9zyYxf6JfRKTKW6V/yHDPDqNe97h8 GrmRJMjOpyxzw78HPt3eNGDwrfYhzceoQ9B8Id3P5cxxWTlubYGvAAfsgFghaoW/4VNH gRDkS1L59Kzqjv1iLPYh3CjoJLzcaUqaEfFnFW/eqYDBR4Gg9D2rHl/ScjNal+H/cB6A uV3w== X-Gm-Message-State: AC+VfDxU5JHsl7iJbY3wqs4bw/vZ0kVD6GjPfMn62IsdRuqN7x/kJV2q VNIwab/2Onpenh9Dt4KXHOSNo7zwbxF563DQAEJ+Bw== X-Received: by 2002:adf:f1d0:0:b0:306:d43:4d8e with SMTP id z16-20020adff1d0000000b003060d434d8emr673144wro.29.1683097078957; Tue, 02 May 2023 23:57:58 -0700 (PDT) Received: from stoup.Home ([2a02:c7c:74db:8d00:c01d:9d74:b630:9087]) by smtp.gmail.com with ESMTPSA id f6-20020a5d6646000000b002f6dafef040sm32796617wrw.12.2023.05.02.23.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 23:57:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, philmd@linaro.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 37/54] tcg/aarch64: Convert tcg_out_qemu_{ld,st}_slow_path Date: Wed, 3 May 2023 07:57:12 +0100 Message-Id: <20230503065729.1745843-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230503065729.1745843-1-richard.henderson@linaro.org> References: <20230503065729.1745843-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use tcg_out_ld_helper_args, tcg_out_ld_helper_ret, and tcg_out_st_helper_args. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 40 +++++++++++++++--------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 202b90c001..62dd22d73c 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1580,13 +1580,6 @@ static void tcg_out_cltz(TCGContext *s, TCGType ext, TCGReg d, } } -static void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) -{ - ptrdiff_t offset = tcg_pcrel_diff(s, target); - tcg_debug_assert(offset == sextract64(offset, 0, 21)); - tcg_out_insn(s, 3406, ADR, rd, offset); -} - typedef struct { TCGReg base; TCGReg index; @@ -1627,47 +1620,46 @@ static void * const qemu_st_helpers[MO_SIZE + 1] = { #endif }; +static const TCGLdstHelperParam ldst_helper_param = { + .ntmp = 1, .tmp = { TCG_REG_TMP } +}; + static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) { - MemOpIdx oi = lb->oi; - MemOp opc = get_memop(oi); + MemOp opc = get_memop(lb->oi); if (!reloc_pc19(lb->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { return false; } - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); - tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi); - tcg_out_adr(s, TCG_REG_X3, lb->raddr); + tcg_out_ld_helper_args(s, lb, &ldst_helper_param); tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SIZE]); - - tcg_out_movext(s, lb->type, lb->datalo_reg, - TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_X0); + tcg_out_ld_helper_ret(s, lb, false, &ldst_helper_param); tcg_out_goto(s, lb->raddr); return true; } static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) { - MemOpIdx oi = lb->oi; - MemOp opc = get_memop(oi); - MemOp size = opc & MO_SIZE; + MemOp opc = get_memop(lb->oi); if (!reloc_pc19(lb->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { return false; } - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); - tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); - tcg_out_mov(s, size == MO_64, TCG_REG_X2, lb->datalo_reg); - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, oi); - tcg_out_adr(s, TCG_REG_X4, lb->raddr); + tcg_out_st_helper_args(s, lb, &ldst_helper_param); tcg_out_call_int(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, lb->raddr); return true; } #else +static void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) +{ + ptrdiff_t offset = tcg_pcrel_diff(s, target); + tcg_debug_assert(offset == sextract64(offset, 0, 21)); + tcg_out_insn(s, 3406, ADR, rd, offset); +} + static bool tcg_out_fail_alignment(TCGContext *s, TCGLabelQemuLdst *l) { if (!reloc_pc19(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) {