From patchwork Wed Jul 10 03:28:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 811759 Delivered-To: patch@linaro.org Received: by 2002:adf:ee12:0:b0:367:895a:4699 with SMTP id y18csp571287wrn; Tue, 9 Jul 2024 20:29:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUVKYgKmOYdMrtFYOqc6Zm7FXmrps0otXcr1872tdlABVAIfUiqpkq+5mwPPGxRgcFcYY8o2ZdmbjY9HZ+FG2Gs X-Google-Smtp-Source: AGHT+IGsOrFauMDK7Kbkai3lwK10IcN8K8XR0wXx7aaJMEGmd9ftYZgQhQs/wsYt04Nvjrev9NJl X-Received: by 2002:a05:620a:201e:b0:79f:b36:4bce with SMTP id af79cd13be357-79f19ae2fe5mr519534385a.68.1720582167031; Tue, 09 Jul 2024 20:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720582167; cv=none; d=google.com; s=arc-20160816; b=bEONluMrLcHdFEeS5yl45veknWtghzN76YAd6LRIRymU8o5Rk5Cn66v61n6a0Q8Gus ittqc4SKmDeJB7RsLLjFqts+xETMhstpmIG6HKKlaeFw/S1JLGEa+2B80ge3qZIEZpx9 LMO7wZG0bMdv4OaSprNASq57wCE/xmoIcbfpMrBRTywzCXV0flV3nU55NfyTLhH17R4s dPE3xlYSNshy6S1CQa3TaX1w6HD2dImfHUK8h0qJFfCzrye/7tNMk8/9Sn0fMxaXO+TL 88kXjdbWQHeYtqHGpS5k1YBToIwyXGYa7LcjyNem5jfaRfl6ruRb1aFWif18jmlRWofb 7eeg== 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=EUYGnB0iFJYfFcduqyWfe3U13R89iRgamOgAr45s1Xw=; fh=ghNV7mL7MT64gEZ5PHgzOSgxQoCZ3IZKAHIIlbKGaqE=; b=MqApXImRnVB2U326WYrvr1wE7inWObCkQZjtey7rqQr7U9eLqJ7rggvN7v1bV2/vT2 tezYZY30X7J7Ih7P5Wk7Y25fvs8/JFj7yaDFULw7jANQRK20rj030npOQaGZJjG+MUTG A+g6kSKd1aJiEBsNRdwXqT8KRAuP7tCj2mdEtP0OWTfb0xHrSLOkbW0Haa0cbVWDrVVF rZKoKiy2d5dlhXpZQBh7yDW//FN+oWW/6yRptTErCD3u0eCL25xQ2hzSTwL7YIMpZLj5 dSbnaUt4TAGahDvrfad3bSFW5uTi75ZVsxYYDIchwXWpptoLSULLQHwJwfmyPZ31zViJ ZtRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M7VadgY/"; 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 d75a77b69052e-447f9bef206si38321831cf.624.2024.07.09.20.29.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jul 2024 20:29:27 -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="M7VadgY/"; 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 1sRO0Z-0000xU-UW; Tue, 09 Jul 2024 23:28:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRO0Y-0000qf-Ad for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:42 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRO0E-0003kn-ET for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:41 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-7035d5eec5aso2388359a34.1 for ; Tue, 09 Jul 2024 20:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720582101; x=1721186901; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EUYGnB0iFJYfFcduqyWfe3U13R89iRgamOgAr45s1Xw=; b=M7VadgY/pD2ao240HXSVry1FsnDhLFG3ztsQYfsCxr57ztMJo0QLS1aVFSyK8/+05D x+aJy1tDByGwujjvnsuCejWWHtYIeu18P1LSgBbX+Wf2TkR9v1KL1/cHO3B2D2RDrruM LIjhgxzTW8Hd10KpcJ6qytRvW3/UXyqlqn9ZdGE+S47v1r7VVam/+1/V/5YQr7rCWsyv sxqkylsJYOTicPqoZGeeKfoUnZKyvG6BCLY7TKi1HGaUabMH96k1SRsWoKoVgsPA8Lfg 6+nnzmYmnPaCTtxmTk6L0tTC/KQeaCdMmUqip5TXxEbDU9NMn/t5x4m4KYhGn+Q6pJcb xK9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720582101; x=1721186901; 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=EUYGnB0iFJYfFcduqyWfe3U13R89iRgamOgAr45s1Xw=; b=Ih2gLN4zPGZSJF28azzHMXJ/RSmtW5Oq+fWap1qtXxvcosInsXCJaotPTFMMJoBS39 VVMcfjyPWWm+8XFXlmaHEQPWkspUaS6JVeJUpsK6ddDITLO+Qg06SY4DZeVcU6v3a5hQ j7s5N9uFqgiRFN/aWLksvTuAJCFsM+dVfTTakXK39WJmsEtvwxEKDj2Iwf3Pd0P2QKWK xSone9ADrfnTuAtE2Da/Ri8cJxohEm83fWcXr9Sv6wbxm4Eq/huQaxN9+FeN1TAWpMPB /dv8FNzoAV8v/d/C1oIKAySMG3OghQNlvTr7Jl3zMgmhSxya2+WLe9ZR0u1f8IerSWNg G0oQ== X-Gm-Message-State: AOJu0YzSOHUjoNLaB4Zdc/MovMk8e1csmBaiiyyjoAJDUim93/608U2t qHR0apPELgEuQP8+0iy7QN0g5aCyQaGU1754BjzxZtls0QWqQjjoqPI2f4vsK2as+6rR8VEJWxr YdS0= X-Received: by 2002:a05:6830:19d7:b0:703:65ff:5163 with SMTP id 46e09a7af769-70375b4057cmr4621107a34.26.1720582101246; Tue, 09 Jul 2024 20:28:21 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438f5679sm2687280b3a.90.2024.07.09.20.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 20:28:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, balaton@eik.bme.hu, max.chou@sifive.com Subject: [PATCH v2 05/13] target/ppc/mem_helper.c: Remove a conditional from dcbz_common() Date: Tue, 9 Jul 2024 20:28:06 -0700 Message-ID: <20240710032814.104643-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240710032814.104643-1-richard.henderson@linaro.org> References: <20240710032814.104643-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.google.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: BALATON Zoltan Instead of passing a bool and select a value within dcbz_common() let the callers pass in the right value to avoid this conditional statement. On PPC dcbz is often used to zero memory and some code uses it a lot. This change improves the run time of a test case that copies memory with a dcbz call in every iteration from 6.23 to 5.83 seconds. Signed-off-by: BALATON Zoltan Message-Id: <20240622204833.5F7C74E6000@zero.eik.bme.hu> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- target/ppc/mem_helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index f88155ad45..361fd72226 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -271,12 +271,11 @@ void helper_stsw(CPUPPCState *env, target_ulong addr, uint32_t nb, } static void dcbz_common(CPUPPCState *env, target_ulong addr, - uint32_t opcode, bool epid, uintptr_t retaddr) + uint32_t opcode, int mmu_idx, uintptr_t retaddr) { target_ulong mask, dcbz_size = env->dcache_line_size; uint32_t i; void *haddr; - int mmu_idx = epid ? PPC_TLB_EPID_STORE : ppc_env_mmu_index(env, false); #if defined(TARGET_PPC64) /* Check for dcbz vs dcbzl on 970 */ @@ -309,12 +308,12 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t opcode) { - dcbz_common(env, addr, opcode, false, GETPC()); + dcbz_common(env, addr, opcode, ppc_env_mmu_index(env, false), GETPC()); } void helper_dcbzep(CPUPPCState *env, target_ulong addr, uint32_t opcode) { - dcbz_common(env, addr, opcode, true, GETPC()); + dcbz_common(env, addr, opcode, PPC_TLB_EPID_STORE, GETPC()); } void helper_icbi(CPUPPCState *env, target_ulong addr)