Commit 000a5f8d by Eric Botcazou Committed by Eric Botcazou

re PR target/91323 (LTGT rtx produces UCOMISS instead of COMISS)

	PR target/91323
	* doc/generic.texi (LTGT_EXPR): Merge with other comparison operators.
	* rtl.def (LTGT): Likewise.  Add note about floating-point exceptions.
	* tree.def (LTGT_EXPR): Likewise.
	* config/sparc/sparc.c (select_cc_mode): Return CCFPEmode for LTGT.

From-SVN: r275303
parent 976f9aa1
2019-09-02 Eric Botcazou <ebotcazou@adacore.com>
PR target/91323
* doc/generic.texi (LTGT_EXPR): Merge with other comparison operators.
* rtl.def (LTGT): Likewise. Add note about floating-point exceptions.
* tree.def (LTGT_EXPR): Likewise.
* config/sparc/sparc.c (select_cc_mode): Return CCFPEmode for LTGT.
2019-09-02 Jakub Jelinek <jakub@redhat.com>
PR go/91617
......
......@@ -3203,13 +3203,13 @@ select_cc_mode (enum rtx_code op, rtx x, rtx y)
case UNGT:
case UNGE:
case UNEQ:
case LTGT:
return CCFPmode;
case LT:
case LE:
case GT:
case GE:
case LTGT:
return CCFPEmode;
default:
......
......@@ -1564,21 +1564,23 @@ allows the backend to choose between the faster of @code{TRUNC_DIV_EXPR},
@itemx LE_EXPR
@itemx GT_EXPR
@itemx GE_EXPR
@itemx LTGT_EXPR
@itemx EQ_EXPR
@itemx NE_EXPR
These nodes represent the less than, less than or equal to, greater
than, greater than or equal to, equal, and not equal comparison
operators. The first and second operands will either be both of integral
type, both of floating type or both of vector type. The result type of
these expressions will always be of integral, boolean or signed integral
vector type. These operations return the result type's zero value for
false, the result type's one value for true, and a vector whose elements
are zero (false) or minus one (true) for vectors.
These nodes represent the less than, less than or equal to, greater than,
greater than or equal to, less or greater than, equal, and not equal
comparison operators. The first and second operands will either be both
of integral type, both of floating type or both of vector type, except for
LTGT_EXPR where they will only be both of floating type. The result type
of these expressions will always be of integral, boolean or signed integral
vector type. These operations return the result type's zero value for false,
the result type's one value for true, and a vector whose elements are zero
(false) or minus one (true) for vectors.
For floating point comparisons, if we honor IEEE NaNs and either operand
is NaN, then @code{NE_EXPR} always returns true and the remaining operators
always return false. On some targets, comparisons against an IEEE NaN,
other than equality and inequality, may generate a floating point exception.
other than equality and inequality, may generate a floating-point exception.
@item ORDERED_EXPR
@itemx UNORDERED_EXPR
......@@ -1596,15 +1598,13 @@ and the result type's one value for true.
@itemx UNGT_EXPR
@itemx UNGE_EXPR
@itemx UNEQ_EXPR
@itemx LTGT_EXPR
These nodes represent the unordered comparison operators.
These operations take two floating point operands and determine whether
the operands are unordered or are less than, less than or equal to,
greater than, greater than or equal to, or equal respectively. For
example, @code{UNLT_EXPR} returns true if either operand is an IEEE
NaN or the first operand is less than the second. With the possible
exception of @code{LTGT_EXPR}, all of these operations are guaranteed
not to generate a floating point exception. The result
NaN or the first operand is less than the second. All these operations
are guaranteed not to generate a floating point exception. The result
type of these expressions will always be of integral or boolean type.
These operations return the result type's zero value for false,
and the result type's one value for true.
......
......@@ -552,20 +552,25 @@ DEF_RTL_EXPR(POST_INC, "post_inc", "e", RTX_AUTOINC)
DEF_RTL_EXPR(PRE_MODIFY, "pre_modify", "ee", RTX_AUTOINC)
DEF_RTL_EXPR(POST_MODIFY, "post_modify", "ee", RTX_AUTOINC)
/* Comparison operations. The ordered comparisons exist in two
flavors, signed and unsigned. */
/* Comparison operations. The first 6 are allowed only for integral,
floating-point and vector modes. LTGT is only allowed for floating-point
modes. The last 4 are allowed only for integral and vector modes.
For floating-point operations, if either operand is a NaN, then NE returns
true and the remaining operations return false. The operations other than
EQ and NE may generate an exception on quiet NaNs. */
DEF_RTL_EXPR(NE, "ne", "ee", RTX_COMM_COMPARE)
DEF_RTL_EXPR(EQ, "eq", "ee", RTX_COMM_COMPARE)
DEF_RTL_EXPR(GE, "ge", "ee", RTX_COMPARE)
DEF_RTL_EXPR(GT, "gt", "ee", RTX_COMPARE)
DEF_RTL_EXPR(LE, "le", "ee", RTX_COMPARE)
DEF_RTL_EXPR(LT, "lt", "ee", RTX_COMPARE)
DEF_RTL_EXPR(LTGT, "ltgt", "ee", RTX_COMM_COMPARE)
DEF_RTL_EXPR(GEU, "geu", "ee", RTX_COMPARE)
DEF_RTL_EXPR(GTU, "gtu", "ee", RTX_COMPARE)
DEF_RTL_EXPR(LEU, "leu", "ee", RTX_COMPARE)
DEF_RTL_EXPR(LTU, "ltu", "ee", RTX_COMPARE)
/* Additional floating point unordered comparison flavors. */
/* Additional floating-point unordered comparison flavors. */
DEF_RTL_EXPR(UNORDERED, "unordered", "ee", RTX_COMM_COMPARE)
DEF_RTL_EXPR(ORDERED, "ordered", "ee", RTX_COMM_COMPARE)
......@@ -576,9 +581,6 @@ DEF_RTL_EXPR(UNGT, "ungt", "ee", RTX_COMPARE)
DEF_RTL_EXPR(UNLE, "unle", "ee", RTX_COMPARE)
DEF_RTL_EXPR(UNLT, "unlt", "ee", RTX_COMPARE)
/* This is an ordered NE, ie !UNEQ, ie false for NaN. */
DEF_RTL_EXPR(LTGT, "ltgt", "ee", RTX_COMM_COMPARE)
/* Represents the result of sign-extending the sole operand.
The machine modes of the operand and of the SIGN_EXTEND expression
determine how much sign-extension is going on. */
......
......@@ -793,9 +793,12 @@ DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", tcc_expression, 2)
DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", tcc_expression, 1)
/* Relational operators.
`EQ_EXPR' and `NE_EXPR' are allowed for any types.
The others are allowed only for integer (or pointer or enumeral)
or real types.
EQ_EXPR and NE_EXPR are allowed for any types. The others, except for
LTGT_EXPR, are allowed only for integral, floating-point and vector types.
LTGT_EXPR is allowed only for floating-point types.
For floating-point operators, if either operand is a NaN, then NE_EXPR
returns true and the remaining operators return false. The operators
other than EQ_EXPR and NE_EXPR may generate an exception on quiet NaNs.
In all cases the operands will have the same type,
and the value is either the type used by the language for booleans
or an integer vector type of the same size and with the same number
......@@ -805,10 +808,11 @@ DEFTREECODE (LT_EXPR, "lt_expr", tcc_comparison, 2)
DEFTREECODE (LE_EXPR, "le_expr", tcc_comparison, 2)
DEFTREECODE (GT_EXPR, "gt_expr", tcc_comparison, 2)
DEFTREECODE (GE_EXPR, "ge_expr", tcc_comparison, 2)
DEFTREECODE (LTGT_EXPR, "ltgt_expr", tcc_comparison, 2)
DEFTREECODE (EQ_EXPR, "eq_expr", tcc_comparison, 2)
DEFTREECODE (NE_EXPR, "ne_expr", tcc_comparison, 2)
/* Additional relational operators for floating point unordered. */
/* Additional relational operators for floating-point unordered. */
DEFTREECODE (UNORDERED_EXPR, "unordered_expr", tcc_comparison, 2)
DEFTREECODE (ORDERED_EXPR, "ordered_expr", tcc_comparison, 2)
......@@ -819,9 +823,6 @@ DEFTREECODE (UNGT_EXPR, "ungt_expr", tcc_comparison, 2)
DEFTREECODE (UNGE_EXPR, "unge_expr", tcc_comparison, 2)
DEFTREECODE (UNEQ_EXPR, "uneq_expr", tcc_comparison, 2)
/* This is the reverse of uneq_expr. */
DEFTREECODE (LTGT_EXPR, "ltgt_expr", tcc_comparison, 2)
DEFTREECODE (RANGE_EXPR, "range_expr", tcc_binary, 2)
/* Represents a re-association barrier for floating point expressions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment