From nobody Mon Nov 23 04:44:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1792436226; cv=none; d=zohomail.com; s=zohoarc; b=GpwuEkGDAeSfwTXN6606eSx+goonSTSnsDV0ZksL1o9uUxclJvIecA+gwsvBovox8CAtEOtVE+Sw4TF7uBGxSJ5LpLJhB+yNPJuY+JnNeeahIuLASEbNIyYX7daNrxB2WlAaB/X+S6+5QiuCWehPYhW1WXg1h3Mckh99pPmRkcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792436226; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Q9V09zFHk1PvlLKWsM5WFGopCmm4gYe3kBwRMJq7X14=; b=MOt1BMliKtXqsd02C1QfGqmzvuca4cTZ9pt3WWWBuks/HBTeftv1lvwm/mneN9t6kmV9GvzdptoYDawUtEvvnN8HxiP/D47JY9HITkrq8eeDV/dANmTD8Do3Sw3cKHNztKaPAKvRbfHqPcol/nfrUW7uEFKsRTTsjrFsC/8d1TM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792436226690765.0339009026853; Mon, 19 Oct 2026 11:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIsWu-0007qe-A3; Mon, 19 Oct 2026 14:56:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIsWr-0007po-Cb for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:56:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIsWp-0000JO-8f for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:56:12 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69JFiRSQ018806; Mon, 19 Oct 2026 18:56:09 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4hc0nvv5s1-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 19 Oct 2026 18:56:08 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 69JFZ5XE3125152; Mon, 19 Oct 2026 18:56:08 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4hcnjgxvrp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Oct 2026 18:56:05 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 69JIu24N48169320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Oct 2026 18:56:02 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30EA720043; Mon, 19 Oct 2026 18:56:02 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01C9D2004E; Mon, 19 Oct 2026 18:56:02 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with SMTP; Mon, 19 Oct 2026 18:56:01 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id DAED61612ED; Mon, 19 Oct 2026 20:56:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Q9V09zFHk1PvlLKWs M5WFGopCmm4gYe3kBwRMJq7X14=; b=n3ZVH+I+8J9RHDvawooa/gXXE/KeY2+f7 6XZnfJz6nb0TAoxRwfTr/LPj0VMqZCFT3vB8VX5OGfEAmUoKiIgn8aF1c7V66/ql fWWjNUtWtm50uq4olfg0VvbXoVrSelwhMo4w3gJdYub7hQB4xWUUnHqzNOpmgMhz 3In0Ra3uYjyM0QdElobV1mw+UzUkGp4EPi2iyZ7eYCROHVp+C1hl/bc26fII2XPL whnYd/8ELnBnUBN6WNdE+DShWiO5h13LTVXel6OerozzbBfxs5XIJcMdUU2e84oE UELGE/DoQag2kAvDspTPOpWqkBDRIFvaG2YiDDai3hBwXKj8SCf5A== From: Eric Farman To: Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Chinmay Rath , Nicholas Piggin , Glenn Miles , Harsh Prateek Bora , "Michael S . Tsirkin" , Paolo Bonzini , Richard Henderson Cc: qemu-devel@nongnu.org, Matthew Rosato , Eric Farman Subject: [PATCH v2 1/2] hw/i386: ELF endianness fixes Date: Mon, 19 Oct 2026 20:55:59 +0200 Message-ID: <20261019185600.2031729-2-farman@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261019185600.2031729-1-farman@linux.ibm.com> References: <20261019185600.2031729-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE5MDA3NCBTYWx0ZWRfXxE2gLhKYP5No 5UhnwZiu0rP8C09W/8WNfCdaNz9qpJkrUD8mCHlxl7JNcKZjQJx3EbvNLMRkDEwYIU8NJGuAUl+ JutHNaH5g4UCDF/LmL4V8zm+AokHfG0= X-Proofpoint-ORIG-GUID: D88vyqtWG2Ms8Rh71gyVsWPv5QwPf041 X-Proofpoint-GUID: s46m0dQHkupqf5I-0B-Xa8hAP_3y3R37 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE5MDA3NCBTYWx0ZWRfX8eP2PYiPSfCW Umeiv4IKObVgu1YVYCyvPDGNBq8sw0cHHy0mrkMWhM5jAZs3mi/G2H/+CS7CZs+Ry5Z5aWqNyKb mjnNmaQkLwgf9bx8tpDlyyLMdwEuOm80/kmZsgwBwUhe4VsTSTIop0hADFlCAjb0Zh6JfuB24j/ QMY6d74qxcVwFeDBmP1uoSJjPcHdb8aBH+Cw/5WHJtDGXTFznYP1DRmzAy1If0vAtWi1vqqA9T3 sMd5f1FBIScBz7ySqwe6aAwkIqtsnXmFnp1EqA4X0ZmXIcDYPRRo1hOZzsQKCKDW3ZEzG4ElwFC KAfrcOQ5CyOICNBnTGPlBIgydxlnTUmm7L8Fo4vs2eVwS8QLLH1R2wiF1NRAdbHSpTTfggfeHeW hVDf16RjMnlt3msxcwe5DPT6pNQtKuh8Nk1WTDpenkkznfQgUL9qfHYSJk//bdSNRLzTcAgWaO5 t/vhib+03htOoeJvdLA== X-Authority-Analysis: v=2.4 cv=MY35KJ/f c=1 sm=1 tr=0 ts=6ad667c9 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=EUspDBNiAAAA:8 a=VnNF1IyMAAAA:8 a=MllmpHxVhdK4irJ3L0sA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-19_05,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 bulkscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610190074 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=farman@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1792436228091158500 Content-Type: text/plain; charset="utf-8" Running make check-tcg-x86_64 on a big-endian host (e.g., s390x) fails due to problems reading/parsing the ELF data: qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note There already exists logic in include/hw/elf_ops.h.inc to handle byte-swaps where necessary, but it does not perform this logic for ELF notes itself. Fixing that improves matters, but yields other errors: most of the tests timeout while some generate confusing assertions. Both appear to be related to the data addresses in those notes, which are incorrect when running on a big-endian host. Adding tswap wrappers, which will conditionally swap if the host and target endianness don't match, fixes that such that check-tcg-x86_64 runs cleanly on an s390 host. Acked-by: Pierrick Bouvier Signed-off-by: Eric Farman Reviewed-by: Pierrick Bouvier --- hw/i386/x86-common.c | 6 ++++-- include/hw/elf_ops.h.inc | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index fa18bf1aece..dcd4fa8eb79 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -45,6 +45,8 @@ #include "kvm/kvm_i386.h" #include "kvm/tdx.h" =20 +#include "exec/tswap.h" + #ifdef CONFIG_XEN_EMU #include "hw/xen/xen.h" #include "hw/i386/kvm/xen_evtchn.h" @@ -573,7 +575,7 @@ static uint64_t read_pvh_start_addr(void *arg1, void *a= rg2, bool is64) ((void *)nhdr64) + nhdr_size64 + QEMU_ALIGN_UP(nhdr_namesz, phdr_align); =20 - pvh_start_addr =3D *elf_note_data_addr; + pvh_start_addr =3D tswap64(*elf_note_data_addr); } else { struct elf32_note *nhdr32 =3D (struct elf32_note *)arg1; uint32_t nhdr_size32 =3D sizeof(struct elf32_note); @@ -584,7 +586,7 @@ static uint64_t read_pvh_start_addr(void *arg1, void *a= rg2, bool is64) ((void *)nhdr32) + nhdr_size32 + QEMU_ALIGN_UP(nhdr_namesz, phdr_align); =20 - pvh_start_addr =3D *(uint32_t *)elf_note_data_addr; + pvh_start_addr =3D tswap32(*(uint32_t *)elf_note_data_addr); } =20 return pvh_start_addr; diff --git a/include/hw/elf_ops.h.inc b/include/hw/elf_ops.h.inc index 044e72de2a2..b4fc0b146f0 100644 --- a/include/hw/elf_ops.h.inc +++ b/include/hw/elf_ops.h.inc @@ -56,6 +56,13 @@ static void glue(bswap_rela, SZ)(struct elf_rela *rela) bswapSZs((elf_word *)&rela->r_addend); } =20 +static void glue(bswap_note, SZ)(struct elf_note *note) +{ + bswap32s(¬e->n_namesz); + bswap32s(¬e->n_descsz); + bswap32s(¬e->n_type); +} + static struct elf_shdr *glue(find_section, SZ)(struct elf_shdr *shdr_table, int n, int type) { @@ -275,7 +282,8 @@ fail: static struct elf_note *glue(get_elf_note_type, SZ)(struct elf_note *nhdr, elf_word note_size, elf_word phdr_align, - elf_word elf_note_type) + elf_word elf_note_type, + int must_swab) { elf_word nhdr_size =3D sizeof(struct elf_note); elf_word elf_note_entry_offset =3D 0; @@ -287,6 +295,10 @@ static struct elf_note *glue(get_elf_note_type, SZ)(st= ruct elf_note *nhdr, return NULL; } =20 + if (must_swab) { + glue(bswap_note, SZ)(nhdr); + } + note_type =3D nhdr->n_type; while (note_type !=3D elf_note_type) { nhdr_namesz =3D nhdr->n_namesz; @@ -306,6 +318,9 @@ static struct elf_note *glue(get_elf_note_type, SZ)(str= uct elf_note *nhdr, =20 /* skip to the next ELF Note entry */ nhdr =3D (void *)nhdr + elf_note_entry_offset; + if (must_swab) { + glue(bswap_note, SZ)(nhdr); + } note_type =3D nhdr->n_type; } =20 @@ -608,7 +623,8 @@ static ssize_t glue(load_elf, SZ)(const char *name, int= fd, nhdr =3D (struct elf_note *)data; assert(translate_opaque !=3D NULL); nhdr =3D glue(get_elf_note_type, SZ)(nhdr, file_size, ph->p_al= ign, - *(uint64_t *)translate_opaq= ue); + *(uint64_t *)translate_opaq= ue, + must_swab); if (nhdr !=3D NULL) { elf_note_fn((void *)nhdr, (void *)&ph->p_align, SZ =3D=3D = 64); } --=20 2.53.0 From nobody Mon Nov 23 04:44:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1792436213; cv=none; d=zohomail.com; s=zohoarc; b=FjBJjzw2jyg87GsVkekf57iFLtFqe44kaIgLkKaa+WPDlN/Qw+H1TOCq35IHumg4GSVdBSXoUOq9mUPmXLyyuRol2wJruX77ATs8dBAoTXOUnfC3GeWH1mSYz4xoQ/uqS/G9OsNxZt6XHsdqdMDrjeLV/vVUClNOSLpROCpQPok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792436213; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W91IzZ7hEPlqVCbHCsamYFx6badT/p0SGBMWJ1R1KFc=; b=nau//mESAyx50QLEVeGNgM7aPu4xJpMNCYM91PebSevlHleqtl/Xw6R1/lPuHAwjNd1M1JBCT93MSzv4VoH+ptA7zXY+XDCoG50499a0O92LYfx7Hpgg8PRcuxUXj+UaSCKi4T0n8STPhS8Z98rO/lblEy+Yxlw4fYbW2t+mM8M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17924362131129.584957619091824; Mon, 19 Oct 2026 11:56:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xIsWx-0007rJ-GT; Mon, 19 Oct 2026 14:56:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIsWt-0007qK-5Y for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:56:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xIsWo-0000JP-Tg for qemu-devel@nongnu.org; Mon, 19 Oct 2026 14:56:14 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69JFiTg13041651; Mon, 19 Oct 2026 18:56:09 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4hbyepvchs-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 19 Oct 2026 18:56:08 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 69JFZ6RK3125182; Mon, 19 Oct 2026 18:56:08 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4hcnjgxvrt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Oct 2026 18:56:07 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 69JIu2jh39911840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Oct 2026 18:56:02 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5245D20040; Mon, 19 Oct 2026 18:56:02 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 073A72004B; Mon, 19 Oct 2026 18:56:02 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with SMTP; Mon, 19 Oct 2026 18:56:01 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id DDD2216131E; Mon, 19 Oct 2026 20:56:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=W91IzZ7hEPlqVCbHC samYFx6badT/p0SGBMWJ1R1KFc=; b=mcsSO07tHvHF6xdxfMGG5wuhp/xOyEUMN 1EwcHdIhi6w1/wP8AW9UmIlfRkToy8Ung9fCyh3B4hmu/9glfOs9WTm0jDoWvPdd MNK+kI158pWH1zLg1S8OaKSt8BXrbFImFbicsixoMpzIn8sG8JZJXF72FSEO+sxw eCkRmteGVPbPmYUX1mSBVxPuZfl7+bk6cJHjhq3Ajd3+g+5CniqXq+JUpVp5XR/Q IOc/namH5DvqJQpd626EqouF3j3UX4ngG9/LfHaLqR0N0sF2BQxC2pxVh3IhoDnW imvzYs8YN/1QCAbuH6Fw1nYyX4GGENMAzqRlHahEtZHLFo9dKwvfg== From: Eric Farman To: Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Chinmay Rath , Nicholas Piggin , Glenn Miles , Harsh Prateek Bora , "Michael S . Tsirkin" , Paolo Bonzini , Richard Henderson Cc: qemu-devel@nongnu.org, Matthew Rosato , Eric Farman Subject: [PATCH v2 2/2] tests/tcg/ppc64: Run float_conv* against power8 Date: Mon, 19 Oct 2026 20:56:00 +0200 Message-ID: <20261019185600.2031729-3-farman@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261019185600.2031729-1-farman@linux.ibm.com> References: <20261019185600.2031729-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYxMDE5MDA3NCBTYWx0ZWRfX31ZfVwX5jLJ5 Im5GpeToGpuOeHs+WJfxOjpLwGov/8sg8rRA4IRCVea/E/qfxs5j1mGJluP3XF7URVshY1+z8zA Ar7KUGRtv1A6WY0xLy6odgplHWH8qKw= X-Authority-Analysis: v=2.4 cv=Z4R5j3RA c=1 sm=1 tr=0 ts=6ad667c9 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=660iZSQnnn4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=mTO5zd2ZRFQLC5amIzUA:9 X-Proofpoint-ORIG-GUID: 924rhI5YjEMDaDMXbzugqG78EFDniwnK X-Proofpoint-GUID: WS6kx1lHfCSpvl-lnlAgsoP7ozaHgtmy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE5MDA3NCBTYWx0ZWRfX5nkNg1V5XWQ6 j/rBr13TqAsmX9hvNLjhCAD3/14Ey6B+ZLwZofB92VBIiTKWEjk++OPxypWPds7bEDHek5WCod6 uRiSYC8+1zwJOfPYhArOQ031c2S8NNwG5UpgiJwJRnhJd8NujNg3M5H7K4am/QfkB5YON7E1HtU 0VrVcrgL231KRuf+czcu7mRKL5atLnXTnMTjchKM0aLQWwe75lX1FAZNpWDok6lOPmR56sKfOJ6 Do60wRdp8RRlJkYuL4WCnO4It15hpbQxF6o5eHRymE/ay/RtwqBbwxTuuDQACgiMyTFp5hHby7n aPnSzFrLkDQsYTEJm24cfThUhz7ec5OtXscjhQWVkE749WbOYY2ssQ71m2rtWqcgaWifUkpuLAi QoHwhwxUYXqRUx+urbF3Geq9datnRk4y7pwcVg+nupTZyPoibkjEaoapFio6SiKcdZBgP5WRXIP z5EK2azp1VcDYza8ioQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-19_05,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1015 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610190074 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=farman@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1792436216020158500 Content-Type: text/plain; charset="utf-8" There is an oddity that turns up with the float_convd and float_convs tests, when running from different toolchains. As one example, the expectation at the start of tests/tcg/ppc64/float_conv*.ref is: ### Rounding to nearest from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) to uint64: -9223372036854775808 (INVALID) But, other hosts offer a different response, e.g., this debian guest on my laptop: ### Rounding to nearest from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) to uint64: 0 (INVALID) The explanation seems to be a behavior change when compiling to different versions of power hardware. When building the arguments from the multiarch directory, let's ensure these float tests offer a deterministic response to these NaN tests by explicitly binding them to a CPU architecture. Chose power8 for no real reason. This behavior change appears between power6 and power7, but other tests that rely on a specific architecture today pick either power8 or power10. Signed-off-by: Eric Farman Reviewed-by: Pierrick Bouvier --- tests/tcg/ppc64/float_convd.ref | 144 ++++++++++++++++---------------- tests/tcg/ppc64/float_convs.ref | 80 +++++++++--------- tests/tcg/ppc64/meson.build | 6 ++ 3 files changed, 118 insertions(+), 112 deletions(-) diff --git a/tests/tcg/ppc64/float_convd.ref b/tests/tcg/ppc64/float_convd.= ref index 43aa3117f14..2995a767c04 100644 --- a/tests/tcg/ppc64/float_convd.ref +++ b/tests/tcg/ppc64/float_convd.ref @@ -4,61 +4,61 @@ from double: f64(nan:0x007ff4000000000000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-nan:0x00fff8000000000000) to single: f32(-nan:0xffc00000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-inf:0x00fff0000000000000) to single: f32(-inf:0xff800000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffffffffff0000000p+1023:0x00ffefffffffffffff) to single: f32(-inf:0xff800000) (OVERFLOW INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.1874b135ff6540000000p+103:0x00c661874b135ff654) to single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.c0bab523323b90000000p+99:0x00c62c0bab523323b9) to single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+1:0x00c000000000000000) to single: f32(-0x1.00000000000000000000p+1:0xc0000000) (OK) to int32: -2 (OK) to int64: -2 (OK) - to uint32: -2 (OK) - to uint64: -2 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+0:0x00bff0000000000000) to single: f32(-0x1.00000000000000000000p+0:0xbf800000) (OK) to int32: -1 (OK) to int64: -1 (OK) - to uint32: -1 (OK) - to uint64: -1 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p-1022:0x008010000000000000) to single: f32(-0x0.00000000000000000000p+0:0x80000000) (UNDERFLOW INEXA= CT ) to int32: 0 (INEXACT ) @@ -208,19 +208,19 @@ from double: f64(0x1.fffffe00000000000000p+127:0x0047= efffffe0000000) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffffffffff0000000p+1023:0x007fefffffffffffff) to single: f32(inf:0x7f800000) (OVERFLOW INEXACT ) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(inf:0x007ff0000000000000) to single: f32(inf:0x7f800000) (OK) to int32: 2147483647 (INVALID) @@ -232,80 +232,80 @@ from double: f64(nan:0x007ff8000000000000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff0000000000001) to single: f32(nan:0x7fc00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding upwards from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-nan:0x00fff8000000000000) to single: f32(-nan:0xffc00000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-inf:0x00fff0000000000000) to single: f32(-inf:0xff800000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffffffffff0000000p+1023:0x00ffefffffffffffff) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OVERFLOW INEX= ACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.1874b135ff6540000000p+103:0x00c661874b135ff654) to single: f32(-0x1.1874b000000000000000p+103:0xf30c3a58) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.c0bab523323b90000000p+99:0x00c62c0bab523323b9) to single: f32(-0x1.c0bab400000000000000p+99:0xf1605d5a) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+1:0x00c000000000000000) to single: f32(-0x1.00000000000000000000p+1:0xc0000000) (OK) to int32: -2 (OK) to int64: -2 (OK) - to uint32: -2 (OK) - to uint64: -2 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+0:0x00bff0000000000000) to single: f32(-0x1.00000000000000000000p+0:0xbf800000) (OK) to int32: -1 (OK) to int64: -1 (OK) - to uint32: -1 (OK) - to uint64: -1 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p-1022:0x008010000000000000) to single: f32(-0x0.00000000000000000000p+0:0x80000000) (UNDERFLOW INEXA= CT ) to int32: 0 (INEXACT ) @@ -455,19 +455,19 @@ from double: f64(0x1.fffffe00000000000000p+127:0x0047= efffffe0000000) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffffffffff0000000p+1023:0x007fefffffffffffff) to single: f32(inf:0x7f800000) (OVERFLOW INEXACT ) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(inf:0x007ff0000000000000) to single: f32(inf:0x7f800000) (OK) to int32: 2147483647 (INVALID) @@ -479,80 +479,80 @@ from double: f64(nan:0x007ff8000000000000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff0000000000001) to single: f32(nan:0x7fc00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding downwards from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-nan:0x00fff8000000000000) to single: f32(-nan:0xffc00000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-inf:0x00fff0000000000000) to single: f32(-inf:0xff800000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffffffffff0000000p+1023:0x00ffefffffffffffff) to single: f32(-inf:0xff800000) (OVERFLOW INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.1874b135ff6540000000p+103:0x00c661874b135ff654) to single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.c0bab523323b90000000p+99:0x00c62c0bab523323b9) to single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+1:0x00c000000000000000) to single: f32(-0x1.00000000000000000000p+1:0xc0000000) (OK) to int32: -2 (OK) to int64: -2 (OK) - to uint32: -2 (OK) - to uint64: -2 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+0:0x00bff0000000000000) to single: f32(-0x1.00000000000000000000p+0:0xbf800000) (OK) to int32: -1 (OK) to int64: -1 (OK) - to uint32: -1 (OK) - to uint64: -1 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p-1022:0x008010000000000000) to single: f32(-0x1.00000000000000000000p-149:0x80000001) (UNDERFLOW INE= XACT ) to int32: 0 (INEXACT ) @@ -702,19 +702,19 @@ from double: f64(0x1.fffffe00000000000000p+127:0x0047= efffffe0000000) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffffffffff0000000p+1023:0x007fefffffffffffff) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OVERFLOW INEXA= CT ) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(inf:0x007ff0000000000000) to single: f32(inf:0x7f800000) (OK) to int32: 2147483647 (INVALID) @@ -726,80 +726,80 @@ from double: f64(nan:0x007ff8000000000000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff0000000000001) to single: f32(nan:0x7fc00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding to zero from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-nan:0x00fff8000000000000) to single: f32(-nan:0xffc00000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-inf:0x00fff0000000000000) to single: f32(-inf:0xff800000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffffffffff0000000p+1023:0x00ffefffffffffffff) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OVERFLOW INEX= ACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) to single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.1874b135ff6540000000p+103:0x00c661874b135ff654) to single: f32(-0x1.1874b000000000000000p+103:0xf30c3a58) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.c0bab523323b90000000p+99:0x00c62c0bab523323b9) to single: f32(-0x1.c0bab400000000000000p+99:0xf1605d5a) (INEXACT ) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+1:0x00c000000000000000) to single: f32(-0x1.00000000000000000000p+1:0xc0000000) (OK) to int32: -2 (OK) to int64: -2 (OK) - to uint32: -2 (OK) - to uint64: -2 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p+0:0x00bff0000000000000) to single: f32(-0x1.00000000000000000000p+0:0xbf800000) (OK) to int32: -1 (OK) to int64: -1 (OK) - to uint32: -1 (OK) - to uint64: -1 (OK) + to uint32: 0 (INVALID) + to uint64: 0 (INVALID) from double: f64(-0x1.00000000000000000000p-1022:0x008010000000000000) to single: f32(-0x0.00000000000000000000p+0:0x80000000) (UNDERFLOW INEXA= CT ) to int32: 0 (INEXACT ) @@ -949,19 +949,19 @@ from double: f64(0x1.fffffe00000000000000p+127:0x0047= efffffe0000000) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(0x1.fffffffffffff0000000p+1023:0x007fefffffffffffff) to single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) (OVERFLOW INEXA= CT ) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from double: f64(inf:0x007ff0000000000000) to single: f32(inf:0x7f800000) (OK) to int32: 2147483647 (INVALID) @@ -973,16 +973,16 @@ from double: f64(nan:0x007ff8000000000000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff0000000000001) to single: f32(nan:0x7fc00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from double: f64(nan:0x007ff4000000000000) to single: f32(nan:0x7fe00000) (INVALID) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) diff --git a/tests/tcg/ppc64/float_convs.ref b/tests/tcg/ppc64/float_convs.= ref index bd7b14d37e3..6e6f6368344 100644 --- a/tests/tcg/ppc64/float_convs.ref +++ b/tests/tcg/ppc64/float_convs.ref @@ -4,37 +4,37 @@ from single: f32(-nan:0xffa00000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-nan:0xffc00000) to double: f64(-nan:0x00fff8000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-inf:0xff800000) to double: f64(-inf:0x00fff0000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) to double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) to double: f64(-0x1.1874b200000000000000p+103:0x00c661874b20000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) to double: f64(-0x1.c0bab600000000000000p+99:0x00c62c0bab60000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.31f75000000000000000p-40:0xab98fba8) to double: f64(-0x1.31f75000000000000000p-40:0x00bd731f7500000000) (OK) to int32: 0 (INEXACT ) @@ -160,13 +160,13 @@ from single: f32(0x1.c0bab600000000000000p+99:0x71605= d5b) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) to double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(inf:0x7f800000) to double: f64(inf:0x007ff0000000000000) (OK) to int32: 2147483647 (INVALID) @@ -178,50 +178,50 @@ from single: f32(nan:0x7fc00000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(nan:0x7fa00000) to double: f64(nan:0x007ff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding upwards from single: f32(-nan:0xffa00000) to double: f64(-nan:0x00fff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-nan:0xffc00000) to double: f64(-nan:0x00fff8000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-inf:0xff800000) to double: f64(-inf:0x00fff0000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) to double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) to double: f64(-0x1.1874b200000000000000p+103:0x00c661874b20000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) to double: f64(-0x1.c0bab600000000000000p+99:0x00c62c0bab60000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.31f75000000000000000p-40:0xab98fba8) to double: f64(-0x1.31f75000000000000000p-40:0x00bd731f7500000000) (OK) to int32: 0 (INEXACT ) @@ -347,13 +347,13 @@ from single: f32(0x1.c0bab600000000000000p+99:0x71605= d5b) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) to double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(inf:0x7f800000) to double: f64(inf:0x007ff0000000000000) (OK) to int32: 2147483647 (INVALID) @@ -365,50 +365,50 @@ from single: f32(nan:0x7fc00000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(nan:0x7fa00000) to double: f64(nan:0x007ff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding downwards from single: f32(-nan:0xffa00000) to double: f64(-nan:0x00fff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-nan:0xffc00000) to double: f64(-nan:0x00fff8000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-inf:0xff800000) to double: f64(-inf:0x00fff0000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) to double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) to double: f64(-0x1.1874b200000000000000p+103:0x00c661874b20000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) to double: f64(-0x1.c0bab600000000000000p+99:0x00c62c0bab60000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.31f75000000000000000p-40:0xab98fba8) to double: f64(-0x1.31f75000000000000000p-40:0x00bd731f7500000000) (OK) to int32: 0 (INEXACT ) @@ -534,13 +534,13 @@ from single: f32(0x1.c0bab600000000000000p+99:0x71605= d5b) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) to double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(inf:0x7f800000) to double: f64(inf:0x007ff0000000000000) (OK) to int32: 2147483647 (INVALID) @@ -552,50 +552,50 @@ from single: f32(nan:0x7fc00000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(nan:0x7fa00000) to double: f64(nan:0x007ff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) ### Rounding to zero from single: f32(-nan:0xffa00000) to double: f64(-nan:0x00fff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-nan:0xffc00000) to double: f64(-nan:0x00fff8000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-inf:0xff800000) to double: f64(-inf:0x00fff0000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.fffffe00000000000000p+127:0xff7fffff) to double: f64(-0x1.fffffe00000000000000p+127:0x00c7efffffe0000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.1874b200000000000000p+103:0xf30c3a59) to double: f64(-0x1.1874b200000000000000p+103:0x00c661874b20000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.c0bab600000000000000p+99:0xf1605d5b) to double: f64(-0x1.c0bab600000000000000p+99:0x00c62c0bab60000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(-0x1.31f75000000000000000p-40:0xab98fba8) to double: f64(-0x1.31f75000000000000000p-40:0x00bd731f7500000000) (OK) to int32: 0 (INEXACT ) @@ -721,13 +721,13 @@ from single: f32(0x1.c0bab600000000000000p+99:0x71605= d5b) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) to double: f64(0x1.fffffe00000000000000p+127:0x0047efffffe0000000) (OK) to int32: 2147483647 (INVALID) to int64: 9223372036854775807 (INVALID) to uint32: -1 (INVALID) - to uint64: -1 (INEXACT INVALID) + to uint64: -1 (INVALID) from single: f32(inf:0x7f800000) to double: f64(inf:0x007ff0000000000000) (OK) to int32: 2147483647 (INVALID) @@ -739,10 +739,10 @@ from single: f32(nan:0x7fc00000) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) from single: f32(nan:0x7fa00000) to double: f64(nan:0x007ff4000000000000) (OK) to int32: -2147483648 (INVALID) to int64: -9223372036854775808 (INVALID) to uint32: 0 (INVALID) - to uint64: -9223372036854775808 (INVALID) + to uint64: 0 (INVALID) diff --git a/tests/tcg/ppc64/meson.build b/tests/tcg/ppc64/meson.build index 8cca4d65a4c..d9b4b153d94 100644 --- a/tests/tcg/ppc64/meson.build +++ b/tests/tcg/ppc64/meson.build @@ -13,6 +13,12 @@ foreach t: tcg_tests['multiarch-linux-user']['tests'] if fs.stem(src) =3D=3D 'test-plugin-mem-access' and 'wrapper' in setup continue endif + if fs.stem(src).contains('float_conv') + # Ensure float NaN tests are done against a known cpu generation + if 'cflags' in setup + setup +=3D {'cflags': setup['cflags'] + '-mcpu=3Dpower8'} + endif + endif tests +=3D {src: setup} endforeach endforeach --=20 2.53.0