From patchwork Mon Sep 2 10:10:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1156543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508147-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HnhFXflX"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46MQpB59X2z9s7T for ; Mon, 2 Sep 2019 20:10:56 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=qbGsJhXP39Duj+yC vEJ/8HPNQVdNehBNsvjrFxg8BWd8qkjrljXfq5T5+NQ2v2bElW5fLeYDHi3L32Yl AGjGiuMMVwL4gzJo21szpAZUNHUc+n/Dfok3jTU29ZmtDrD59MKGxFd4D06NDdx4 d0aQWQkwi3uT06owfeJBDwg27yE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=cDL8RygMI9cKlSP+aSqp8E i2Crg=; b=HnhFXflXu5HH1LXyT5E4Cv8QFiUf1s/HtXS2HsLS/w2mOwhDSoUYRl YiRv57k+RQZOqd+OdMOFeyUMHW2IdIYeXbpFilztvTc92Q+4zQJfKWXCRqOjiZcf /nhpp5c3Mbpnc35HedsTBhefG4fHCWpw5RA28RjhrnrQQhLrTlJ5w= Received: (qmail 81739 invoked by alias); 2 Sep 2019 10:10:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 81730 invoked by uid 89); 2 Sep 2019 10:10:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=honor X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Sep 2019 10:10:46 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C3E5181354 for ; Mon, 2 Sep 2019 12:10:43 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M2h7EHsznVuV for ; Mon, 2 Sep 2019 12:10:43 +0200 (CEST) Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 954488134C for ; Mon, 2 Sep 2019 12:10:43 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Fix PR target/91323 Date: Mon, 02 Sep 2019 12:10:41 +0200 Message-ID: <2430409.BTmyXs74Kb@polaris> MIME-Version: 1.0 The SPARC back-end was aligned on the x86 back-end wrt LTGT so it needs to be changed too. The patch also changes the wording of the description of the operator in doc/generic.texi, rtl.def and tree.def. Tested on SPARC/Solaris, approved by Richard B. and applied on the mainline. 2019-09-02 Eric Botcazou 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. Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 275270) +++ config/sparc/sparc.c (working copy) @@ -3203,13 +3203,13 @@ select_cc_mode (enum rtx_code op, rtx x, case UNGT: case UNGE: case UNEQ: - case LTGT: return CCFPmode; case LT: case LE: case GT: case GE: + case LTGT: return CCFPEmode; default: Index: doc/generic.texi =================================================================== --- doc/generic.texi (revision 275068) +++ doc/generic.texi (working copy) @@ -1564,21 +1564,23 @@ allows the backend to choose between the @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. Index: rtl.def =================================================================== --- rtl.def (revision 275068) +++ rtl.def (working copy) @@ -552,20 +552,25 @@ DEF_RTL_EXPR(POST_INC, "post_inc", "e", 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_COM 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. */ Index: tree.def =================================================================== --- tree.def (revision 275068) +++ tree.def (working copy) @@ -793,9 +793,12 @@ DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_ 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_com 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 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