From patchwork Mon Sep 16 08:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 828993 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4187:b0:367:895a:4699 with SMTP id ei7csp681790wrb; Mon, 16 Sep 2024 01:56:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVL4JRnX8Y77r4n2EBzyfji/ph/7BZAtTYPOOLCJaVLgrrcmq0PiWaTetcIpk5BHYLs+eGMlA==@linaro.org X-Google-Smtp-Source: AGHT+IGWFLOnB0haidxIfNm/4999r7cRhxYwC2LlYIqi3BnCOLmVHct5gPC40dVIkkZk2VD8xHb+ X-Received: by 2002:a05:6214:5549:b0:6c5:8601:fdf7 with SMTP id 6a1803df08f44-6c58601ffd4mr143708046d6.41.1726477016001; Mon, 16 Sep 2024 01:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726477015; cv=none; d=google.com; s=arc-20240605; b=iuTxJp70tV+N5mjPLEWu9bZbxIGpVE88AQFRwcfKlgMnUs3BK/E9OfHrsGlrAgdqXa bm26HbdA70GLqN6kucPkRqchn5rmWgCRd2v7vSsYd1fDP5dIcoda41x9N+x0EQDgwQmx Bvp0rBu1kcPtNGOCLHrpX6Ww7Dh2luG/ibCM5hhNNW6mU4xsw2mBIx23DNVQuR2ZR52h Zg/4PpoAzCXBHb+jkHsj59XqC4G8u9sPBs3jBgFSTIeYbtfeQjFZ1MfiR2kqdAol92DR HcPw/4R9s4EdNnaI3d00JbZ98H+vj/ilM1fGCW8Qu9Xtu1cSfSJv1yyBHKzHOJCCEvai x4EQ== 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=4Wv8Q736t11KQJ7N/ppo9YJRYi/AHu9klf968DMJMmk=; fh=ATDHygEnrhDZDytw2YSa+GgRs9jfnpjrC7XifhYWFyU=; b=efXqX/alfcIjHasLMXt3Je0btwM+TiMs/MEemlhPfOrhOx3bKvIt+awQ0HAx0Q9LQk yhWdz1MKBvn/kQEsjMHKUhn7ckZcLUM2aGbpdCy3B5cTFIjCU25brAKu0Wv8D+Zm7J95 L5CSIHb33+5CUkP5KGPYl0xpZlgc1/r/KH1dG7pkjTEeoGdfU7AOUTqMWM2tOoS6wt7R AKg8U+kN4fnGWySMlIc8ClRUnwJjkzXsf/U86vQNjaFAiupC6pxKg2reWiaSVWUTtX20 kYk9+7rfhce8ieqmFB/vSKwPtOVroGQ3FcQ1lWkYIS1Bp9yF98TQQq/LRytwtVLQksoV 2Yrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xh4MlOJA; 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-6c58c6210e3si52649066d6.95.2024.09.16.01.56.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Sep 2024 01:56:55 -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=Xh4MlOJA; 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 1sq7VZ-0001rp-Sz; Mon, 16 Sep 2024 04:54:57 -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 1sq7VK-00010w-2K for qemu-devel@nongnu.org; Mon, 16 Sep 2024 04:54:44 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sq7Us-0005EH-FV for qemu-devel@nongnu.org; Mon, 16 Sep 2024 04:54:41 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42cbc22e1c4so23832355e9.2 for ; Mon, 16 Sep 2024 01:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726476852; x=1727081652; 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=4Wv8Q736t11KQJ7N/ppo9YJRYi/AHu9klf968DMJMmk=; b=Xh4MlOJAHndo67/P7Ljlh3F/xRGgdZDfA1iEG8k/DSPKtXAp90h44T9BvILdtVquYc iUJdm6dUF7Yamoq8U1BrQBdSC08d2zzA24wO+TgdOG+HHmnXH3/pqDVN5xznkNTOQXFP tUOirf/qSYMXyuD+RrC92aaK1v7kPAp1hGeSrggeyIx4jOgOm2e/JABB67O4nbimDDUz FR80uuMHDgr0tR5ZzWXN9UktSZ9cZ9x0ATTbyEvqZ7afX7P4E3QjS6oMVr6YDYk09/+T CWVgC4M7KuKDuO7L3ISxlgb+SYmaXQYyqvcrfyUsxAJ361hxRasvUi2tp9R3cq1HkfpS R2Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726476852; x=1727081652; 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=4Wv8Q736t11KQJ7N/ppo9YJRYi/AHu9klf968DMJMmk=; b=mP52lh+zcGEHLBjR0I5bC/UQtK9mbk+1SNhQZ5klfAmHArkJ3VkK0SD0N5GRFQHJjq ra8IdhuME2I3LqOAnrLqf8fUWIFSejm6K4CbldTxAK7y/0+KMCkycF/D/MTBe0rsBKHL XV6f/NHkunZ7LCxqoCaQCbWcB6cgYsD8LNCrUk9brcr52T53MZ9omeUAVVdXGqFFnEDq lWCl55HClCffGIO3hm4FKZjNFiX1Q+EuXiSyisRmIfRBazs9P8pMB27v+NVQaHr/868I O2MMEonQcCsU1TGXvDvMA9I77pogCHJbQfrTK8YUkD0mZhDL/ijuwVZjyuGiaT18Mh10 bfWQ== X-Gm-Message-State: AOJu0YwysIiyxvuma1p1BpUu4EXES9TlZS7Z8y2FKFEOiLQdowKppRVc Yt5gaXGK/Il9M7eUBPNAaCFFAZgDt142wHlNWnDuywUnep6uGQSPuIkktI+hNJ4= X-Received: by 2002:a05:6000:1546:b0:374:b5af:710c with SMTP id ffacd0b85a97d-378d61f0d6cmr6976677f8f.26.1726476852125; Mon, 16 Sep 2024 01:54:12 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42da22d8212sm70383055e9.14.2024.09.16.01.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 01:54:07 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 599BA5FC6C; Mon, 16 Sep 2024 09:54:01 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Thomas Huth , Richard Henderson , qemu-ppc@nongnu.org, Ilya Leoshkevich , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Alexandre Iooss , Eduardo Habkost , Daniel Henrique Barboza , Yanan Wang , Nicholas Piggin , David Hildenbrand , devel@lists.libvirt.org, Mahmoud Mandour , Zhao Liu , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier Subject: [PATCH v2 11/18] tests/tcg: only read/write 64 bit words on 64 bit systems Date: Mon, 16 Sep 2024 09:53:53 +0100 Message-Id: <20240916085400.1046925-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20240916085400.1046925-1-alex.bennee@linaro.org> References: <20240916085400.1046925-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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, 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 While the compilers will generally happily synthesise a 64 bit value for you on 32 bit systems it doesn't exercise anything on QEMU. It also makes it hard to accurately compare the accesses to test_data when instrumenting. Message-Id: <20240910140733.4007719-21-alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier Signed-off-by: Alex Bennée --- v2 - >= test of __SIZEOF_POINTER__ --- tests/tcg/multiarch/system/memory.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c index 8f2371975d..28080767b2 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -163,6 +163,7 @@ static void init_test_data_u32(int offset) ml_printf("done %d @ %p\n", i, ptr); } +#if __SIZEOF_POINTER__ >= 8 static void init_test_data_u64(int offset) { uint8_t count = 0; @@ -187,6 +188,7 @@ static void init_test_data_u64(int offset) } ml_printf("done %d @ %p\n", i, ptr); } +#endif static bool read_test_data_u16(int offset) { @@ -254,6 +256,7 @@ static bool read_test_data_u32(int offset) return true; } +#if __SIZEOF_POINTER__ >= 8 static bool read_test_data_u64(int offset) { uint64_t word, *ptr = (uint64_t *)&test_data[offset]; @@ -307,11 +310,16 @@ static bool read_test_data_u64(int offset) ml_printf("done %d @ %p\n", i, ptr); return true; } +#endif /* Read the test data and verify at various offsets */ -read_ufn read_ufns[] = { read_test_data_u16, - read_test_data_u32, - read_test_data_u64 }; +read_ufn read_ufns[] = { + read_test_data_u16, + read_test_data_u32, +#if __SIZEOF_POINTER__ >= 8 + read_test_data_u64 +#endif +}; bool do_unsigned_reads(int start_off) { @@ -476,10 +484,14 @@ bool do_signed_reads(bool neg_first) return ok; } -init_ufn init_ufns[] = { init_test_data_u8, - init_test_data_u16, - init_test_data_u32, - init_test_data_u64 }; +init_ufn init_ufns[] = { + init_test_data_u8, + init_test_data_u16, + init_test_data_u32, +#if __SIZEOF_POINTER__ >= 8 + init_test_data_u64 +#endif +}; int main(void) {