From patchwork Sat Apr 8 03:03:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 671502 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp611887wrt; Fri, 7 Apr 2023 20:06:01 -0700 (PDT) X-Google-Smtp-Source: AKy350Y66An0vAxfQDCz2CvszwjdZbMJcFLdWe2wUM1XpNZgatEye6/boa5/dvyhdhJw8R3eNf2s X-Received: by 2002:ad4:5b87:0:b0:5e9:a248:877b with SMTP id 7-20020ad45b87000000b005e9a248877bmr455487qvp.5.1680923161059; Fri, 07 Apr 2023 20:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680923161; cv=none; d=google.com; s=arc-20160816; b=YdB8uzD6P7G+ib6DLBt/irAmbkMIhLR13JXOUUDkv1FDAw5ZW39B+WOPM0HZNIyXiu L/Jv1j+26H4RLdmASyyp6NB2/ZktcsdnB946JjjgQN0bJ0LKBCHywSGjj2KzIPXYIu3l 6Al5T9oIRLMF0mI4IK5jDHEv2lw82M2IKBpzRravm57MFqrTFQEcvMAXtkdnslJo4QpZ KYmd8Aj9oeIyijISoGLprrg+OqRsx6ewHvzv/vcNHizfQP/K0TCzNuZmDSHLEZiS0F3h QcEWMWKx7zj04hDxUQ6LcpEsp789hm62I2H060bDYW/Qh8EPVWkS4Yg3Hwkqm10cb2ki 2DJA== 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=FzyqRtK+sy/Z6TtVMGGAfWbqpPjrDQw0gAte8M7H4fw=; b=JAgaIcWXbKvkqySGDCMHSv5qm+S9k/XNwgrs/ImT9ZP7J14rmw8EtWFb5EcCUPDRyo qkqKCHGZOxLCEI0h1jkMyx0e+Sr+7ljoXwR7ljDc9qNE9zt/LytVNKTeZ0HWZJM7T35/ Yx5RA7Vsgnbw+dRaf+2qBMkTAE96ESf5t1RfYIzOa1YU7/+DDg4w+exkpA8dux+D3A2U +Gpzq1hWA1o3U0sVgF6MTn5PXOj6rj/NHktZOpBSdaYMQ7vGJJJxspJovdDdIDMi3aqZ L2f9TnYwkk8uv1HNyYErHDvtzpxguPMDPx2z0a/XvyAqApUbP2za1FKK+25Td6PZWjuC U8Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WBbmcMBk; 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 kd25-20020a056214401900b005ad4f60da65si3767835qvb.432.2023.04.07.20.06.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Apr 2023 20:06:01 -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=WBbmcMBk; 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 1pkysM-0004B5-C9; Fri, 07 Apr 2023 23:04:26 -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 1pkys8-00046i-Jo for qemu-devel@nongnu.org; Fri, 07 Apr 2023 23:04:12 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkys6-0004XJ-U8 for qemu-devel@nongnu.org; Fri, 07 Apr 2023 23:04:12 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1a2b01f5ac0so2480265ad.3 for ; Fri, 07 Apr 2023 20:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680923048; 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=FzyqRtK+sy/Z6TtVMGGAfWbqpPjrDQw0gAte8M7H4fw=; b=WBbmcMBkf84HRImxrgiMlGphpcTxjmM0y94roAkxI+Nns7qfCz4Bi9a8aFw6mN4SRQ 4LsDC92CFQgKGtcu3bguK2sXIADMyrSSbcDVhL8wl0VBNhxDghn+3KgpRzR4yakg7zIl 6BlE8mbh/jvUU6uBi6sjFHR7ciYveEMAUENMsOCayAPZQj1btQIkMCNus1mRzR08zT8w 6j4U5LoYjl+87E+GU07SnEHZJqep5tIF4tJY0Gs0FBcQ4tQIhv/DtaWFg3cr1aNGo28I WEFYth84zFpYI+NSSay0SVihFFa2dM+IdqcSepft93ach8dxbg96G9Box7MsHpk2eI4+ B/vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680923048; 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=FzyqRtK+sy/Z6TtVMGGAfWbqpPjrDQw0gAte8M7H4fw=; b=f90RZ+MtFx7i/4e3WMWhY0lmhAb7cnsDo+B7QWxp1lufmw3sySihFl77h9Ve/rjL12 /GTaf5fDb53oqvoagRnJBjGfc1YjT0jcKcYy6xtor1empip7Un37BG2Dtk5ZVdHILhHO A4p6D/vwbXPW+IYef7UneGYwzIZV/MS/b6/CgMuOqckwPJwhSx64eQWUBa30CjCWCbKO yd3gV3CODCscXd4YDz3ie1MjQ+8RE83Q2zyqHmFCXu5vSL877KCd32bYhlVUuz333SWR Us/3XYzrZe+D6YDaZchgEO4d97/cdtJF7hZBUjvcVL+O03ny7zrMeOD46HBRwZHsrUnj TG0A== X-Gm-Message-State: AAQBX9efMQe+I0QTIoXIkB7OrOcUGZLB7sNDvABJOs7TBQ2exhoLj51H o8Xv729A8KEQ2v0L2aKTUCcXqcZKntfOGYV+duQ= X-Received: by 2002:a62:1c8f:0:b0:628:1852:8431 with SMTP id c137-20020a621c8f000000b0062818528431mr3516875pfc.30.1680923048271; Fri, 07 Apr 2023 20:04:08 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:8bb4:5a9d:7ab7:b4b8]) by smtp.gmail.com with ESMTPSA id c12-20020aa78e0c000000b0062b5a55835dsm3687025pfr.213.2023.04.07.20.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 20:04:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 09/12] tcg/mips: Try tb-relative addresses in tcg_out_movi Date: Fri, 7 Apr 2023 20:03:56 -0700 Message-Id: <20230408030359.3368868-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230408030359.3368868-1-richard.henderson@linaro.org> References: <20230408030359.3368868-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.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 These addresses are often loaded by the qemu_ld/st slow path, for loading the retaddr value. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index e37aca5986..8c9a4cba9b 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -572,6 +572,8 @@ static void tcg_out_movi_pool(TCGContext *s, TCGReg ret, static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long arg, TCGReg tbreg) { + tcg_target_long tmp; + if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) { arg = (int32_t)arg; } @@ -582,6 +584,17 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } assert(TCG_TARGET_REG_BITS == 64); + /* Load addresses within 2GB of TB with 1 or 3 insns. */ + tmp = tcg_tbrel_diff(s, (void *)arg); + if (tmp == (int16_t)tmp) { + tcg_out_opc_imm(s, OPC_DADDIU, ret, tbreg, tmp); + return; + } + if (tcg_out_movi_two(s, ret, tmp)) { + tcg_out_opc_reg(s, OPC_DADDU, ret, ret, tbreg); + return; + } + /* Otherwise, put 64-bit constants into the constant pool. */ tcg_out_movi_pool(s, ret, arg, tbreg); }