From patchwork Mon Feb 27 21:12:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 62140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2649466wrd; Mon, 27 Feb 2023 13:13:29 -0800 (PST) X-Google-Smtp-Source: AK7set9dLODn6Tc0t/bUK9pNsIhjdO5/z2zx0+w9VwXjnMEJapljW3Z99TUL6dT0hPMVOM12eGAL X-Received: by 2002:aa7:d158:0:b0:4af:6c28:439a with SMTP id r24-20020aa7d158000000b004af6c28439amr1113629edo.6.1677532408850; Mon, 27 Feb 2023 13:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677532408; cv=none; d=google.com; s=arc-20160816; b=pldr7pQOYgPTOCWTQMwY9yjHNAc2htM10EZ92ji9NwuBC4Tm0atb5iPAcr4uE0Q3SC mKJxGX67G6mGKhuBspeWI9YiPHY1H/yZk6ldJzk9mDAfKQCdz2kjC9sw3ZmZEtNRHR7z LHly0ZpIhchgHvFQRl41yomeb3zTtcrf0eai5qdT+gRkk1jbeZUHDyIZZDAzbA7gWr4v GjDLkyezrb2x66pWddyLxuA1AuKn4leWTMSR374sRgBmeOPNDE3xyqO80x2Wpoajm8Nx sqVVr0EdhPmWFdKvofBWf6x/9uWwl3pABin69Ah8Zimm/EBAX1K/huBgf52pepSqvbhI /Cbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=fhgtoZVKSv4pDAHtgAz1M4jLkaD4w8LLbDfR0lOsKcg=; b=Fif7gjlW9ENmf+D1xbBfWtL+gMSa+wwPcJZY5hU5iojdQySRzI/dZLVqmPU0h0BwVS 9Ywkj1jCzjqUg0tSIf4uwpfeFpEtrxEIAr1+xIs4NjiDy9+Qf1MQW3oWom0gd3Khh3IU Rly3tKB+8nDWQPup23xTzwaiNc3b6h5LRh01/Y2xDA7R+qUqoEsZQ+KwdTPD50VuYOYi aJrR+D938yGyttZ/+xpC+8iwgjN2fc+uL5Iv+/gOb/+aQsI2vqo9WJPiN8WM9o7sT5G5 8yGMu6FVewucZ0+6Lor/T2YpRw1exlbXYB7da9jC6FaWUH52nJkbMvp1qcOxpEcUVeK0 lElw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rSS0PKNG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bf3-20020a0564021a4300b004a0a7d851f5si9725903edb.634.2023.02.27.13.13.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 13:13:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rSS0PKNG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A43343858C52 for ; Mon, 27 Feb 2023 21:13:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A43343858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677532406; bh=fhgtoZVKSv4pDAHtgAz1M4jLkaD4w8LLbDfR0lOsKcg=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rSS0PKNGeDHIAfF6Ut9/JHXG76m1BVJjygbnFh2wuLAcHQHCts8J/GLUlUZCMtdOZ ZPViC1zQSxpfZ02LqmN6t8U7bDqTKPfyeuJTVPDf9etyXP/57BNDtYrfxpdkPMVEpK FBmWgHn0PfwW0VyxVie+DwHOXBMD0fY6++gCEEhI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by sourceware.org (Postfix) with ESMTPS id 50CD73858D32 for ; Mon, 27 Feb 2023 21:12:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50CD73858D32 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-536b7ffdd34so213373757b3.6 for ; Mon, 27 Feb 2023 13:12:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fhgtoZVKSv4pDAHtgAz1M4jLkaD4w8LLbDfR0lOsKcg=; b=NZb0o2RN8t3oUYGYOO9mLZIUKd6YXwst75kJIIw5GsC8ORxwB+YCQ1vvbRaegzqbRT CskL44RIxliwbI1TNqCkzLmycVptLT4u9qq8JYHo9gER7V+Nxjrv2ZaLWH9FT5QyqATN xCqmg8Nv5XagAcXwHhD0aTHY8EjaHkFOdbplbwplAuQh5rdpzyiZOaa5XPwDomKnIY0k pMJSKVyAePyD1kyJOJRPJg8y2TP0lvGU43VCjV7OFLjiu4jzZAhx5O2/Geq4iW97hdrh fq/+hxr61yrYZ6Z4pL+74P1hhS8RMTn+TQvzhiJ9+t4YOZYrpu0s82DlR3QTAqjf4qU8 qu4A== X-Gm-Message-State: AO0yUKXdHRS2KedaMANa5BHgAvhm6NdpmoyqTTRD5P4iWGzysg34Di6i 3wh5I52vOFOWOKWsdtT0GmszHG34UgjQYatHFrWQUj7UipWvhQ== X-Received: by 2002:a25:e210:0:b0:a36:3875:56be with SMTP id h16-20020a25e210000000b00a36387556bemr66119ybe.10.1677532361387; Mon, 27 Feb 2023 13:12:41 -0800 (PST) MIME-Version: 1.0 Date: Mon, 27 Feb 2023 22:12:30 +0100 Message-ID: Subject: [PATCH] i386: Do not constrain fmod and remainder patterns with flag_finite_math_only [PR108922] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759020222640328908?= X-GMAIL-MSGID: =?utf-8?q?1759020222640328908?= According to Intel ISA manual, fprem and fprem1 return NaN when invalid arithmetic exception is generated. This is documented in Table 8-10 of the ISA manual and makes these two instructions fully IEEE compatible. The reverted patch was based on the data from table 3-30 and 3-31 of the Intel ISA manual, where results in case of st(0) being infinity or st(1) being 0 are not specified. 2023-02-27 Uroš Bizjak gcc/ChangeLog: PR target/108922 Revert: * config/i386/i386.md (fmodxf3): Enable for flag_finite_math_only only. (fmod3): Ditto. (fpremxf4_i387): Ditto. (reminderxf3): Ditto. (reminder3): Ditto. (fprem1xf4_i387): Ditto. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Pushed to master. Uros. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 8ebb12be2c9..ed689b044c3 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -19527,8 +19527,7 @@ (set (reg:CCFP FPSR_REG) (unspec:CCFP [(match_dup 2) (match_dup 3)] UNSPEC_C2_FLAG))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" "fprem" [(set_attr "type" "fpspc") (set_attr "znver1_decode" "vector") @@ -19538,8 +19537,7 @@ [(use (match_operand:XF 0 "register_operand")) (use (match_operand:XF 1 "general_operand")) (use (match_operand:XF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx_code_label *label = gen_label_rtx (); @@ -19562,8 +19560,7 @@ [(use (match_operand:MODEF 0 "register_operand")) (use (match_operand:MODEF 1 "general_operand")) (use (match_operand:MODEF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx (*gen_truncxf) (rtx, rtx); @@ -19602,8 +19599,7 @@ (set (reg:CCFP FPSR_REG) (unspec:CCFP [(match_dup 2) (match_dup 3)] UNSPEC_C2_FLAG))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" "fprem1" [(set_attr "type" "fpspc") (set_attr "znver1_decode" "vector") @@ -19613,8 +19609,7 @@ [(use (match_operand:XF 0 "register_operand")) (use (match_operand:XF 1 "general_operand")) (use (match_operand:XF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx_code_label *label = gen_label_rtx (); @@ -19637,8 +19632,7 @@ [(use (match_operand:MODEF 0 "register_operand")) (use (match_operand:MODEF 1 "general_operand")) (use (match_operand:MODEF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx (*gen_truncxf) (rtx, rtx);