From patchwork Fri Dec 9 02:05:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632219 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp590784pvb; Thu, 8 Dec 2022 18:12:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf65K4LVSBkgtOuInP04JWpGNXB86uMkhgU/vuyslWdXaD94HwpcHabiAbpd4uBrSdLiKvmu X-Received: by 2002:a05:622a:18a1:b0:3a7:f669:4599 with SMTP id v33-20020a05622a18a100b003a7f6694599mr9253167qtc.62.1670551956391; Thu, 08 Dec 2022 18:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551956; cv=none; d=google.com; s=arc-20160816; b=X1EqWtnTyU/cN2AwUqVRjGHF3ag6PP4DMOUXxNpt+sWZ6yvbc5ipewhRIW1JVzP96E fonRHN/ED5G5lIcoMtyavuLTRNdji1hWz/W4LMainkDMeqlE+ua+1fXSU5TZhBSTabeS Bl/zOusymH7JkpSpkesTkRP19e9LhnU/CBaIX7k/0Kq4F5AJ3Mqmb04kdszhbrSQSAOH PZ14MtkyniOY7WpxyMw4LgNcb9tc6/Fh93vgQMRsF8fGkKByjXHfm8KUiK+0OLQi0nLb 1N0GdLdYt+yG9HByR/1DtuZroS3Nl084SLoGoGLvOp1VFKSo2lce+iPmbhfsHGcaqqg5 spkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=bOB+JD+bNHW7dpa/Mrs7PQdwg2VMxjXbAOVmgPj2aXplHSzCXGhHP5kH0nFT8zhNGZ htap/8A+8/0ZLaIgLh7viIZJwQ4lJeUCpDGwTADJcVKcQ+2tgOIaIpl5td5BCG7VJ+8Y 53+OOgcvzXn1kb2K+gI2TJqeZz5nq81Wwy3n8/MPqcdzuV/e9FFPaqNt7JlU8UE22ziC JsNzIv0bXePEzM1j7/GRVt4li+pbDS97PyYWq0MmYVwVGrx0ZDJcN9xQCUg2IIZciIgy CbLNdXKBIubH54MC8AzxiLx/f4fqUzDEHFLefbpTP52bMWmlZXbkeRpmUK7o0FraYoei SSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJ5YvJqG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l13-20020ac84a8d000000b0039a2d64c513si25734qtq.337.2022.12.08.18.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJ5YvJqG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Smj-0006Rz-6Q; Thu, 08 Dec 2022 21:06:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3SmC-00068X-VN for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:20 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm8-0001zm-CP for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:12 -0500 Received: by mail-ot1-x333.google.com with SMTP id q18-20020a056830441200b006704633f258so2011840otv.0 for ; Thu, 08 Dec 2022 18:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=HJ5YvJqGLjFLD/6ZGyQihLm/5qvBw6odv+8g6Z8xs2qngJpoqlE26rHN9pf3cKWTxD fINCCXlxZi4CpugIrng4Yyl/osWAH3ToL0zh4lfB8h98fF5/VRDf0a5Z5k7X2SiJHexx WVQRzQpBjU7sf2XUf3ykeEEdZbRHPYqsKh46RvT/Ydogre+sE1gR0+5zsVchHCJTElBo CQGLSSb1BVYVsA5ZhoLryDGGUkz72Qcbl5T+M6DHUF/GqDsoIvIP+5hkmSqzyW2FhjAa 8ILs3yoaMwygnbwW6DeUgxzvBcUVgnuBKv93Pz0fqMCGr8yFyQePIMD0YY4Hu4gFvL2F 3oew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Xfk4bHnygfauWDlmIUai3p2sgHwvyBYVnNGY17EklU=; b=SBrXQEO7Cf9EWSdlq3lPKlavPcAM2bMUQpyDNYSsutHZXDEcGOlCZpEFsFpfz7X98q +/x3dAR+dIs3fJKmRkLad8PORWj7zSp7Cm1oo+50IbPAfZNKj9aBG7YG+yVC6ewlNQuw p6nhHYAQYhswjjftsrRjejeNMA7GFLOtj62pZjQZZS848XzhGrlbsAOksSnyMdhCkHix ZhQGAHOY8qx+DOgccAa8Kleizzo4JoFKgorQT4QTV9tmJlVkU5Q48r5f+coQ+5JFYmqZ M+nkE5Mq7xmZp9eJR0g8kD//eXwy63wpsxO0v3L2S3bhZmb8mS1N47gCOogNzQ/uCzbQ mPRQ== X-Gm-Message-State: ANoB5pnGDcstvD+I4OmoHLLviB1yqNG1kAF4oyYiqW1vdt0RrSoxMWlz L5I1BEB5N9AnI1wbkN9GPpAdTP4VXQfW0S063kQ= X-Received: by 2002:a9d:1987:0:b0:661:dfeb:ee91 with SMTP id k7-20020a9d1987000000b00661dfebee91mr2128811otk.11.1670551564122; Thu, 08 Dec 2022 18:06:04 -0800 (PST) Received: from stoup.. ([2806:102e:18:2efc:d298:de6f:2ed:87a4]) by smtp.gmail.com with ESMTPSA id s14-20020a05683004ce00b0066f7e1188f0sm53531otd.68.2022.12.08.18.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 27/27] tcg/s390x: Avoid the constant pool in tcg_out_movi Date: Thu, 8 Dec 2022 20:05:30 -0600 Message-Id: <20221209020530.396391-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221209020530.396391-1-richard.henderson@linaro.org> References: <20221209020530.396391-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Load constants in no more than two insns, which turns out to be faster than using the constant pool. Suggested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index b72c43e4aa..2b38fd991d 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -877,6 +877,9 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src) static const S390Opcode li_insns[4] = { RI_LLILL, RI_LLILH, RI_LLIHL, RI_LLIHH }; +static const S390Opcode oi_insns[4] = { + RI_OILL, RI_OILH, RI_OIHL, RI_OIHH +}; static const S390Opcode lif_insns[2] = { RIL_LLILF, RIL_LLIHF, }; @@ -928,9 +931,20 @@ static void tcg_out_movi(TCGContext *s, TCGType type, return; } - /* Otherwise, stuff it in the constant pool. */ - tcg_out_insn(s, RIL, LGRL, ret, 0); - new_pool_label(s, sval, R_390_PC32DBL, s->code_ptr - 2, 2); + /* Otherwise, load it by parts. */ + i = is_const_p16((uint32_t)uval); + if (i >= 0) { + tcg_out_insn_RI(s, li_insns[i], ret, uval >> (i * 16)); + } else { + tcg_out_insn(s, RIL, LLILF, ret, uval); + } + uval >>= 32; + i = is_const_p16(uval); + if (i >= 0) { + tcg_out_insn_RI(s, oi_insns[i + 2], ret, uval >> (i * 16)); + } else { + tcg_out_insn(s, RIL, OIHF, ret, uval); + } } /* Emit a load/store type instruction. Inputs are: @@ -1160,9 +1174,6 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) static void tgen_ori(TCGContext *s, TCGReg dest, uint64_t val) { - static const S390Opcode oi_insns[4] = { - RI_OILL, RI_OILH, RI_OIHL, RI_OIHH - }; static const S390Opcode oif_insns[2] = { RIL_OILF, RIL_OIHF };