From patchwork Wed Nov 8 14:41:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 24152 Received: (qmail 61524 invoked by alias); 8 Nov 2017 14:42:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 61487 invoked by uid 89); 8 Nov 2017 14:42:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com From: Wilco Dijkstra To: "libc-alpha@sourceware.org" CC: nd Subject: [PATCH] Improve math_errhandling Date: Wed, 8 Nov 2017 14:41:55 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0801MB2057; 6:rud5Ew4Gy1mt4WIFUGK6KIHzRng++8Vms6W26XrqXm/dCkv8+JVHOvJPMTbVKzKJ1z4mRhjEOjQaaxOPbjrMZnYKod+49tkQMXlkDgUVYjKbP0oRq6Qr2lWn//ANGYPlTDW4vvmBccAN3J6ELL8YwQeknvZXbYAwpRkR5vRk7iA1DSVMRibMgzf24SODQrbRUaEQYKwbYY5jt3ljue7VEXC5WhtzWw1uP8TE2hVm8zmJnT0CauRLTy/Ud7x43RWhjnWNAfvdv9MLjoW6NnZ4AzCa0ZbCbj8LCc63NgeRA8kmdNQPy1O3btgds5nblaClf1PYnm2c7FLo2bTMPDmXlA==; 5:r6I76qoPP2nM4vNEDHcG19ZzjZ+JL73K8myb0DT0n+F1Z6FJGM2HwAXP16M+7wcQ6DUqBKJlJwqtDDaf0HbWEgbBwYoe6Rs4TPfZuL/X318SX6Nc5878i9SYE5XDbR/0+HTCshoLJugaH5WWrdBRpw==; 24:FiPcM3BjMvg88FAg57DUenxeqiL7PhJ3wSBwiJl3zFlEtJOpMCvOdvobx7sQGOD8c3oKXHnU39JZiYCQzjVknkldK9YM2KJscoS0XSzQ2eA=; 7:jdTvnqZBFjLGcdEZ+SyJZp++eR8RzFlk/+G+AYkZ446AAZfT09seLTNhTJTBCMzMEuCq385fDJbnhXn1Xn2HhqhI0GIAc2BNE6Rcna71rSX6TC/L3KcFC3YF783Hmrdea/aZiNlahrd2KxLfWI2jt2stqMUh8dg65jgQSKUyOVSDUODy0bmK2Jl/7b0zo1J/FPOmr5qtYLV8trTQ+IG1CUVuExIOzxKuQQ68xhTLBcA= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 9b07fd6a-fe8a-435d-066d-08d526b6dba6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:HE1PR0801MB2057; x-ms-traffictypediagnostic: HE1PR0801MB2057: nodisclaimer: True x-exchange-antispam-report-test: UriScan:(180628864354917)(22074186197030)(183786458502308); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3231021)(10201501046)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0801MB2057; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0801MB2057; x-forefront-prvs: 0485417665 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(199003)(54534003)(377424004)(189002)(2900100001)(53936002)(8936002)(81156014)(81166006)(6306002)(55016002)(14454004)(4326008)(68736007)(9686003)(8676002)(5660300001)(6916009)(101416001)(50986999)(2351001)(74316002)(102836003)(6116002)(305945005)(7696004)(3846002)(106356001)(54356999)(72206003)(66066001)(7736002)(105586002)(966005)(3660700001)(33656002)(3280700002)(316002)(99286004)(478600001)(97736004)(575784001)(86362001)(189998001)(5640700003)(2501003)(25786009)(6436002)(6506006)(2906002)(5250100002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB2057; H:HE1PR0801MB2058.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b07fd6a-fe8a-435d-066d-08d526b6dba6 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2017 14:41:55.2381 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2057 This is based on discussion in https://gcc.gnu.org/ml/gcc-patches/2017-10/msg02096.html. Currently math_errhandling is always set to MATH_ERRNO | MATH_ERREXCEPT even if -fno-math-errno is used. It is not defined at all when fast-math is used, eventhough the GLIBC implementation always supports exceptions (on hardware floating point implementations). Improve this to take __NO_MATH_ERRNO__ into account and update comment. OK for commit? ChangeLog: 2017-11-08 Wilco Dijkstra * math/math.h (math_errhandling): Add __NO_MATH_ERRNO__ check. diff --git a/math/math.h b/math/math.h index 5ad8156555daf583514e214c2de0aca782871788..d46c26533eff01dfbcee8f59d022febdbdb8d769 100644 --- a/math/math.h +++ b/math/math.h @@ -506,10 +506,15 @@ enum # define MATH_ERRNO 1 /* errno set by math functions. */ # define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */ -/* By default all functions support both errno and exception handling. - In gcc's fast math mode and if inline functions are defined this - might not be true. */ -# ifndef __FAST_MATH__ +/* By default all math functions support both errno and exception handling + (except for soft floating point implementations which may only support + errno handling). If errno handling is disabled, exceptions are still + supported by GLIBC. If a target adds inlines which do not support + exceptions, math_errhandling must be undefined (since setting it to 0 + is not standard compliant). */ +# ifdef __NO_MATH_ERRNO__ +# define math_errhandling (MATH_ERREXCEPT) +# else # define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT) # endif