From nobody Sun Nov 24 09:04:53 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725902999; cv=none; d=zohomail.com; s=zohoarc; b=Jm/OwJHVNk18SDr3H9n8mYp89x+N1fzL9J1eSX4DJhBe/QPb87MHCmmSqA0FteOv/g0r2iBeN3xYQHAhKLe62t/Z4g6HgNSxjRTUb1tPY0DOS3nwa9AXaOya7w8O3pT5qprJTnX3BuFWXf1O0FDjLDmQFZxuAiAargqR/romCrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725902999; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m7w703O79/DTa7nR13RVyKW4XTiaiYluVn4vLct/9bg=; b=DZIwo+uTVtgiBlCTUPeDuUgbF2GVAnN18H9bEIMYdBENpfnJ3XzXg1jC5EqthTAUHDNpnNDrqDEaR+r/mZcMuSE5CwS4bh+CAAH2Mjk2x0PlVurTnJ0B9eypY2tXV0br70Nx/41g7sKqB1kHFbVRTu83xPQv2afd2Y2uqX4YgM4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725902999172166.87864183082934; Mon, 9 Sep 2024 10:29:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sniBn-00046H-9K; Mon, 09 Sep 2024 13:28:35 -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 1sniBi-0003vw-Lg for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:30 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sniBg-00060I-KT for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:30 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2054feabfc3so40719945ad.1 for ; Mon, 09 Sep 2024 10:28:28 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e11e02sm36539875ad.14.2024.09.09.10.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 10:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725902907; x=1726507707; 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=m7w703O79/DTa7nR13RVyKW4XTiaiYluVn4vLct/9bg=; b=xMaccUGloF3Wcy44le+WHndM1atlQ6a/2zkXGieO0EybkKh2d8jWpRif0i2bQ2v3NE jKkd5zFaZFnR3n3FadrsOkhVu+7AwCyJshQGHQU4c6/RCrtTbHQULp3sQBaJNsUoPbek prXJwlHpcTvl0SRDP8qjzvrtKfaXNNwN38o3A0OFBM4sVyQYxdsY3LQRmtvxl8RbGeve mn+GgJsPyVp+hM71z07dSDYXbUEdlcMUX4owsIEac/gEBICczyHwdUu5rrZQ19Rxmg/m icYGq8Fe95F5T+3Ab9DsG7EZEP+s16iUdU81qufPd9bFf1PE6wwyb/IHbUCZzOQKBa3E 9zWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725902907; x=1726507707; 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=m7w703O79/DTa7nR13RVyKW4XTiaiYluVn4vLct/9bg=; b=UUutE/NhVtc1MuXKxTZS/6ofM6ts0/x2MdEGs0NvBOZGfUas5xiAfvPTQYzNCuIlEY lyAReUuRrVbMrX8vJuFO0TfhvtKYiBCXLMHsr3amIfFgePk7e+nXbNw2WYEzNm+NbZDO WhOurbNUCyI1Y34kbW+M0s3FQ6eHvWSo3nQ+dyOgpDRC3cRceDc+EMJ/T0tWFH24wx2m GRefaRNzuy1x6Mwqn3socP9XPRWr0ibcKrAWzISspH6P+RwqgX8rZ36oOH4SEtwdckPo A2H+vJgDgNGN0EMN/iTIswjGhGfsxdRVMfPuoC7R7FdJr1Hc/yJ9nyj4HXzFezknKvqr ALNA== X-Gm-Message-State: AOJu0YzBcDUuUgUPTtujBdaN8l/ssRhOxz0fFYaOWQgMhkdfJOnClhWn HB/wiasX/LvUTs/Lu4qP2T5xzBUvODsY/YSngUW9+GOX2Hh4v9jj71gIqfviJK8n9C00fWTQwgb p X-Google-Smtp-Source: AGHT+IFELZCDbTWnrlI0HmUXb/9+eTndAyqf81KnblWmUwOaIRp4Py832GWZvtZeby/AEqmqu97g1A== X-Received: by 2002:a17:902:d2c5:b0:206:d8c2:4a94 with SMTP id d9443c01a7336-206f0542c38mr192047795ad.25.1725902907062; Mon, 09 Sep 2024 10:28:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, daniel@0x0f.com Subject: [PATCH v3 02/26] target/m68k: Add FPSR exception bit defines Date: Mon, 9 Sep 2024 10:27:59 -0700 Message-ID: <20240909172823.649837-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240909172823.649837-1-richard.henderson@linaro.org> References: <20240909172823.649837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725903001281116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/m68k/cpu.h | 21 +++++++++++++++++++++ target/m68k/fpu_helper.c | 22 +++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index b5bbeedb7a..e8dd75d242 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -440,6 +440,27 @@ typedef enum { #define FPSR_QT_MASK 0x00ff0000 #define FPSR_QT_SHIFT 16 =20 +/* Exception Status Byte */ + +#define FPSR_EXC_MASK 0xff00 +#define FPSR_EXC_INEX1 0x0100 +#define FPSR_EXC_INEX2 0x0200 +#define FPSR_EXC_DZ 0x0400 +#define FPSR_EXC_UNFL 0x0800 +#define FPSR_EXC_OVFL 0x1000 +#define FPSR_EXC_OPERR 0x2000 +#define FPSR_EXC_SNAN 0x4000 +#define FPSR_EXC_BSUN 0x8000 + +/* Accrued Exception Byte */ + +#define FPSR_AEXC_MASK 0xf8 +#define FPSR_AEXC_INEX 0x08 +#define FPSR_AEXP_DZ 0x10 +#define FPSR_AEXP_UNFL 0x20 +#define FPSR_AEXP_OVFL 0x40 +#define FPSR_AEXP_IOP 0x80 + /* Floating-Point Control Register */ /* Rounding mode */ #define FPCR_RND_MASK 0x0030 diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 8314791f50..c6d93b56a0 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -170,19 +170,19 @@ static int cpu_m68k_exceptbits_from_host(int host_bit= s) int target_bits =3D 0; =20 if (host_bits & float_flag_invalid) { - target_bits |=3D 0x80; + target_bits |=3D FPSR_AEXP_IOP; } if (host_bits & float_flag_overflow) { - target_bits |=3D 0x40; + target_bits |=3D FPSR_AEXP_OVFL; } if (host_bits & (float_flag_underflow | float_flag_output_denormal)) { - target_bits |=3D 0x20; + target_bits |=3D FPSR_AEXP_UNFL; } if (host_bits & float_flag_divbyzero) { - target_bits |=3D 0x10; + target_bits |=3D FPSR_AEXP_DZ; } if (host_bits & float_flag_inexact) { - target_bits |=3D 0x08; + target_bits |=3D FPSR_AEXC_INEX; } return target_bits; } @@ -192,19 +192,19 @@ static int cpu_m68k_exceptbits_to_host(int target_bit= s) { int host_bits =3D 0; =20 - if (target_bits & 0x80) { + if (target_bits & FPSR_AEXP_IOP) { host_bits |=3D float_flag_invalid; } - if (target_bits & 0x40) { + if (target_bits & FPSR_AEXP_OVFL) { host_bits |=3D float_flag_overflow; } - if (target_bits & 0x20) { + if (target_bits & FPSR_AEXP_UNFL) { host_bits |=3D float_flag_underflow; } - if (target_bits & 0x10) { + if (target_bits & FPSR_AEXP_DZ) { host_bits |=3D float_flag_divbyzero; } - if (target_bits & 0x08) { + if (target_bits & FPSR_AEXC_INEX) { host_bits |=3D float_flag_inexact; } return host_bits; @@ -214,7 +214,7 @@ uint32_t cpu_m68k_get_fpsr(CPUM68KState *env) { int host_flags =3D get_float_exception_flags(&env->fp_status); int target_flags =3D cpu_m68k_exceptbits_from_host(host_flags); - int except =3D (env->fpsr & ~(0xf8)) | target_flags; + int except =3D (env->fpsr & ~FPSR_AEXC_MASK) | target_flags; return except; } =20 --=20 2.43.0