From patchwork Tue Jul 18 11:17:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Ramsay X-Patchwork-Id: 72848 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E162385734E for ; Tue, 18 Jul 2023 11:18:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E162385734E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689679097; bh=vO7A3KxiurAlhJ7wPETyohEILvAlhjOhGJWNgernujo=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=FXl4n9KnD2d4KzQz62Iu3/HHBp/6g3hwp1V8GzSkL6+NV08R7tXJpZCpZ93A3R4mn mgJ39lw+jdSPQuzbRWYNaFHnHfYPuddDRjEN5Vu3UsFfMRSMwtBTp1r1BEzhfv0vaw u1HeCHfG3Ikb73T1OWed4POwqUcLzzctR/+A3coM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2082.outbound.protection.outlook.com [40.107.14.82]) by sourceware.org (Postfix) with ESMTPS id AA7383857438 for ; Tue, 18 Jul 2023 11:17:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA7383857438 Received: from DB8PR09CA0027.eurprd09.prod.outlook.com (2603:10a6:10:a0::40) by AM7PR08MB5448.eurprd08.prod.outlook.com (2603:10a6:20b:106::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 11:17:46 +0000 Received: from DBAEUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:a0:cafe::bc) by DB8PR09CA0027.outlook.office365.com (2603:10a6:10:a0::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 11:17:46 +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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT021.mail.protection.outlook.com (100.127.142.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 11:17:46 +0000 Received: ("Tessian outbound e1fdbe8a48d3:v145"); Tue, 18 Jul 2023 11:17:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c6696fc92b59b77b X-CR-MTA-TID: 64aa7808 Received: from 46747ef4a922.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F82666F2-9B4E-4FA6-8E37-4DD212D7E172.1; Tue, 18 Jul 2023 11:17:40 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 46747ef4a922.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 18 Jul 2023 11:17:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bI/Qvng2seac9IdJ3TYEnsSt08249OsS/9B64nBDH1JWG/pEAzEyIoyFzxl15C5JlTsxNHdLe695JsyxszAREYOwWDMEEm4PmONhkoA78imB+mxxU96Qwy4c5vYNx79DqfLctObeQNg5LJV53AXoYIoNP+dFgYhD+VgsjZfCkqyAgB5uX5uyUk1THk+2jp+xpAlgMfcEzLVKqfnC2GUYkLxX3tOOlQY3TbaTafWV/goaK5fTF2eRkbHOa6I8vF4+w9+/l3gfsEqUxyY19tBzwZpEHUzDRZXbdAMU6dKSbo9KR/feyFOOxOXUSlBkTwKfJ67dvdaMV5qRBz0W774FLw== 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=vO7A3KxiurAlhJ7wPETyohEILvAlhjOhGJWNgernujo=; b=mHFt9mTlKP7dejdhYefVtKge4B5xvqDlrtEYq3QwE2W6fc+fkvoUPQoVmejl3xt/PhOKg86P4/DCw1VyJT7WTGoJLRhDwJIPBCNf8J5Wr/RpG0KD1BdhZZt7f5FHv1SCVG9Z9984gbF3NN9e4Lzqo1f7gnu7mOBsxhHo+8vY4x2kHed6V2g2tAvmJjn2dRydhqzyomHpLLVMt9zmsXfLLGyn7SbZz7Ux2i/lD5c9ziznzImgKin7Mv6NY+Efvpl8n3rFm0RXwVq1IMCfpJX3GGVDXHZmM4BEp6zVVl5AywgpjT4alJ4T+dtnHs2wS4oBVUgUWXIB3VP27wE7Frbh6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from DB8PR06CA0046.eurprd06.prod.outlook.com (2603:10a6:10:120::20) by AM9PR08MB6241.eurprd08.prod.outlook.com (2603:10a6:20b:281::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Tue, 18 Jul 2023 11:17:38 +0000 Received: from DBAEUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::ec) by DB8PR06CA0046.outlook.office365.com (2603:10a6:10:120::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 11:17:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT027.mail.protection.outlook.com (100.127.142.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 11:17:38 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 18 Jul 2023 11:17:37 +0000 Received: from vcn-man-apps.manchester.arm.com (10.32.108.22) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 18 Jul 2023 11:17:37 +0000 To: CC: Joe Ramsay Subject: [RFC] Disable -0 tests for vecmath routines Date: Tue, 18 Jul 2023 12:17:35 +0100 Message-ID: <20230718111735.40295-1-Joe.Ramsay@arm.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT027:EE_|AM9PR08MB6241:EE_|DBAEUR03FT021:EE_|AM7PR08MB5448:EE_ X-MS-Office365-Filtering-Correlation-Id: 76c72575-b9e6-43ab-a5a7-08db87809d45 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mafcvviDLCz5VshcZHJSeqs3KfI3SQcwPyYQqrvzDgvHiBHskcd4bta+M9YDzoKdD9i697sfjI6qmJsnzM5TYh0pipaSNm4kOg621dnPjnMSd/mEOs2VkqPvmOSScoqpkr93TNjxYE2o5RWP2DM7d/aT2cpabbHBizPyvqr/T+hgBp6qzt894yYv9BUKaKEfkumK66XeEcupie3Emqwp5e1W6ufyrfIBXAEkKsMTwVc3LR7T5d23nITEWwgKeqg6P5jIJbtFU0bXGNwZKfca+KCC8gW/2xoDBLVRZaICaTEPNT8qTerXl+lSqg4O3o+/AbnCNN9W6Vyu/RPWrziLvthaWnK/MOHTW3VFEFHz0yjMOs5BUIX/BozihvZVtRRNUT695HEssDpDOWM2DhoXz++FJG6sMkJji6dAcdgFr+cL4MrmJsHmQ8+04wNIy4czGRMHOqZk6Tb57GD6RhwN25hcizoGTGJKrfus5mfd3P+84wEcujjvXC4WMhugri2O3mCgDFq8N9X6UFYDGX5xqFNnKa14+FSb0gI8tYWXUstwp8DDVBKdnn33WAmtxCPDJNJc5VgrhKRN1ELe/VrCd3eQPbOp2vhZm7a3WLqQliRdgGb+xdstwFpRDsU0yAQNtAy+S3vz31ThtX6BHxSAcRrTySPfX2OWpKEbHvD+LKYMTX5K3feqnRP5WEq3oHlwNoqbq+oXegEj9iFhbe3pkIfoozzNU4WacwyBsodpzfsStvKFU5c4fgBRE790d3hypL+mMfdwTv1PUv7ASMVcNw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(82310400008)(451199021)(46966006)(36840700001)(40470700004)(86362001)(8936002)(316002)(5660300002)(4326008)(8676002)(70586007)(70206006)(41300700001)(478600001)(2906002)(7696005)(26005)(1076003)(186003)(6916009)(426003)(336012)(36860700001)(83380400001)(2616005)(47076005)(40480700001)(36756003)(40460700003)(81166007)(356005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6241 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 08ff8e23-b350-4de3-6ec2-08db8780981d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RHOUik7IJgtNocMqQytaCE/pg6IwsYDxGOQub2ku7e73LNgzEm5Z88gDzmtfAUR4jCyyxPN20nloJu8Jg/u4Cbkh1q1ovXd9YOR5t3EuoWtPxzhzrq0nvXsHm97HfjhbIkkV+A1QaRwMQDmzonuhoxLYnDJqLZqCfk/UUfH7LnsaGeny117FflX5DbW1M9aUsJcy3F2G/k560DsZarDzMDtJWaiGi8oqBn9QLyB9MC0VGGoNm5K953qgfjDCn5/37KI+OpBIjr0U2DXGyDhiX+sk5VpBvWYRbyzUdvgpv4Eosrs7b9rBGQpsMXZoGA/cXGrL+lxUApBB6XDRzvCSTo+zKt5xuOOXQ9IKcFDio8lXhrah6geVJRjbDDYOfyy1A5wkuG8NHtt5QH+koRnljLek7L5P6KtLRJVJ6PxwQk7jWsJVnjm2WRrsBzcn9vI5Ft0z+AZw2+0yVBIYxUTTHmvCHb3W2FOzllMl4BXlDqQlB22YLa4XhCRHWTvfWqPewjx2Ual7zaWoOrE9XcIRJfB9fWFO0lPihUF2AGnB28qKwYB/XASafdxWm6p0ivA3LegxZ1UG5H2yTtLLwUhiVd59G5MhS7kvjA4YacwELMKK/U3kRun+Yb7a4HUdCygXAp0zIKc5wrvF20dIUiKmgtrp1FXBuf9uLSTxYztTGZ5Smo41UZ/XSGmkMmAZJirIfGCpOUGs1trK5Eh8rZhStxSbUOeUIGGwP7jmB+aJ7m8= 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:(13230028)(4636009)(376002)(39860400002)(396003)(346002)(136003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(478600001)(7696005)(426003)(47076005)(83380400001)(86362001)(40460700003)(40480700001)(70586007)(2906002)(1076003)(186003)(36756003)(336012)(2616005)(82740400003)(316002)(81166007)(26005)(6916009)(70206006)(41300700001)(4326008)(8676002)(8936002)(36860700001)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 11:17:46.7051 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76c72575-b9e6-43ab-a5a7-08db87809d45 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: DBAEUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5448 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Joe Ramsay via Libc-alpha From: Joe Ramsay Reply-To: Joe Ramsay Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Hi, This RFC is in response to a query about the AdvSIMD sin routines, which manually fix the sign of zero. These routines are designed to be enabled at -Ofast, where signed zero is disabled, so from the compiler's point of view this special handling is pointless. Because of this it seems reasonable to introduce a mechanism to disable tests for -0 when the routine under test comes from libmvec. However the routines may still be called by devs writing vector code, and this is not one of the caveats described in the libmvec wiki. Maybe it should be? The patch is just to illustrate the kind of simplification that relaxing these tests unlocks. Thanks, Joe --- math/auto-libm-test-out-sin | 4 ++-- math/gen-libm-test.py | 3 ++- sysdeps/aarch64/fpu/sin_advsimd.c | 7 +------ sysdeps/aarch64/fpu/sinf_advsimd.c | 7 +------ 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/math/auto-libm-test-out-sin b/math/auto-libm-test-out-sin index f1d21b179c..27ccaff1aa 100644 --- a/math/auto-libm-test-out-sin +++ b/math/auto-libm-test-out-sin @@ -25,11 +25,11 @@ sin 0 = sin upward ibm128 0x0p+0 : 0x0p+0 : inexact-ok sin -0 = sin downward binary32 -0x0p+0 : -0x0p+0 : inexact-ok -= sin tonearest binary32 -0x0p+0 : -0x0p+0 : inexact-ok += sin tonearest binary32 -0x0p+0 : -0x0p+0 : inexact-ok no-mathvec = sin towardzero binary32 -0x0p+0 : -0x0p+0 : inexact-ok = sin upward binary32 -0x0p+0 : -0x0p+0 : inexact-ok = sin downward binary64 -0x0p+0 : -0x0p+0 : inexact-ok -= sin tonearest binary64 -0x0p+0 : -0x0p+0 : inexact-ok += sin tonearest binary64 -0x0p+0 : -0x0p+0 : inexact-ok no-mathvec = sin towardzero binary64 -0x0p+0 : -0x0p+0 : inexact-ok = sin upward binary64 -0x0p+0 : -0x0p+0 : inexact-ok = sin downward intel96 -0x0p+0 : -0x0p+0 : inexact-ok diff --git a/math/gen-libm-test.py b/math/gen-libm-test.py index 6ae78beb01..a573c3b8cb 100755 --- a/math/gen-libm-test.py +++ b/math/gen-libm-test.py @@ -93,7 +93,8 @@ BEAUTIFY_MAP = {'minus_zero': '-0', # Flags in auto-libm-test-out that map directly to C flags. FLAGS_SIMPLE = {'ignore-zero-inf-sign': 'IGNORE_ZERO_INF_SIGN', - 'xfail': 'XFAIL_TEST'} + 'xfail': 'XFAIL_TEST', + 'no-mathvec': 'NO_TEST_MATHVEC'} # Exceptions in auto-libm-test-out, and their corresponding C flags # for being required, OK or required to be absent. diff --git a/sysdeps/aarch64/fpu/sin_advsimd.c b/sysdeps/aarch64/fpu/sin_advsimd.c index ddc4142599..0389b334cc 100644 --- a/sysdeps/aarch64/fpu/sin_advsimd.c +++ b/sysdeps/aarch64/fpu/sin_advsimd.c @@ -56,7 +56,7 @@ float64x2_t VPCS_ATTR V_NAME_D1 (sin) (float64x2_t x) { const struct data *d = ptr_barrier (&data); float64x2_t n, r, r2, r3, r4, y, t1, t2, t3; - uint64x2_t odd, cmp, eqz; + uint64x2_t odd, cmp; #if WANT_SIMD_EXCEPT /* Detect |x| <= TinyBound or |x| >= RangeVal. If fenv exceptions are to be @@ -70,7 +70,6 @@ float64x2_t VPCS_ATTR V_NAME_D1 (sin) (float64x2_t x) cmp = vcageq_f64 (d->range_val, x); cmp = vceqzq_u64 (cmp); /* cmp = ~cmp. */ #endif - eqz = vceqzq_f64 (x); /* n = rint(|x|/pi). */ n = vfmaq_f64 (d->shift, d->inv_pi, r); @@ -96,10 +95,6 @@ float64x2_t VPCS_ATTR V_NAME_D1 (sin) (float64x2_t x) y = vfmaq_f64 (t3, y, r4); y = vfmaq_f64 (r, y, r3); - /* Sign of 0 is discarded by polynomial, so copy it back here. */ - if (__glibc_unlikely (v_any_u64 (eqz))) - y = vbslq_f64 (eqz, x, y); - if (__glibc_unlikely (v_any_u64 (cmp))) return special_case (x, y, odd, cmp); return vreinterpretq_f64_u64 (veorq_u64 (vreinterpretq_u64_f64 (y), odd)); diff --git a/sysdeps/aarch64/fpu/sinf_advsimd.c b/sysdeps/aarch64/fpu/sinf_advsimd.c index b67d37f2fd..0e78cf55f0 100644 --- a/sysdeps/aarch64/fpu/sinf_advsimd.c +++ b/sysdeps/aarch64/fpu/sinf_advsimd.c @@ -56,7 +56,7 @@ float32x4_t VPCS_ATTR V_NAME_F1 (sin) (float32x4_t x) { const struct data *d = ptr_barrier (&data); float32x4_t n, r, r2, y; - uint32x4_t odd, cmp, eqz; + uint32x4_t odd, cmp; #if WANT_SIMD_EXCEPT uint32x4_t ir = vreinterpretq_u32_f32 (vabsq_f32 (x)); @@ -70,7 +70,6 @@ float32x4_t VPCS_ATTR V_NAME_F1 (sin) (float32x4_t x) cmp = vcageq_f32 (d->range_val, x); cmp = vceqzq_u32 (cmp); /* cmp = ~cmp. */ #endif - eqz = vceqzq_f32 (x); /* n = rint(|x|/pi) */ n = vfmaq_f32 (d->shift, d->inv_pi, r); @@ -89,10 +88,6 @@ float32x4_t VPCS_ATTR V_NAME_F1 (sin) (float32x4_t x) y = vfmaq_f32 (C (0), y, r2); y = vfmaq_f32 (r, vmulq_f32 (y, r2), r); - /* Sign of 0 is discarded by polynomial, so copy it back here. */ - if (__glibc_unlikely (v_any_u32 (eqz))) - y = vbslq_f32 (eqz, x, y); - if (__glibc_unlikely (v_any_u32 (cmp))) return special_case (x, y, odd, cmp); return vreinterpretq_f32_u32 (veorq_u32 (vreinterpretq_u32_f32 (y), odd));