From patchwork Sat Jul 20 19:01:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Caprioli X-Patchwork-Id: 1962800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hpkfft.com header.i=@hpkfft.com header.a=rsa-sha256 header.s=nwywpfg6u4ltuojsafy5zvkyzh4y76wy header.b=iObVcvei; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amazonses.com header.i=@amazonses.com header.a=rsa-sha256 header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=S0Rwi72P; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WRG9b0NyMz20FS for ; Sun, 21 Jul 2024 05:01:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 242D23857000 for ; Sat, 20 Jul 2024 19:01:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from a11-79.smtp-out.amazonses.com (a11-79.smtp-out.amazonses.com [54.240.11.79]) by sourceware.org (Postfix) with ESMTPS id 971A13858C41 for ; Sat, 20 Jul 2024 19:01:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 971A13858C41 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=hpkfft.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mail.hpkfft.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 971A13858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=54.240.11.79 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721502078; cv=none; b=bppiBMuVC1ZpvmgtENlrff6gxJdR8YfrEKA9RpM6oznkmeY+QldFb49CsycODMtf7U8ugJ6GufmRD0ech3L0y2NcaEAr4b6e4J3U/aYJIcMv9LWfBh0yA4L+/wWI+/7+nVeNsW2hLuoI/XHkE+XEpkAVGB4fzrZMP7NtTr8mNQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721502078; c=relaxed/simple; bh=Ufv7qBWO3BhBjS8jy3bPyZKjPVMlQzieNhkuFqpfOWg=; h=DKIM-Signature:DKIM-Signature:Subject:From:To:Date:Mime-Version: Message-ID; b=MmciwStM/yhQRnnz3voqNUVH+lYu2tRTew36blTJ0rxPZyY6tz6G/Nyh7tABzlf7VTchig87AY9ylkTehKHOrZWBKtmSfzBNmC3J9Dq9tQNm9/PnBDm5jLBUTAN7GYUocR3a6Ifb42scmF9Gm5ZUWPepo6S5lBlP33QyFGS2IGY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=nwywpfg6u4ltuojsafy5zvkyzh4y76wy; d=hpkfft.com; t=1721502075; h=Subject:From:To:Date:Mime-Version:Content-Type:References:Message-Id; bh=Ufv7qBWO3BhBjS8jy3bPyZKjPVMlQzieNhkuFqpfOWg=; b=iObVcveiokBTU+A0tjZGFwTQ3b/OSnbc60trNqK+9+tNONR1pXdoeXLuWp0CZhPD Xfwn7Tflh7dqVWnqiZa9JKMwAwafI685/l/JFYtggmUTPiHcostV5wF9H0WC1gYg+zI OdrrPQnHY2bP3oyBZCVvijwI46dAzejlHZPeuUxPyRO1LO3CN1keOCp3SydCwkf3cqf F6tPiFkVOA62KAhNdAtCwOjQz25RRh1Qofwx9gmf/8HRKFc17CT0rAb1DYHc0dPDPDQ lcZiRMTh4pvxM3ZB0ehSj+6d+CBwa3U+Xca1k7lbkkDnezT/2JYdP2n1IDPr0E6qbTQ dvBEbuUXbw== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1721502075; h=Subject:From:To:Date:Mime-Version:Content-Type:References:Message-Id:Feedback-ID; bh=Ufv7qBWO3BhBjS8jy3bPyZKjPVMlQzieNhkuFqpfOWg=; b=S0Rwi72PBvAyXXEAMu1DKplzXU/vbyffXmNke+dcBz+noGZeD7eu7Y21GRUwvpfr MXchDE6lvj3I8j8so6SXiXl3sGunI3nxhsji6J4up1SNTYfb31NrQfVe/LMVRUYxfCI 9sWgMw9EQhtXUXjQ5blqd2vymsOibJNONFCLdlYQ= Subject: [PATCH] i386: Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h From: =?utf-8?q?Paul_Caprioli?= To: =?utf-8?q?gcc-patches=40gcc=2Egnu=2Eorg?= Date: Sat, 20 Jul 2024 19:01:14 +0000 Mime-Version: 1.0 References: X-Priority: 3 (Normal) X-Mailer: Amazon WorkMail Thread-Index: AQHa2tRB8yZ7RCvJS1yJKrxD47jBOw== Thread-Topic: [PATCH] i386: Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h X-Wm-Sent-Timestamp: 1721502074 Message-ID: <01000190d185078f-83c7be3e-4bc6-4177-aae2-d4c50c4a09dc-000000@email.amazonses.com> Feedback-ID: ::1.us-east-1.LF00NED762KFuBsfzrtoqw+Brn/qlF9OYdxWukAhsl8=:AmazonSES X-SES-Outgoing: 2024.07.20-54.240.11.79 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to specify the floating point rounding mode. This and similar instructions do NOT round their result to an integer. Thus it is inappropriate for user code to specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the nearest floating point number. This patch adds a suitable macro definition. Note that some few instructions, e.g., `ROUNDPS`, do round to an integer, so the existing macro definition ought not be deprecated. Note that IEEE Std 754-2019 for floating-point arithmetic specifies two rounding direction attributes to nearest: `roundTiesToEven` and `roundTiesToAway`. Also, it specifies three directed rounding attributes: `roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`. This patch follows that IEEE naming precedent. As hardware correctly implements that IEEE rounding attribute, it seems best not to innovate in naming the macro.... Please note that I do not have write access to the git repo and that I am not a member of this email alias. Your adding paul@hpkfft.com to any discussions would be appreciated. Regards, Paul From 0e2ceddffed88dab9cc459f7efcab2e36e1cb7e3 Mon Sep 17 00:00:00 2001 From: Paul Caprioli Date: Sat, 20 Jul 2024 11:31:06 -0700 Subject: [PATCH] Add _MM_FROUND_TIES_TO_EVEN to smmintrin.h --- gcc/config/i386/smmintrin.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/i386/smmintrin.h b/gcc/config/i386/smmintrin.h index 4c315feec36..b194659ae06 100644 --- a/gcc/config/i386/smmintrin.h +++ b/gcc/config/i386/smmintrin.h @@ -39,6 +39,7 @@ /* Rounding mode macros. */ #define _MM_FROUND_TO_NEAREST_INT 0x00 +#define _MM_FROUND_TIES_TO_EVEN 0x00 #define _MM_FROUND_TO_NEG_INF 0x01 #define _MM_FROUND_TO_POS_INF 0x02 #define _MM_FROUND_TO_ZERO 0x03 -- 2.39.2