From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40075.outbound.protection.outlook.com [40.107.4.75]) by sourceware.org (Postfix) with ESMTPS id 7E89A3858410 for ; Thu, 28 Oct 2021 14:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E89A3858410 Received: from DB6PR1001CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::25) by AM0PR08MB5521.eurprd08.prod.outlook.com (2603:10a6:208:18a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13; Thu, 28 Oct 2021 14:27:24 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:55:cafe::ca) by DB6PR1001CA0039.outlook.office365.com (2603:10a6:4:55::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Thu, 28 Oct 2021 14:27:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Thu, 28 Oct 2021 14:27:24 +0000 Received: ("Tessian outbound d49ee2bec50d:v108"); Thu, 28 Oct 2021 14:27:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ddac30032d5550ea X-CR-MTA-TID: 64aa7808 Received: from 1822c0c9aae4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4B77900D-0D8A-4EFB-B7F1-0B7BE42E7205.1; Thu, 28 Oct 2021 14:27:17 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1822c0c9aae4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Oct 2021 14:27:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=atDyKcVDD430ffbBYM6bKGPzySVRMTL71EBztyDg2xTQD7j3x0rLj1lnH1TjUWp5IejIf358cDx3B9IBF7rok5twLX3Rx88AILEuzm64Sa4ORsRJP2cDj8rcLk1yH9HZIotKxkgsI3MOGWPkthuELFzYyRz+J2Zz2++59ETcae1P2QbBm1NrxrQLJOgVjHzDWvaJtuE1t01xWo6T37iIj7htnQb2j0xnd45W2USmIsNQY3BeIKHTgSF/2rgggZ1qqqHyNEzBPxE8lSYjfXvgnrnMI5IDOK9sgBJAOdxFQ8kxvGYmA1Fa6Vhu6ArzVg6YT5vXNBUiLdtNVjo0oJWJDw== 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=jBjwXGs/JFTCLfKCfFxxsgBMKB2GcSjjeonWd86bU5A=; b=RN1Net3iud0mozXbrdBrBfwS69U/kqXT7SUAxAe0ikrRo2WZ3yW5fpztPiaU9+b4bqx737/gwGi2lOn5MN+rQ8RabWKnXsbjvawuzczXJ5+4rc3DxNIgDqPFKO4KdVqGZ4YJs1W5vCRpZEAGz6ywlPgal7fCSF3ewopQ9ZlHwvQUjtkfMt+7fC1Gljcuws8NcwON9VF+i9xeMD1r8BNZlcg4y7Hla37F2Sezcl9/YK/PzJDZ1zBgM15FfYjQL65q53xdxjThYgIFxE0l1CQ5B7h8063veqfL3lu78S/ZPpThLtoEaMmiVLO+IZvS7X47QrQt9sr5Dmi5xMHUt5EU0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VE1PR08MB5599.eurprd08.prod.outlook.com (2603:10a6:800:1a1::12) by VE1PR08MB4829.eurprd08.prod.outlook.com (2603:10a6:802:a8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 28 Oct 2021 14:27:09 +0000 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::281b:cded:83ff:1856]) by VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::281b:cded:83ff:1856%3]) with mapi id 15.20.4649.015; Thu, 28 Oct 2021 14:27:09 +0000 From: Wilco Dijkstra To: Adhemerval Zanella CC: 'GNU C Library' Subject: [PATCH v2 3/9] math: Simplify hypotf implementation Thread-Topic: [PATCH v2 3/9] math: Simplify hypotf implementation Thread-Index: AQHXzAX+oXrgbF7q1kSgYEYMVUQF9Q== Date: Thu, 28 Oct 2021 14:27:09 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 4d511711-65ba-5ef5-d74d-39732eb41d5a Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: ea68704f-e6d4-4bca-a460-08d99a1f0f52 x-ms-traffictypediagnostic: VE1PR08MB4829:|AM0PR08MB5521: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BNz2Q0w5T1Ia8WR66UBXHBsMTtZGfz7NvXuArhHa7UJgwEIECR22WtWBPjrsP8LFSnhewFTCEjVmg5F3j1fpecUKqyp7utFKBizSZ1oBXsf8sIZsN0aOGRWh0rcsLI3vzSOSFX+q+VuJV1ZiOQgHylFiuDlaAzXwm2F0thSM3FDvLqTRdxKA0syTwYvsqExEit6scYGzhADKp3m+Qq8JcDc836cVIzP6XShUOFPWW206CIBRrxCSEe64V0MZ4wA+8wtMRG88maSJHBczYz/jJinoLrWlzAyZ2B86S68NXNjrGiD92LJX1ak06Ac67zomwxyRxKfz8oMCv1dvGCl0CykDQj8kwWaMgS9QlXY23LF1MjRKVHD1wbpEVOYYLorWFpAuYjddKB5qS08UPUJ8H9JsXxdQLKKsDn7Q7gySQcKyIOybmEYXMaGVqGcsMUO08qGxiUprO/FHjrdLmHpGQYsYhrz+V6vGsSa+Og6sAd7cDcmeBEuC21SWU7J1FSdpQZVhXwto1ko8SYkJqtwDyOJe3AwK0Txc+W+7bUiNure8fRKuc9eJVkrgJ8voMAFbN6AXTT2BhELvzmNAhGv2QWcnzx9ZsCUHOk2FEspGLYrnXWoVtdESBH1QiXJU4+d7lv0RC+nO3VR7D1et75zM4LC4O9Jt8YGijMUI52NxA7DJUyKKY4ka6vXx95j0RpBcDuXTVM+l4sSyAw7NdcJk1A== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB5599.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(55016002)(52536014)(33656002)(38070700005)(7696005)(66476007)(5660300002)(2906002)(66946007)(6916009)(71200400001)(186003)(122000001)(26005)(9686003)(316002)(8936002)(66446008)(4744005)(8676002)(86362001)(6506007)(508600001)(38100700002)(4326008)(64756008)(66556008)(76116006); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4829 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3e97c517-55c7-460b-a24d-08d99a1f066f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fHq6ERDpHcHK1PPA4BGGZiMUJavPSJCmU64rjUgl89HBz1xJ5y48ID9iy6twWzB55zf7TgMbSGXKP/LwvYtLt8eADpsVIW8/pgG1x+twXkaU48utBOJikZkU6qWDpY3oNnq9ThLB83G+Ur9rfKaYDAqkXlGab+W+k8hEPqWR6mBFcK29a3v066nf9/97wEvIyMgqj31fgkld4kHRVdME3TS14BpxgcOMyPgdoczIozmxWdokPNi39HIZVLou/E7ZSj2mdDzFPEhNcCuDxq3eblShk8EGUoP7KgBqk6JKUD7rHmBSUvAqLHb786vJgQPZR/XbpY4OsSg4IlOU8rTgJDnXK95TwuRy9xa9EAedoy6GbtpWhLGIU42OLovZYjfYcdvi7+fWOm23k7yJY38FqFe7Tq/8GMBQ6jhBVnHTI/FuCbr4T7ZWmRNajG77txd3BmPflQxsSbOpZFhE6JeT9HcAN91gZkLgW1RCmj4H8rxSFxCTqkVg2KnmTLwCzW+5uteKqTLSdyooOgKurXR/UpZM5YokrRdhzdp4WqWVjNIoKPBfw5PRrqND8x+ObW1himGm8eDcTbaX9r16tXxvokwmkPaDrk2vV+t112IcHAlJyf1QUL8NsyTT0X1Q/mDg229pMFYnZBnkEvCGgW5uC8QdPRaV+v0eZhmCxDw5FsJb1p9NakPsr5ATj2p6w/qImMM2qgXk9CDXo2VtcQhB0g== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(82310400003)(36860700001)(316002)(8936002)(33656002)(7696005)(2906002)(70586007)(186003)(70206006)(5660300002)(336012)(86362001)(508600001)(4744005)(9686003)(6862004)(26005)(6506007)(55016002)(52536014)(4326008)(8676002)(47076005)(356005)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2021 14:27:24.1298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea68704f-e6d4-4bca-a460-08d99a1f0f52 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5521 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2021 14:27:28 -0000 Hi Adhemerval,=0A= =0A= + if ((isinf (x) || isinf (y))=0A= + && !issignaling (x) && !issignaling (y))=0A= + return INFINITY;=0A= + if (isnan (x) || isnan (y))=0A= + return x + y;=0A= =0A= These checks are inefficient. It's partly because GCC uses FP comparisons f= or=0A= isinf/isnan when integer arithmetic is faster on almost all targets and mor= e=0A= correct for signaling NaNs. However GCC doesn't seem to treat these as=0A= unlikely and so there are 3 comparisons and 3 taken branches before enterin= g=0A= the main code. If you change it to:=0A= =0A= if (!isfinite (x) || !isfinite (y))=0A= {=0A= if ((isinf (x) || isinf (y))=0A= && !issignaling (x) && !issignaling (y))=0A= return INFINITY;=0A= return x + y;=0A= }=0A= =0A= then it uses only 2 comparisons and we fallthrough into the common case.=0A= This gives a speedup of 10%.=0A= =0A= Wilco=