From patchwork Thu Oct 10 16:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1174688 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-510651-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LE2joboO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="El8+X64J"; 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 46px422l6vz9sDQ for ; Fri, 11 Oct 2019 03:14:24 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rHeb3K9MxXhXa3H21t92WKkZV4DywIGt1wqtfz9JdDqYR5s6Mu Qs9mi26VMcukDRO/TBqS77prosP+GlBD7MW5dxOuvSw8Mkn/mX3UzWo7okAfBFX+ jRUelUuobO8P2gIe4arze1O+vYUVHWWAkS2XwyXkoRo5AwqYifzgAOXpo= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=XSSMR+M8r0TWhcUR1ZfDe3Df9hI=; b=LE2joboOwcgH7BMZkRm5 NZ1BowIqaOaxNtz+JYMhzJwKMAye4fnh9j3TgjOCnMrPRXDcu4UQ4pEGdXw9oa8o 65mW41XU3lJlCygIUK/lYiRdIj1x2gnvGyitop/TmFDMIV8QvQZm8wf4Jz7LyuDN 0ufFTgnugHOtsGBEo2Wkfs0= Received: (qmail 118932 invoked by alias); 10 Oct 2019 16:14:16 -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 118880 invoked by uid 89); 10 Oct 2019 16:14:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2019 16:14:09 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9AG5RR2164519; Thu, 10 Oct 2019 16:14:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2019-08-05; bh=hQvEjt7j6/y3iLCIxQyY+CRNMSHvTIEvVDmDlydJ374=; b=El8+X64Jf6pOo9LNK5uTaOTLvaJIaNB6krkgAFYpOYeAdQzwiDwnjIUu8n68AkEz/kaX ec+4b4iyX6bF8BgAwohMGHpW6WNdnb/VcvJybPrXrItekykKpTcjuL+ZyyRzif5d8gkC VJk2ZTQgKO/kTI81dTbHimKNdSj9fIs5bWEerPak5qe4xcwzCXMBEeoeuSwdaFOZH2Q6 y0Sdy8DJ80q1hPU9vBgYhp/XsxQzEJ1jA5vHuymcbYzBgVAm76k3btt0fZ7C7nvz5e3F jNc47Xr0ybLo8mmfLmT/z+Z99jlEaEsfx4FMG6MbKgu99txLlhx4S7H+g3onCB2yQXGF cw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2vejkuv8wx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2019 16:14:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9AG5nGr002720; Thu, 10 Oct 2019 16:12:07 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2vh5cdjq0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2019 16:12:06 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9AGC5c0021441; Thu, 10 Oct 2019 16:12:06 GMT Received: from [192.168.1.4] (/79.18.213.139) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Oct 2019 09:12:05 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Remove RROTATE_EXPR and LROTATE_EXPR handling Message-ID: <6e15b734-8836-07e3-ce58-2b10086a41f7@oracle.com> Date: Thu, 10 Oct 2019 18:12:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, while working on cp_build_binary_op I noticed that the testsuite wasn't exercising the warnings in case RROTATE_EXPR / LROTATE_EXPR, even more the code handling those tree codes seemed completely unused. Turned out that the C front-end doesn't handle those tree codes at all: I'm coming to the conclusion that the C++ front-end bits too are now obsolete and may be removed, because only the middle-end generates those codes in order to implement optimizations. Anything I'm missing? Any additional testing? Tested x86_64-linux. Thanks, Paolo. /////////////////// 2019-10-10 Paolo Carlini * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and LROTATE_EXPR. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_fold): Likewise. * pt.c (tsubst_copy): Likewise. Index: constexpr.c =================================================================== --- constexpr.c (revision 276805) +++ constexpr.c (working copy) @@ -5115,8 +5115,6 @@ cxx_eval_constant_expression (const constexpr_ctx case MAX_EXPR: case LSHIFT_EXPR: case RSHIFT_EXPR: - case LROTATE_EXPR: - case RROTATE_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: case BIT_AND_EXPR: @@ -7103,8 +7101,6 @@ potential_constant_expression_1 (tree t, bool want case MAX_EXPR: case LSHIFT_EXPR: case RSHIFT_EXPR: - case LROTATE_EXPR: - case RROTATE_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: case BIT_AND_EXPR: Index: cp-gimplify.c =================================================================== --- cp-gimplify.c (revision 276805) +++ cp-gimplify.c (working copy) @@ -2468,8 +2468,6 @@ cp_fold (tree x) case MAX_EXPR: case LSHIFT_EXPR: case RSHIFT_EXPR: - case LROTATE_EXPR: - case RROTATE_EXPR: case BIT_AND_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: Index: pt.c =================================================================== --- pt.c (revision 276805) +++ pt.c (working copy) @@ -16308,8 +16308,6 @@ tsubst_copy (tree t, tree args, tsubst_flags_t com case TRUTH_OR_EXPR: case RSHIFT_EXPR: case LSHIFT_EXPR: - case RROTATE_EXPR: - case LROTATE_EXPR: case EQ_EXPR: case NE_EXPR: case MAX_EXPR: @@ -18913,8 +18911,6 @@ tsubst_copy_and_build (tree t, case TRUTH_OR_EXPR: case RSHIFT_EXPR: case LSHIFT_EXPR: - case RROTATE_EXPR: - case LROTATE_EXPR: case EQ_EXPR: case NE_EXPR: case MAX_EXPR: Index: typeck.c =================================================================== --- typeck.c (revision 276805) +++ typeck.c (working copy) @@ -4896,35 +4896,6 @@ cp_build_binary_op (const op_location_t &location, } break; - case RROTATE_EXPR: - case LROTATE_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - result_type = type0; - if (TREE_CODE (op1) == INTEGER_CST) - { - if (tree_int_cst_lt (op1, integer_zero_node)) - { - if (complain & tf_warning) - warning (0, (code == LROTATE_EXPR) - ? G_("left rotate count is negative") - : G_("right rotate count is negative")); - } - else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) - { - if (complain & tf_warning) - warning (0, (code == LROTATE_EXPR) - ? G_("left rotate count >= width of type") - : G_("right rotate count >= width of type")); - } - } - /* Convert the shift-count to an integer, regardless of - size of value being shifted. */ - if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = cp_convert (integer_type_node, op1, complain); - } - break; - case EQ_EXPR: case NE_EXPR: if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)