Skip to content

Commit

Permalink
i386: Do not constrain fmod and remainder patterns with flag_finite_m…
Browse files Browse the repository at this point in the history
…ath_only [PR108922]

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.
  • Loading branch information
ubizjak committed Feb 27, 2023
1 parent ab76d71 commit 8020c9c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions gcc/config/i386/i386.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 ();

Expand All @@ -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);

Expand Down Expand Up @@ -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")
Expand All @@ -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 ();

Expand All @@ -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);

Expand Down

0 comments on commit 8020c9c

Please sign in to comment.