* [PATCH] Signed zero for {max,min}val intrinsics
@ 2018-08-22 20:06 Janne Blomqvist
2018-08-23 1:02 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Janne Blomqvist @ 2018-08-22 20:06 UTC (permalink / raw)
To: fortran, gcc-patches; +Cc: Janne Blomqvist
The Fortran standard specifies (e.g. F2018 7.4.3.2) that intrinsic
procedures shall treat positive and negative real zero as equivalent,
unless it is explicitly specified otherwise. For {max,min}val there
is no such explicit mention. Thus, remove code to handle signed
zeros.
Regtested on x86_64-pc-linux-gnu, Ok for trunk?
2018-08-22 Janne Blomqvist <blomqvist.janne@gmail.com>
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxval): Delete
HONOR_SIGNED_ZEROS checks.
---
gcc/fortran/trans-intrinsic.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 387cf80b921..b2cea93742a 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5511,22 +5511,10 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
{
/* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or
signed zeros. */
- if (HONOR_SIGNED_ZEROS (DECL_MODE (limit)))
- {
- tmp = fold_build2_loc (input_location, op, logical_type_node,
- arrayse.expr, limit);
- ifbody = build2_v (MODIFY_EXPR, limit, arrayse.expr);
- tmp = build3_v (COND_EXPR, tmp, ifbody,
- build_empty_stmt (input_location));
- gfc_add_expr_to_block (&block2, tmp);
- }
- else
- {
- tmp = fold_build2_loc (input_location,
- op == GT_EXPR ? MAX_EXPR : MIN_EXPR,
- type, arrayse.expr, limit);
- gfc_add_modify (&block2, limit, tmp);
- }
+ tmp = fold_build2_loc (input_location,
+ op == GT_EXPR ? MAX_EXPR : MIN_EXPR,
+ type, arrayse.expr, limit);
+ gfc_add_modify (&block2, limit, tmp);
}
if (fast)
@@ -5535,8 +5523,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or
signed zeros. */
- if (HONOR_NANS (DECL_MODE (limit))
- || HONOR_SIGNED_ZEROS (DECL_MODE (limit)))
+ if (HONOR_NANS (DECL_MODE (limit)))
{
tmp = fold_build2_loc (input_location, op, logical_type_node,
arrayse.expr, limit);
@@ -5598,8 +5585,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* MIN_EXPR/MAX_EXPR has unspecified behavior with NaNs or
signed zeros. */
- if (HONOR_NANS (DECL_MODE (limit))
- || HONOR_SIGNED_ZEROS (DECL_MODE (limit)))
+ if (HONOR_NANS (DECL_MODE (limit)))
{
tmp = fold_build2_loc (input_location, op, logical_type_node,
arrayse.expr, limit);
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Signed zero for {max,min}val intrinsics
2018-08-22 20:06 [PATCH] Signed zero for {max,min}val intrinsics Janne Blomqvist
@ 2018-08-23 1:02 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2018-08-23 1:02 UTC (permalink / raw)
To: Janne Blomqvist, fortran, gcc-patches
On 08/22/2018 01:06 PM, Janne Blomqvist wrote:
> The Fortran standard specifies (e.g. F2018 7.4.3.2) that intrinsic
> procedures shall treat positive and negative real zero as equivalent,
> unless it is explicitly specified otherwise. For {max,min}val there
> is no such explicit mention. Thus, remove code to handle signed
> zeros.
>
> Regtested on x86_64-pc-linux-gnu, Ok for trunk?
Looks good, OK.
Thanks,
Jerry
---snip---
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-23 1:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22 20:06 [PATCH] Signed zero for {max,min}val intrinsics Janne Blomqvist
2018-08-23 1:02 ` Jerry DeLisle
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).