From patchwork Thu Dec 12 20:48:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849758 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1152872wry; Thu, 12 Dec 2024 12:49:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8RO7+/TfZTQPOvlFEEGdDFi5sA684dsQ1pTFiGZDo42newd6pOzDUZOCyphZh7O402YVVxg==@linaro.org X-Google-Smtp-Source: AGHT+IHgTNBgR5rUrvIejTFos7a8f9Krt3LGdYjh7AeovBNePNEdd+BEu7kERtwKWjMyS6K9DJBA X-Received: by 2002:a05:622a:15c2:b0:467:5cfb:bd3c with SMTP id d75a77b69052e-467a14faa10mr28525411cf.20.1734036584615; Thu, 12 Dec 2024 12:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734036584; cv=none; d=google.com; s=arc-20240605; b=bXLswm0K/rkaSSKtqoHq4+vaE2f4fEz++bZmY1HHN3kMQRNkK8bKNvAsDcwhNiQy0f S178ph+UysuGZswa0GfDSN7pn01l+lQ99Z3k9FIb5kqBqTB94HPGJADVIhgQKUG4QMIO Lww7hxUR/Xlhx60vn1clpAZiezNKISvlJwD9vDoav8W70iGZEE8izBIy8Dp+rdEIAeIe Ak10WtCVmh0QQz0SrR8/5FFtbzUB3YHp6u0q1D2IvDKiHzcFwgLImBX6HYrzi+ZyId3h CEiHy0rFfC81NklQRpXIJ19vTDaDj4OGysJJ0WGgynxT3M1wPSl+yY3AE0VTpNLzZpIs k3oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=fg83bkK5yDHZA4CF6jEqCNLgZcxdUb+0IUzm0zJzq60=; fh=8RutQBzlcaWsmwfP8TvxyxVvuXre/9bJZ+VgDzur4BI=; b=GiMUygWgB9ASbfnso/dxkM2UBG8Ky+tFcR4s0LequqM5aUT45/p0uzIIshEZ8MDWsS S0/m6nBzBKicyFGp6ol0ql7gfj6yfSCxWDg9ETckaFNNLbqoAuGYTDVclIclMy8XtDAw P3jousYZhbaRT8BDlIjbxb6QpnD2SHgxujHic5XM1/vt7IY2ZVw9zDK8ImxDJ69qt+qB OvhDXLOETtS0rhSvG8yoHdhTk0w7SfXLNH0iPqICQXlgg1CaJC3QF9kKltlVpXSzfW+3 Ea0zvy6lBV7TDsWb8y2sbIplgX7BSjkovOGiSGCnpLfT+L09GMhtaLXXz0oxK/mH6xY5 PmhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Wi/S21Ps"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46792595f40si23559401cf.140.2024.12.12.12.49.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 12:49:44 -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="Wi/S21Ps"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLq6w-0003gw-Vw; Thu, 12 Dec 2024 15:48:39 -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 1tLq6o-0003en-V9 for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:32 -0500 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 1tLq6l-0000w1-6y for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:30 -0500 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-71e3284f963so413287a34.1 for ; Thu, 12 Dec 2024 12:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734036502; x=1734641302; 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=fg83bkK5yDHZA4CF6jEqCNLgZcxdUb+0IUzm0zJzq60=; b=Wi/S21PsJjaRbkIyxd8x6B0bFcf8oraokP/GlkXAin1rSI5sw7cxH9x2hpLgpOtk3t c2GKFWo43x/WiqoFssKlu2vKHAlRqJyqzPzWnYztNx5+Mg2/t16hxK65LICONyXkdvYB lVZ7DkWvbJm/MmHhTqA06FAMBTUAUiIb6IPOKH5oDF0Xo3LvD5WZ0rbl3CFlT78C7YII 7meZjS/Jr5O5hU9W97s9Vy5aLsw0irE/eMG2jS4YUrBwF5zo7oNI8KKUKCo1w+2SgK6X YlsvdCI4bBLvxHi6GE1mpR3S3dEOJkarOxY1S/CXl+IhipSzbzUrhX41RiGRF0faZc+y 5exQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734036502; x=1734641302; 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=fg83bkK5yDHZA4CF6jEqCNLgZcxdUb+0IUzm0zJzq60=; b=VgmDh4nFosfWng07Rbvux5HMCHbG9QwOvBEbUk5cz1ddF0ZR5FWmYiXg21opNGWDp3 GZf+iItH2XoBCq8XxioeJLNHC228C8ZWgqReRnok5qAQ+cUeIvM1ufOkfkpf7KU77C3u SofYXYKcsinF4IwB9oM6kAMrsY54odE/SKM9YOvqFuD3wDj4JbAY4ySP4fD9v+834MFd Nbc53GRBBzN88JlhZHo93eWVnNNETlNawwSpy7DpghrZ2SC8mErhmjjkvZxGCkUiXRm3 RKKcqlZRBoOON1N9IbmGAqYwsy8xZnCfhea0Al4Qiicv3LndruAreTmtraPIDNYJz7+Y R7qw== X-Gm-Message-State: AOJu0YxkAiuyk7r/xA0Eo46vdI4DPqUrzqP+ny4Lx+bfdLp9tzfuFW56 lauurXkvmmts2EoK47MC3ROfMjCoDZ11ADxcSQslfaEpbsPCC+6iCoQkLecXbDmFZfMfIHNANIF oahp+QuMO X-Gm-Gg: ASbGncu8GhdrwrTX0keuRZiEuMRcOQ4aq11RDXG4PJrrvRtu3RlFCV6BzkXfgCVOQfB SG2TAi3pr/GBgKkf69MF2af1j+BJSgnTG+Dnmz3869RspeOg+hpxgI1pm1K/gVhj4AeKrQy03yV YD78P6AE7LxLkUBqRFOY8l3GUrsa1SCH6vc4Q11HEprSjSH/IDXZ9Oo1IVS3+rBE8wAtTVZP7Xa qqL7H2Aulg90iU7uB6Yf8UFFfNHofJr7Rwki3kMlE+tvVyJ8nGxk+gaE8paWt/E X-Received: by 2002:a05:6830:3116:b0:718:6cc:b5a2 with SMTP id 46e09a7af769-71e370bec7bmr1074023a34.20.1734036502447; Thu, 12 Dec 2024 12:48:22 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f2b8197b58sm2129758eaf.12.2024.12.12.12.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 12:48:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, wannacu , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PULL 1/4] tcg: Reset free_temps before tcg_optimize Date: Thu, 12 Dec 2024 14:48:15 -0600 Message-ID: <20241212204818.2468583-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212204818.2468583-1-richard.henderson@linaro.org> References: <20241212204818.2468583-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: -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=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 When allocating new temps during tcg_optmize, do not re-use any EBB temps that were used within the TB. We do not have any idea what span of the TB in which the temp was live. Introduce tcg_temp_ebb_reset_freed and use before tcg_optimize, as well as replacing the equivalent in plugin_gen_inject and tcg_func_start. Cc: qemu-stable@nongnu.org Fixes: fb04ab7ddd8 ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711 Reported-by: wannacu Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daudé --- include/tcg/tcg-temp-internal.h | 6 ++++++ accel/tcg/plugin-gen.c | 2 +- tcg/tcg.c | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h index 44192c55a9..98f91e68b7 100644 --- a/include/tcg/tcg-temp-internal.h +++ b/include/tcg/tcg-temp-internal.h @@ -42,4 +42,10 @@ TCGv_i64 tcg_temp_ebb_new_i64(void); TCGv_ptr tcg_temp_ebb_new_ptr(void); TCGv_i128 tcg_temp_ebb_new_i128(void); +/* Forget all freed EBB temps, so that new allocations produce new temps. */ +static inline void tcg_temp_ebb_reset_freed(TCGContext *s) +{ + memset(s->free_temps, 0, sizeof(s->free_temps)); +} + #endif /* TCG_TEMP_FREE_H */ diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 0f47bfbb48..1ef075552c 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -275,7 +275,7 @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) * that might be live within the existing opcode stream. * The simplest solution is to release them all and create new. */ - memset(tcg_ctx->free_temps, 0, sizeof(tcg_ctx->free_temps)); + tcg_temp_ebb_reset_freed(tcg_ctx); QTAILQ_FOREACH_SAFE(op, &tcg_ctx->ops, link, next) { switch (op->opc) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 0babae1b88..4578b185be 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1489,7 +1489,7 @@ void tcg_func_start(TCGContext *s) s->nb_temps = s->nb_globals; /* No temps have been previously allocated for size or locality. */ - memset(s->free_temps, 0, sizeof(s->free_temps)); + tcg_temp_ebb_reset_freed(s); /* No constant temps have been previously allocated. */ for (int i = 0; i < TCG_TYPE_COUNT; ++i) { @@ -6120,6 +6120,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) } #endif + /* Do not reuse any EBB that may be allocated within the TB. */ + tcg_temp_ebb_reset_freed(s); + tcg_optimize(s); reachable_code_pass(s); From patchwork Thu Dec 12 20:48:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849756 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1152796wry; Thu, 12 Dec 2024 12:49:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXofpGcwCJV1s9V8A+nO9Zj8bSnYs318p32xB7l877is1HYh+1s7j2+mEvE3V+g8ln8yVNNXA==@linaro.org X-Google-Smtp-Source: AGHT+IF/XXTpP3mEwJxjhFMBM07lOhr5JLSMuWDgDWcx+k8WcOvKa7EmOPaVGEy9cBOaidQ5GHGo X-Received: by 2002:a05:6214:da5:b0:6d8:a5a6:f489 with SMTP id 6a1803df08f44-6db0f79d358mr23486986d6.26.1734036572561; Thu, 12 Dec 2024 12:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734036572; cv=none; d=google.com; s=arc-20240605; b=YB44bX+eT6wC6agHjgqa0qOuzh/5c6O9hLwMoV3BwaWmD+3P0pq8gqavhGi22XahD8 M2LMGu/cD8AWhOu08ctpwm351hrFHGry9Rwfeb1qms7z+jFyI5CusbEpiG4XftbwE/5X inf5PYzdDFEWJ3qelHZBChb0HCgI7zyCszsseQwLYW383rE88PgCGeDKRDFmPJ56oNU0 +aEEecvrXlEya6w53clDkKw5QG7rUnoyIQNkR9e44pzIuD1S+7S/dWhw55omw/fcSN50 ldnSZv6HhcMWNXcWJ75qLjpLDd9vsvUSbzge7+4/kKw4lu3h3vCBphpD+TvIXxwjjC5x T3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=r5mnyXonXiy4zaF6iAQaiGzQHiUuvaz9CiX/0uI1U14=; fh=N49DIQdgAnWpbsweD8WkPFyyOngNL9ahVxCVRp4iHdc=; b=d4L2emXlRL0SbnPZKoJFDZIF2RdcGF6WuQUBSK1Hhj4bQ7pGB8bqfWolYe2WMg7b9W SGCk9VSwUa7mI7IOsVxVCkYGgbjqajhzkRBzC36tZ0cvFGwKGNU16rkP3/I+c2oDiZZy Tdtlkz3Aoo700pvCrBQCh5gzi3aQ8NGEXyMNF1I/ziD9U+HZmAdtUCBGw1clzn/jyqcA PXQcn3b0EWaw5mWHe0LvwMbtwBXVMAa0HC0OnhLDBqwCQ3Kfi8f6qQnVqUM0VJEbeFOw rUpCc9HV+AzQiy0eYyDz97/tphxtWM5tEHv/IZfhQqM4KEsYSv18I8VTkQD3I4Hd3/wR +R2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K6fE21nn; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8f51b4a00si162546716d6.14.2024.12.12.12.49.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 12:49:32 -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=K6fE21nn; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLq6y-0003hW-2X; Thu, 12 Dec 2024 15:48:40 -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 1tLq6t-0003fv-2A for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:35 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0: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 1tLq6k-0000w9-NO for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:33 -0500 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-71e3048970eso458084a34.1 for ; Thu, 12 Dec 2024 12:48:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734036504; x=1734641304; 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=r5mnyXonXiy4zaF6iAQaiGzQHiUuvaz9CiX/0uI1U14=; b=K6fE21nnuqaAjKsKU0fSTDOrICSf/L4NfjpkrzhF4TuSW8EfNWJodVM0bcEe1+Gls1 Tm5hh60voOmILEs2D2XjpRVNwNExuxZAZ/wfXRlpLxJU1TuLKxOb3vJ7oTZDDgxvtlEK zXwmEr9omcFqBP87CFcr8mOQopN8PT7M3+I52spdN0CJxauJtrWDyPMggryKtaUvoHFL AuK3hCnM2SjnL49q7ki/S5zV45WVwHELOyNvFu2ykyTjwr1uIZBJt1ZNXXAGwWMd8nP8 LefSsPIivA8WJyCvGhNTzCP0EvJmFRF7p73J8j7fYK4G4hKjdAM3fwmCeIQSXfqsCYQl nnPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734036504; x=1734641304; 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=r5mnyXonXiy4zaF6iAQaiGzQHiUuvaz9CiX/0uI1U14=; b=Au1CbQ/FXOchaQomP4TloUdQDSA/2vAz9PMmpnQFkqH19six0U1zYdTqL6ZbUxLgu+ YnTxUUZDiyt6AhZ7UCwKyB11YDG3oL+xSB8wQt3HdSEKt+pnVpz6hmM/k9qcTk9Z636K 64f1rpmmYWCszXlCtP0ieEVLS01DpgxWxCweE0+tYU1LHGHrRWtdrqf5E3hp465Uk5Gt x3/4f4q5GwRazEQoTOcbCLmpBSt31SmSPHayLphMfKukToDfp+vF66DN6JevS5rXNLfI pyMkskMkI4iEVu9iJ6eyvFQw5PMX/Z0bu6OT5yNJxmFiv5dXMmYs5fwmZaAnl1Ia9uN0 brjA== X-Gm-Message-State: AOJu0YyY+qUDtFFB5YXIJfLCQQrUczasVRF0H4ao29NTWmiH2eL21Qrr K2KJYkzvsYPOOTZzog0WP1pcmFCEQYstDyxQ85H2bsZOWN5Q8eYoOs2qMErP821nTjxkEp4nZoy BWGwaTfyu X-Gm-Gg: ASbGnctnAwdn8a6zX1JdbYuk7ypla2WCc534XtQTf+Dxb4yc57I2kwmzONKDANsOgii DCIhrVHsK8sRRbJfOoMVVSI4X2gasDd1YS5SMW+9lsU7Fl7NyXa/6Rb3P8TtYOBi8nqv9g0Hbat aFiNmVjVraQhk2vUeuE/tEXX0XqyDxxQu+sMJkTk+uhdEbta6tOwg/+cm+e54Bw4O3/lUGzHYtl iEqgDjyj5f6WHIn94C/ah3c+tdHsaCYe1+c0LV77v6M3/nvly6mAFZ1WSifsfbO X-Received: by 2002:a05:6830:4490:b0:71d:5f22:afec with SMTP id 46e09a7af769-71e36ea1c78mr1161819a34.12.1734036504004; Thu, 12 Dec 2024 12:48:24 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f2b8197b58sm2129758eaf.12.2024.12.12.12.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 12:48:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Roman Artemev , qemu-stable@nongnu.org, Denis Tomashev Subject: [PULL 2/4] tcg/riscv: Fix StoreStore barrier generation Date: Thu, 12 Dec 2024 14:48:16 -0600 Message-ID: <20241212204818.2468583-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212204818.2468583-1-richard.henderson@linaro.org> References: <20241212204818.2468583-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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 From: Roman Artemev On RISC-V to StoreStore barrier corresponds `fence w, w` not `fence r, r` Cc: qemu-stable@nongnu.org Fixes: efbea94c76b ("tcg/riscv: Add slowpath load and store instructions") Reviewed-by: Richard Henderson Signed-off-by: Denis Tomashev Signed-off-by: Roman Artemev Message-ID: Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index f8331e4688..96f9a7e348 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1624,7 +1624,7 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) insn |= 0x02100000; } if (a0 & TCG_MO_ST_ST) { - insn |= 0x02200000; + insn |= 0x01100000; } tcg_out32(s, insn); } From patchwork Thu Dec 12 20:48:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849755 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1152712wry; Thu, 12 Dec 2024 12:49:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW4hcHmj2Rf9uLh1ORwZq4fxNXGJKJwZoNkkj5HowJUfAPdBpzX/ShPGEkp+aFNDgB92dD07Q==@linaro.org X-Google-Smtp-Source: AGHT+IG+WdeY7qq6WcM84PHaSQjJ9qGyu8jTDzsOBoT+rId7on0g5WWBFXr+BykD82YwGbWSd01u X-Received: by 2002:a05:620a:7186:b0:7b6:6ffc:e96f with SMTP id af79cd13be357-7b6f88df145mr255962385a.13.1734036559041; Thu, 12 Dec 2024 12:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734036559; cv=none; d=google.com; s=arc-20240605; b=cjFt3hqY8Ys0qjNhz0mUABhgSLVWQ6ijn4pB+2ygxsiWSjbauuenj05mQrozUrhTf9 a//m931ibe520vrZKyI1CJ5re5aYfDEmVnXv2/5kTxjiYY90hc3gpkyi2npDll1kie48 3G8k3M2kgtL4M4aeeJU7naWefmhzkIDJVh6iSmRdNPCcyKHyQkbdhLGc5QInHAmlJZfX pl9XuoVHLuSjayoRG7US24qENOwsDxs8cd6d/yeu7VfBGnMghfzffd1zHIosriW4l1Ig Ff7Br/gvUAVMdSqZiA5heL5MfwZXxx27FEWlqQ/drnCIe4EA75WoEl3rqmHBrLzjx6SG dyiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=mSpM/cySkQR88JEHiMbsxZTNBsH+C3Qxc74QedSJwMg=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=iCwDNhY7u6gYvTm6fc9iFWsQPfLi1Fb/6T+1+p9xCYDAG2+ajfDe4U7EKjFtH7dvuN akGePEUowZqWpTQ5L3q4LDGTvv/yHVu4J9Jhx0TFuHsZtrkViJxMWO4BAoHsDHuBv+HO e+SF4OiGzKoMJivtdwgWUKX9tO4Nw9f7rFxxj5cE80SCVYETD4/J2lBaxYhGhBrofizr MvhObxb0o9YsbYj8q8mck/jSOB0LIKkQx1RQPWBxKnJLPWqEdk9k1kTgeVeNy3VXbKob uvZUyY6NvIR6RMIBW3uzjByq/NIju1ee/2FsvmVDQvWmXcAxLnnzKC3xqccriAdZo/Ur bnqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fYlOflId; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6d87de403si1276238585a.403.2024.12.12.12.49.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 12:49:19 -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=fYlOflId; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLq6t-0003gA-Qc; Thu, 12 Dec 2024 15:48:35 -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 1tLq6o-0003em-Tz for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:32 -0500 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLq6k-0000wN-Nj for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:30 -0500 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-71e1158fe3eso564972a34.1 for ; Thu, 12 Dec 2024 12:48:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734036505; x=1734641305; 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=mSpM/cySkQR88JEHiMbsxZTNBsH+C3Qxc74QedSJwMg=; b=fYlOflId2p1z3a9XQIUvtAom4SGareHjLmDElGSJ4a+CQcr4bLwpQ0cLvb3+YT8dPl 3NE33OyVOr8JXSKpmAPXL4gYYCuYbb2jK0Cj3zD08X1XqiAemOLSz47I7OCbN3AwPMOK QZjd9/mkAVu7QDox3Ud+Jg04sB+0HVmARzPc84OyIbWjUBD6RmYLs+BEtZ0MSoMMWwVa oiKdoHge9l9/g8MQpTJBlsAuQwFI8KxYB6P+dTV+uha829zKouk4rdTuyUY15iTOAYwu s0/+qsChfeLwnK3XiUfKBUMWG4KSKSenEb3fP/9oGZmWUuFujfLToNfDi1KG1nkhTqPw m1cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734036505; x=1734641305; 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=mSpM/cySkQR88JEHiMbsxZTNBsH+C3Qxc74QedSJwMg=; b=jmEIDM5ktTWK8wf00FyzQnJ3clg4OHwzZlup1w72ffzdt4giz+HRe4Z3w7TBKbqbei lYs1z5Egz0UTe1V2DDXz4RdMtwZVSCg0FN4izZa8omqFOe1LAiYE8bpznKFUgHuXTlm+ A8JjO8eFnR5OMaLWnEiSMO9yVWPT6yj9lUsAqQ/qNZGUhDYfaoJYP81AhuB6wRMGbHME nWYqxh89x3CNiziOJnrH4N0/BbboXhP4JssLKeP2RBEsSKFHmNbxKGJEz6AeeykMcFma JA9W5DuQNL+v7OGdWhVyLF96G1w2N0/7YXHA7MJGNNYtDiDyPTVRqCDP8szGtoOjdJ9b qtCg== X-Gm-Message-State: AOJu0YxQ/7zrZEd5jyrT7zBmcsSqYKr2mvNRDX2/qly/vuU6YTqd+OVK CT9OGueyciNRVHu9gApEdH8sURJSjRLj78nkhK5KhikCS03eupu5AvCJd1odj0ki70SCqlmMnmt U9iK3Jl7h X-Gm-Gg: ASbGncsE8oa5dtcJto+1rOv/uybArW1Sczmelm4C0TOslN/TnyDG077WL0Nsxc4gTSD opLVVE7TkxfebMw767Fv0yd2hOT1QI7G/IPZeKaWPkiRv9fGXaXXYOgltr8bwKawQdYxv5DZyDH cm7+HuTWNyS1obRKBpsBsvELa+S/RGsp0LMt29T3af0bh6e0iSrOsCCk8A3+HdWZ8eigE4obrLU Nn6aaUecarE9ofSDpBmqrJ3Uk+bg7VLDWsCfn+j9pKfdn34jZuROGV+i4MpqeRd X-Received: by 2002:a05:6830:490c:b0:717:f666:9559 with SMTP id 46e09a7af769-71e36e862acmr1008373a34.9.1734036505327; Thu, 12 Dec 2024 12:48:25 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f2b8197b58sm2129758eaf.12.2024.12.12.12.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 12:48:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] include/exec: Introduce fpst alias in helper-head.h.inc Date: Thu, 12 Dec 2024 14:48:17 -0600 Message-ID: <20241212204818.2468583-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212204818.2468583-1-richard.henderson@linaro.org> References: <20241212204818.2468583-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.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 This allows targets to declare that the helper requires a float_status pointer and instead of a generic void pointer. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/helper-head.h.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc index 5ef467a79d..bce5db06ef 100644 --- a/include/exec/helper-head.h.inc +++ b/include/exec/helper-head.h.inc @@ -23,6 +23,7 @@ #define dh_alias_ptr ptr #define dh_alias_cptr ptr #define dh_alias_env ptr +#define dh_alias_fpst ptr #define dh_alias_void void #define dh_alias_noreturn noreturn #define dh_alias(t) glue(dh_alias_, t) @@ -39,6 +40,7 @@ #define dh_ctype_ptr void * #define dh_ctype_cptr const void * #define dh_ctype_env CPUArchState * +#define dh_ctype_fpst float_status * #define dh_ctype_void void #define dh_ctype_noreturn G_NORETURN void #define dh_ctype(t) dh_ctype_##t @@ -96,6 +98,7 @@ #define dh_typecode_f64 dh_typecode_i64 #define dh_typecode_cptr dh_typecode_ptr #define dh_typecode_env dh_typecode_ptr +#define dh_typecode_fpst dh_typecode_ptr #define dh_typecode(t) dh_typecode_##t #define dh_callflag_i32 0 From patchwork Thu Dec 12 20:48:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849757 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1152863wry; Thu, 12 Dec 2024 12:49:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVFLTYzEOTH6d8G/d4LVgkR/wvUhs8A2f2VMfRQjKu9WY1drAeKgQ1/fZcW6+2opk4ZoGtX/Q==@linaro.org X-Google-Smtp-Source: AGHT+IEp5fm7BhbZA2gOqeavRT0b8GCaP9hat/MoiL2EM/2Ps9lN52IyWZWldkEUNQDxbFkqSLgg X-Received: by 2002:a05:620a:269d:b0:7b6:704e:3529 with SMTP id af79cd13be357-7b6f89a1a1fmr291573385a.46.1734036583325; Thu, 12 Dec 2024 12:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734036583; cv=none; d=google.com; s=arc-20240605; b=kzai2zVPGezrLC92Az9byMKFx950uPQXlZTBEWycyp7B+Vt7u5zr+XTcBjKL1bOenx Ctx5szHqlOecNMLfjMX/eevabJjdBX9gSci5VnkB2JgbemnJ3kE2Ez4LfY/a2AZCdMfQ wJ66+/RrpOl6y5xklBrdGJ4FYoq9eUd9v6O/8nakwWEbKwPtlfb2rvEzZgK3FAOU8Gf1 2VN8L6PclC5QCMPXz+vI+iEa2xL8oyIhdfmL+K2BidEGTdWny7KyCSx7eqHOONso1rSJ fULdu6Ovk4S27zh9/jqLVBl1mtrFzaXYS1fQgsVC3oB0UACKNCqgx/3sa9PxV7tWvSd0 IKnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=LHgc1l1qpRSvTvA+hPA/du3JarE2ikdn84gpIsEZ7/E=; fh=i/pWNGcx7KiR3ewgypxpPkuORYlkCnVXLqKVm9/UgNc=; b=foYUfoIgJ0Pq5ThsqM3/nSEV6YwA0UHySgbRYfQXaPV+m6v92yHq6BJkcXatCUbaYk 8wVnoOobE9Sh3QtyCi0Nl3MrxtM6UCNof3fiyfJmCZzKOB7CzVYdYCNTCzPoSF2wrB0/ 4FaX93SA4jskZnceRCRQpb/OZiXUJYbtUkmOVWPDaOVQeIVz7kwuiUbrZSXXHKyasGg8 YOx6Tj/SCwnsQnzeNJAOvqKF8zvNNhNthCaoL5ssCqct+akZAXVsyLR4GdmAeqyaqez1 R5qdWcAS4Ox7Vfty4a8CgVDIL9MFRJw91IyZRiQFgdFHlqlyoj/5mZ4nTVBjqMBmktPj 9u2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G3tfvUtl; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6b5a48170si2369552985a.71.2024.12.12.12.49.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 12:49:43 -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=G3tfvUtl; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLq6x-0003gx-0i; Thu, 12 Dec 2024 15:48:39 -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 1tLq6r-0003fc-3d for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:34 -0500 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLq6n-0000wT-OF for qemu-devel@nongnu.org; Thu, 12 Dec 2024 15:48:32 -0500 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-71e3005916aso218952a34.2 for ; Thu, 12 Dec 2024 12:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734036507; x=1734641307; 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=LHgc1l1qpRSvTvA+hPA/du3JarE2ikdn84gpIsEZ7/E=; b=G3tfvUtlWQv17YMNSSy7Dlv94/9/DxKgFZeQHP1PF3vxXe39Gml3vXZxtOIDhil+Pi GOIvZZvqVbNR9sqYfbqfbz9mKhchkVcHd1TPoiDr47D13CgRLJzImjCRLw1f2Dk2Za6k LcMUf7303c6VED72jKj5dA3RrfDCRbWwg3qER0xctLMihRvbVkBXDm86ptZEEFUmK7Ve 2RqLL4obVIRnln8xIQQ6S8Wxly0zhxgp52Y13ng3T61cLylxBm2bXGy4d3USxJ5fitF5 /dpQ6JgFtzmRPbrlSFSWzTF+8X/M2QgUptAsGWJDZ9wxipeUmMbAABWtoBe4oRGV1j7I CQYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734036507; x=1734641307; 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=LHgc1l1qpRSvTvA+hPA/du3JarE2ikdn84gpIsEZ7/E=; b=SuJ8LCqABkZTj30GWoWBKCc7T1fPPF96UHKXn38Lg3iuYdVeTYejXYJMfUWiaLXdot oYUFrQ9utEc77JmhMdFq5Pp+rXVIKM2mNEYhmqyZpSrlsaQDtnsUjuYzaa+CLdDSOJOB XiPE17XdgksnSfylBvPJTMeEzlNdMABEDEwIz/KWz9in6pP8eLD+UQkqfu3EZizkVwOe m75fCUd4GgZtFl8OZfKPnA57vQfXNsFD1uL9QJ0LNeUdyovOpexBONf/RdgYY/ODSAKp 2s9SvzE9xfW5v39rbNXjnUeJ1zJz7ukh95LbCtTUChhNixKQ2OJgxP5WwIyhFqatkm8V bbGw== X-Gm-Message-State: AOJu0Yx0lr9/XkfzaT+nZSXG4rhssdALUw5usTScqgUFyo0qG3k0n64f TidSwVrSBYY44YafmUWpfeLc1RR8sXOMzQChLnW4Wze/2rkr04ZQ0oZ9glXKIkTyk+6/3699KOV /wVw2VpkU X-Gm-Gg: ASbGncsMEPV6rxsOo78XB5OSNe3OW3DCQlrubwsXjWoJTGT7Xx6mDvEfU4xK5u7TMlF 4fczdhZBSXu/LotMDbZWDK87oky9B+fUJin0yhIpC9Aa+R8k5tJL1YqVAHzl828J3FTRux2orUQ y+dxgASEvtBSMl1SDl0NU8vgzVxZUU53BuA3dErXqxPLiREi4kJwgyOplFkU0S4HHGFp7RzipHV 4Zmu49BBAvySUsiGCGYGZedBm9Nn8QIR1l3gV4VtU7IKTmG05Sjl//Po4ZveZyj X-Received: by 2002:a05:6830:658a:b0:71d:4385:6662 with SMTP id 46e09a7af769-71e37136da8mr1304267a34.27.1734036507400; Thu, 12 Dec 2024 12:48:27 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5f2b8197b58sm2129758eaf.12.2024.12.12.12.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 12:48:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 4/4] target/sparc: Use memcpy() and remove memcpy32() Date: Thu, 12 Dec 2024 14:48:18 -0600 Message-ID: <20241212204818.2468583-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212204818.2468583-1-richard.henderson@linaro.org> References: <20241212204818.2468583-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.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 From: Philippe Mathieu-Daudé Rather than manually copying each register, use the libc memcpy(), which is well optimized nowadays. Suggested-by: Pierrick Bouvier Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20241205205418.67613-1-philmd@linaro.org> Signed-off-by: Richard Henderson --- target/sparc/win_helper.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c index b53fc9ce94..0c4b09f2c1 100644 --- a/target/sparc/win_helper.c +++ b/target/sparc/win_helper.c @@ -24,29 +24,19 @@ #include "exec/helper-proto.h" #include "trace.h" -static inline void memcpy32(target_ulong *dst, const target_ulong *src) -{ - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - dst[4] = src[4]; - dst[5] = src[5]; - dst[6] = src[6]; - dst[7] = src[7]; -} - void cpu_set_cwp(CPUSPARCState *env, int new_cwp) { /* put the modified wrap registers at their proper location */ if (env->cwp == env->nwindows - 1) { - memcpy32(env->regbase, env->regbase + env->nwindows * 16); + memcpy(env->regbase, env->regbase + env->nwindows * 16, + sizeof(env->gregs)); } env->cwp = new_cwp; /* put the wrap registers at their temporary location */ if (new_cwp == env->nwindows - 1) { - memcpy32(env->regbase + env->nwindows * 16, env->regbase); + memcpy(env->regbase + env->nwindows * 16, env->regbase, + sizeof(env->gregs)); } env->regwptr = env->regbase + (new_cwp * 16); } @@ -361,8 +351,8 @@ void cpu_gl_switch_gregs(CPUSPARCState *env, uint32_t new_gl) dst = get_gl_gregset(env, env->gl); if (src != dst) { - memcpy32(dst, env->gregs); - memcpy32(env->gregs, src); + memcpy(dst, env->gregs, sizeof(env->gregs)); + memcpy(env->gregs, src, sizeof(env->gregs)); } } @@ -393,8 +383,8 @@ void cpu_change_pstate(CPUSPARCState *env, uint32_t new_pstate) /* Switch global register bank */ src = get_gregset(env, new_pstate_regs); dst = get_gregset(env, pstate_regs); - memcpy32(dst, env->gregs); - memcpy32(env->gregs, src); + memcpy(dst, env->gregs, sizeof(env->gregs)); + memcpy(env->gregs, src, sizeof(env->gregs)); } else { trace_win_helper_no_switch_pstate(new_pstate_regs); }