public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] i386: Do not constrain fmod and remainder patterns with flag_finite_math_only [PR108922]
Date: Mon, 27 Feb 2023 22:12:30 +0100	[thread overview]
Message-ID: <CAFULd4Yv=nDsbvSbsUxOnu3eBjF4hrQfcQ72YuM7Vn8Em+QLaA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

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  <ubizjak@gmail.com>

gcc/ChangeLog:

    PR target/108922
    Revert:
    * config/i386/i386.md (fmodxf3): Enable for flag_finite_math_only only.
    (fmod<mode>3): Ditto.
    (fpremxf4_i387): Ditto.
    (reminderxf3): Ditto.
    (reminder<mode>3): Ditto.
    (fprem1xf4_i387): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Pushed to master.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 2006 bytes --]

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);
 

                 reply	other threads:[~2023-02-27 21:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFULd4Yv=nDsbvSbsUxOnu3eBjF4hrQfcQ72YuM7Vn8Em+QLaA@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).