From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +EfMNJ1a+mHsSgAAWB0awg (envelope-from ) for ; Wed, 02 Feb 2022 05:19:09 -0500 Received: by simark.ca (Postfix, from userid 112) id D5C0B1F3BA; Wed, 2 Feb 2022 05:19:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 09E451ECEB for ; Wed, 2 Feb 2022 05:19:09 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACD70385C426 for ; Wed, 2 Feb 2022 10:19:08 +0000 (GMT) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50116.outbound.protection.outlook.com [40.107.5.116]) by sourceware.org (Postfix) with ESMTPS id A1AF53858039 for ; Wed, 2 Feb 2022 10:17:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A1AF53858039 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=syrmia.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=syrmia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TJUY/JZEJjhtcb01F1U3UeTa7AJbPjeNR4jdIxaj58msLJ1t72eiGe2zRYHJauwjwTpuAnhObuFV037J9l7PcuJg7LkU28iNqT7sm9WrIU4eUUXry2JQLZzfL5+YJ7rFco25e3o5MqmBvoEDt4JFIzboUYqF3kOqbPZiIiPoCrH/ktTnKEWNbt1rKnXZdB6UiJ1cwYS21wrOKnE4aR3KKQvaBP1mEi1zahCoiRqxb+skvoIdcrYr/44ahsttHGuKhZkNpvftpSRclNBWUkq7aNzU2sBmdvwIHe+33lDlWVKviJkJ7zhtrPPHVU2pvJOnjR5dJitQRPs3PSjs6wgMWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x66ZfvZ10+mEORLc/QVgAMJB21XkgCREAwYVwkYjPqs=; b=DWH4F1cGDG7zmdOCPRqMXFp9FYjTUvq767dhPZ7kPv937EStnk0YyTBYrwSinTHGGQE5+Z5ueS02tAmXzmhZjRS5NGe8D5m+3rf7/GM5CVXhVyCHcOv/KIK1ZHffqDlIZTZRL1X+LPyH7cKj0hKA3cRoikfCjIE43hUJwNKp51XjB6HTULUwTD1QIVlwA5xc1qDyJ+VIc4vvtcfaRefBxrl/05cJf4u2KSCtAmFnzaG+5NTtz1z4R5JI6+47Bm5vkXd4YGim+rFFIE7mtNDJQGrAbhoTNTS0CzpQ5IAkisOcI0STOi2iUnv2AJgs9Oa1Js0wZvRqleCnWk5rAYGwOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x66ZfvZ10+mEORLc/QVgAMJB21XkgCREAwYVwkYjPqs=; b=ZNO87D0PQfdYksL+2e6tsfFdRzrMKcNEWXArVIrxOokB7Hv9qoMe3Lq2SsQG+a5LTubsK0Ny4yboFTk7SIGrng2swLKhvYKoLo1NT0MoIAcQc2YLPVZd5GtM9RiUwaK7vPCiRAv9c29ZQOtOyCi8M5tRcgWefHMb5Uk8GFVgvq0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=syrmia.com; Received: from VI1PR03MB4208.eurprd03.prod.outlook.com (2603:10a6:803:51::25) by AM0PR03MB3924.eurprd03.prod.outlook.com (2603:10a6:208:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Wed, 2 Feb 2022 10:17:45 +0000 Received: from VI1PR03MB4208.eurprd03.prod.outlook.com ([fe80::2403:1065:f4bd:86c5]) by VI1PR03MB4208.eurprd03.prod.outlook.com ([fe80::2403:1065:f4bd:86c5%6]) with mapi id 15.20.4951.012; Wed, 2 Feb 2022 10:17:45 +0000 From: Dragan Mladjenovic To: gdb-patches@sourceware.org Subject: [PATCH v5 3/4] sim: Add partial support for IEEE 754-2008 Date: Wed, 2 Feb 2022 11:17:24 +0100 Message-Id: <20220202101725.23671-4-Dragan.Mladjenovic@syrmia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220202101725.23671-1-Dragan.Mladjenovic@syrmia.com> References: <20220202101725.23671-1-Dragan.Mladjenovic@syrmia.com> Content-Type: text/plain X-ClientProxiedBy: VI1PR0601CA0041.eurprd06.prod.outlook.com (2603:10a6:800:1e::51) To VI1PR03MB4208.eurprd03.prod.outlook.com (2603:10a6:803:51::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2010266b-1469-426e-d9b8-08d9e63540a4 X-MS-TrafficTypeDiagnostic: AM0PR03MB3924:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3oMLzvl46DFJq4ksGUgk6D21jMru2+8Il+xzJTqU9FztuCOt2NKpKLCYEY7tJWc+PWQcSgpD4DdJy81Q1jQmRRxtwOHbkXM2rl8GYO8cm0CCPJLPObtvIx7O2RWS8SEepO5+uId2ds6JX4NFN3o1JcABusbaxEpC9RiyFcbVx9uCqdc6HZ75aUKABQn+lcVzf+HmDt3wwCV1bY/AXOvcMjp/jLdcP+4ZXZwNCEuZBazFXRJwL0T9jp2j+iW1yUkSzWhbd+4/n7z85E2CV8cPJzPp4HrNMpqZqYF8oBRjtLoRUmpxrouNXDQpJO036EArvASsi4B3EAveYY851TNgF3zYhkVx8z4jT5/LnMSQGzmAsrOOwhAeXneEmKtlOd6mgfygl5O7+rJNpfrO4UP6OhTfeJFI8VMoB8WxyqsrzMHi6oR7euqv7HeFZqorn2xADwjttUyS/MrVO8EURirbQ6h/hCWcCUWeSWWIa82yDbt1Gih/JGoP+gm92RZO8LhnDB9kBHhmNXeiyWUzic97VTDVDuh4S3sUp41fjs2TQlhMFRHls2jADUMpjFd09777ZAvqvjdkTzxAXrPpTtgEe4sPVHA57HjNkn8PpmoH+O+WduEJWTHVF5h8pUaDevU5SGxRz491EGSjqzbwT/f1GCqEYjBHqpJ8YbKNchKJxYdszeMV7DfISeXewTgd7pGqCSddXkZzqZybbVv5K4wmmw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB4208.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(39840400004)(396003)(366004)(346002)(376002)(136003)(2616005)(186003)(26005)(1076003)(508600001)(4326008)(66476007)(8936002)(66556008)(8676002)(83380400001)(38100700002)(38350700002)(66946007)(5660300002)(6486002)(86362001)(6916009)(54906003)(6506007)(6512007)(6666004)(316002)(36756003)(2906002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8vg86S9K9w/VvREEOrYBI1u3J+efnd73vg9j5EUWJo41ySyV54nkv7VmSIiZ?= =?us-ascii?Q?LljmP1FlL5R9SwdYQ3s7ddjdcfXPyV0Yyhf/HccSfbbicKt9NpgJJ5zJSE1W?= =?us-ascii?Q?Uz9yYKNf3zWsUHvaO/VfIc4hQ+8dZsmrcRBNHStNA+9Mpsl2/VG13odxd7fm?= =?us-ascii?Q?5cnR2Pg7Bp2yzpfeH3Eb9t1jE/qqRbieddN9qQXt/Rkyvs5EohfbM+InNLuy?= =?us-ascii?Q?6weT/a1lVaK/83SR5sRyIK0xH8kpYt5X/dZuLgkynSwYOZJ9MWyRElkmBQvE?= =?us-ascii?Q?xwlg14f62nvIbjtkBX/LpegNmEwVGMonxFmmUZCgJ07FXp/09vPDJSm/zyyj?= =?us-ascii?Q?IDModVFD5Tzm5P6C9x6WdIutuliWHn/hPgkMXxn8lqklEWlyJWok/tsC/fNx?= =?us-ascii?Q?esdjmyGT5ADYg1A6TT+2UyPExJO0DWX95/YeqoTOokHMjVLUVQY1XIjdRmnd?= =?us-ascii?Q?nb8SS2NYM3m2BLjdzZbhSJjgRcsfEO9AsihjTObzpIbUs6T4/fH+dnBTb1lw?= =?us-ascii?Q?KfHQOLdaxaAkswjxPbWD8K2CLFdeYiFzsb1Nb8ARyhm08p5ytBbpTJqrG3MQ?= =?us-ascii?Q?5ijQeB3GmwtpztTx+uwyiv/5nceUg9HSPWQDg2JumzPz1Y2RArHYdlOgNk0z?= =?us-ascii?Q?BLTzfauzV4IQzTFWmh2eejWYW2BJrz0yScZVrTzlFqxxd28HZZxxLuBRmBY7?= =?us-ascii?Q?8B6EiGNBGvLGCaOWPdiF7daMpk6u1b8WzhjF8NgT0AvB7p93rpNCLLSvh1bQ?= =?us-ascii?Q?Z11VuE5Suo82y5vHMAhET2ds4OHZ5ZOXqNonpRFYowxA1P0Jw2zEiTh8XZh4?= =?us-ascii?Q?tUjpvtbg/xZhBmtX4D+VMnQoWuk/lXLYec0xZjh5MywUXGW0Yww2jLUxHwzA?= =?us-ascii?Q?y7H7LEW7Z0yYQv001r/h++4viK+sZDTNqzqWN1mZ82GEeXNFtjlhAjRULRyr?= =?us-ascii?Q?RtBSEtpdLdq/YWGvOrqnzVZk+1tVJBcMv/uCSHTKPj+RLDJA9thHYjCRkusR?= =?us-ascii?Q?HKjUSIWdadzkXF6lUtbQw0JCsI35xhM90tuD3iJs0rmhLMXba0jK9yBHyJc6?= =?us-ascii?Q?Pli1pXcruSRx4gqOKSYphfWTnULW65S0BNCJmnSc+caGLYKdmppzEA/B8MWp?= =?us-ascii?Q?5vU3Fg4P95uffO2eenDkH/fwieGzXEm/sjbTozRUAsBC6xAL+Fpm5p8Og3RM?= =?us-ascii?Q?kWzB8Yp/ntu4frVxa812a6XbAlWziIt5cygZaw5ZUCXgGinPfOHZoPojmbOC?= =?us-ascii?Q?WPpeVtBVWLt3u9LByGnlNMcON0VUxjQDj7u3TpGuiqZBCxy4Y/yssbGWc9w3?= =?us-ascii?Q?jnavYkquLsy38vOt1fEjMsvtI9c+5CqqO+NK31qZS5+hkN7wJQgOAl/lPbS4?= =?us-ascii?Q?frjgD1oLZwJizKUikWX3/d9SHrTDd+kdrm8VzqS8NaututumBxdmqTwsHtnZ?= =?us-ascii?Q?DuL9MTzK8lYzHm+cN7B5wB8S3JA45mTSRkyQtCGQJ/gfGvP5+/1bjmAw6aTs?= =?us-ascii?Q?yVBFlhTkL6EB5Wz0NuprtYfuaTrMcX+wjKUA8I+mbgXDonL9ykl12RC1m99c?= =?us-ascii?Q?o7y9QHK7hSumVgPd7LR3sIE4+XJJ9m9s/deEleOmH2/aUHh/Orlj4fbP2tIc?= =?us-ascii?Q?SbpE5xsUUvLY+ktJ8YkbV+3GDPARCMmlp+O2Jbpu6fugr9PnNBxlfXeG2WmF?= =?us-ascii?Q?ZY+sSg=3D=3D?= X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2010266b-1469-426e-d9b8-08d9e63540a4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4208.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2022 10:17:44.3086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BxD+EDkHMVw37xUr7DXTsCE2G/Ci9BFFpJw+Q+fW8QFXBebW5WnCnTj01/OeBhHeqMUSTzve32mSLbbtn0zZEirAceaLeaeyFCz+dOhaZxU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR03MB3924 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chao-ying Fu , Faraz Shahbazker , "Maciej W . Rozycki" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" From: Faraz Shahbazker 2022-02-01 Faraz Shahbazker sim/common/ChangeLog: * sim-fpu.c (sim_fpu_minmax_nan): New. (sim_fpu_max): Add variant behaviour for IEEE 754-2008. (sim_fpu_min): Likewise. (sim_fpu_is_un, sim_fpu_is_or): New. (sim_fpu_un, sim_fpu_or): New. (sim_fpu_is_ieee754_2008, sim_fpu_is_ieee754_1985): New. (sim_fpu_set_mode): New. (sim_fpu_classify): New. * sim-fpu.h (sim_fpu_minmax_nan): New declaration. (sim_fpu_un, sim_fpu_or): New declarations. (sim_fpu_is_un, sim_fpu_is_or): New declarations. (sim_fpu_mode): New enum. [sim_fpu_state](current_mode): New field. (sim_fpu_current_mode): New define. (sim_fpu_is_ieee754_2008): New declaration. (sim_fpu_is_ieee754_1985): New declaration. (sim_fpu_set_mode): New declaration. (sim_fpu_classify): New declaration. --- sim/common/sim-fpu.c | 110 +++++++++++++++++++++++++++++++++++++++++-- sim/common/sim-fpu.h | 26 +++++++++- 2 files changed, 131 insertions(+), 5 deletions(-) Changes form v4: Tidy up the comments. diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index 9174eaf17b4..ccaff9c7661 100644 --- a/sim/common/sim-fpu.c +++ b/sim/common/sim-fpu.c @@ -1005,6 +1005,30 @@ sim_fpu_op_nan (sim_fpu *f, const sim_fpu *l, const sim_fpu *r) return 0; } +/* NaN handling specific to min/max operations. */ + +INLINE_SIM_FPU (int) +sim_fpu_minmax_nan (sim_fpu *f, const sim_fpu *l, const sim_fpu *r) +{ + if (sim_fpu_is_snan (l) + || sim_fpu_is_snan (r) + || sim_fpu_is_ieee754_1985 ()) + return sim_fpu_op_nan (f, l, r); + else + /* if sim_fpu_is_ieee754_2008() + && ((sim_fpu_is_qnan (l) || sim_fpu_is_qnan (r))) */ + { + /* In IEEE754-2008: + "minNum/maxNum is ... the canonicalized number if one + operand is a number and the other a quiet NaN." */ + if (sim_fpu_is_qnan (l)) + *f = *r; + else /* if (sim_fpu_is_qnan (r)) */ + *f = *l; + return 0; + } +} + /* Arithmetic ops */ INLINE_SIM_FPU (int) @@ -1553,7 +1577,7 @@ sim_fpu_max (sim_fpu *f, const sim_fpu *r) { if (sim_fpu_is_nan (l) || sim_fpu_is_nan (r)) - return sim_fpu_op_nan (f, l, r); + return sim_fpu_minmax_nan (f, l, r); if (sim_fpu_is_infinity (l)) { if (sim_fpu_is_infinity (r) @@ -1616,7 +1640,7 @@ sim_fpu_min (sim_fpu *f, const sim_fpu *r) { if (sim_fpu_is_nan (l) || sim_fpu_is_nan (r)) - return sim_fpu_op_nan (f, l, r); + return sim_fpu_minmax_nan (f, l, r); if (sim_fpu_is_infinity (l)) { if (sim_fpu_is_infinity (r) @@ -1677,7 +1701,7 @@ INLINE_SIM_FPU (int) sim_fpu_neg (sim_fpu *f, const sim_fpu *r) { - if (sim_fpu_is_snan (r)) + if (sim_fpu_is_ieee754_1985 () && sim_fpu_is_snan (r)) { *f = *r; f->class = sim_fpu_class_qnan; @@ -1700,7 +1724,7 @@ sim_fpu_abs (sim_fpu *f, { *f = *r; f->sign = 0; - if (sim_fpu_is_snan (r)) + if (sim_fpu_is_ieee754_1985 () && sim_fpu_is_snan (r)) { f->class = sim_fpu_class_qnan; return sim_fpu_status_invalid_snan; @@ -2255,6 +2279,21 @@ sim_fpu_is_gt (const sim_fpu *l, const sim_fpu *r) return is; } +INLINE_SIM_FPU (int) +sim_fpu_is_un (const sim_fpu *l, const sim_fpu *r) +{ + int is; + sim_fpu_un (&is, l, r); + return is; +} + +INLINE_SIM_FPU (int) +sim_fpu_is_or (const sim_fpu *l, const sim_fpu *r) +{ + int is; + sim_fpu_or (&is, l, r); + return is; +} /* Compare operators */ @@ -2378,12 +2417,57 @@ sim_fpu_gt (int *is, return sim_fpu_lt (is, r, l); } +INLINE_SIM_FPU (int) +sim_fpu_un (int *is, const sim_fpu *l, const sim_fpu *r) +{ + if (sim_fpu_is_nan (l) || sim_fpu_is_nan (r)) + { + *is = 1; + return 0; + } + + *is = 0; + return 0; +} + +INLINE_SIM_FPU (int) +sim_fpu_or (int *is, const sim_fpu *l, const sim_fpu *r) +{ + sim_fpu_un (is, l, r); + + /* Invert result. */ + *is = !*is; + return 0; +} + +INLINE_SIM_FPU(int) +sim_fpu_classify (const sim_fpu *f) +{ + switch (f->class) + { + case sim_fpu_class_snan: return SIM_FPU_IS_SNAN; + case sim_fpu_class_qnan: return SIM_FPU_IS_QNAN; + case sim_fpu_class_infinity: + return f->sign ? SIM_FPU_IS_NINF : SIM_FPU_IS_PINF; + case sim_fpu_class_zero: + return f->sign ? SIM_FPU_IS_NZERO : SIM_FPU_IS_PZERO; + case sim_fpu_class_number: + return f->sign ? SIM_FPU_IS_NNUMBER : SIM_FPU_IS_PNUMBER; + case sim_fpu_class_denorm: + return f->sign ? SIM_FPU_IS_NDENORM : SIM_FPU_IS_PDENORM; + default: + fprintf (stderr, "Bad switch\n"); + abort (); + } + return 0; +} /* A number of useful constants */ #if EXTERN_SIM_FPU_P sim_fpu_state _sim_fpu = { .quiet_nan_inverted = false, + .current_mode = sim_fpu_ieee754_1985, }; const sim_fpu sim_fpu_zero = { @@ -2406,6 +2490,24 @@ const sim_fpu sim_fpu_max64 = { }; #endif +/* Specification swapping behaviour */ +INLINE_SIM_FPU (bool) +sim_fpu_is_ieee754_1985 (void) +{ + return (sim_fpu_current_mode == sim_fpu_ieee754_1985); +} + +INLINE_SIM_FPU (bool) +sim_fpu_is_ieee754_2008 (void) +{ + return (sim_fpu_current_mode == sim_fpu_ieee754_2008); +} + +INLINE_SIM_FPU (void) +sim_fpu_set_mode (const sim_fpu_mode m) +{ + sim_fpu_current_mode = m; +} /* For debugging */ diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h index 2a141981687..a20b2861491 100644 --- a/sim/common/sim-fpu.h +++ b/sim/common/sim-fpu.h @@ -163,8 +163,15 @@ typedef enum FIXME: This state is global, but should be moved to SIM_CPU. */ +typedef enum +{ + sim_fpu_ieee754_1985, + sim_fpu_ieee754_2008, +} sim_fpu_mode; + typedef struct _sim_fpu_state { bool quiet_nan_inverted; /* Toggle quiet NaN semantics. */ + sim_fpu_mode current_mode; } sim_fpu_state; @@ -268,6 +275,8 @@ INLINE_SIM_FPU (int) sim_fpu_sqrt (sim_fpu *f, INLINE_SIM_FPU (int) sim_fpu_op_nan (sim_fpu *f, const sim_fpu *l, const sim_fpu *r); +INLINE_SIM_FPU (int) sim_fpu_minmax_nan (sim_fpu *f, + const sim_fpu *l, const sim_fpu *r); @@ -318,7 +327,8 @@ INLINE_SIM_FPU (double) sim_fpu_2d (const sim_fpu *d); /* INLINE_SIM_FPU (void) sim_fpu_f2 (sim_fpu *f, float s); */ INLINE_SIM_FPU (void) sim_fpu_d2 (sim_fpu *f, double d); - +/* IEEE754-2008 classifiction function. */ +INLINE_SIM_FPU (int) sim_fpu_classify (const sim_fpu *f); /* Specific number classes. @@ -367,7 +377,20 @@ INLINE_SIM_FPU (int) sim_fpu_is_ne (const sim_fpu *l, const sim_fpu *r); INLINE_SIM_FPU (int) sim_fpu_is_ge (const sim_fpu *l, const sim_fpu *r); INLINE_SIM_FPU (int) sim_fpu_is_gt (const sim_fpu *l, const sim_fpu *r); +/* Unordered/ordered comparison operators. */ + +INLINE_SIM_FPU (int) sim_fpu_un (int *is, const sim_fpu *l, const sim_fpu *r); +INLINE_SIM_FPU (int) sim_fpu_or (int *is, const sim_fpu *l, const sim_fpu *r); + +INLINE_SIM_FPU (int) sim_fpu_is_un (const sim_fpu *l, const sim_fpu *r); +INLINE_SIM_FPU (int) sim_fpu_is_or (const sim_fpu *l, const sim_fpu *r); + +/* Changes the behaviour of the library to IEEE754-2008 or IEEE754-1985. + The default for the library is IEEE754-1985. */ +INLINE_SIM_FPU (bool) sim_fpu_is_ieee754_1985 (void); +INLINE_SIM_FPU (bool) sim_fpu_is_ieee754_2008 (void); +INLINE_SIM_FPU (void) sim_fpu_set_mode (const sim_fpu_mode m); /* General number class and comparison operators. @@ -411,6 +434,7 @@ extern sim_fpu_state _sim_fpu; between pre-R6 and R6 MIPS cores. */ #define sim_fpu_quiet_nan_inverted _sim_fpu.quiet_nan_inverted +#define sim_fpu_current_mode _sim_fpu.current_mode /* A number of useful constants. */ -- 2.17.1