From patchwork Wed Nov 23 14:57:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bin.Cheng" X-Patchwork-Id: 698355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tP57W1Yjhz9sXx for ; Thu, 24 Nov 2016 01:58:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="n3YOCFoT"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=i4SBg4ZPIc/aRpM R/jcMfDLL9D++LpVv0Y9SEA0+lbNW7eFkeI8/yjU1U4qFIi6UcIZtN+W+XRiuiON 59U21CSxjLx49/ZhP8SrbNePBNzuvyQRLW80KhyeIbzspQcnexzx5mIkf+kCry2A yThQc+hnaHl9IopFQCoemlqhVt5Q= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; s=default; bh=Lra1kRh96fZEl+6KfG2B7 gp/vlk=; b=n3YOCFoTezzXkx/lGzbw1Ha4oMrDTCNkseh3Q78Q840D/KeBNXGcL SRSFclizVVYsFsCvk7M9Re8mT6gWeKKp9QCIo2bGHYBp8ms3hkGLxgKbHFBBaBi2 P9y1QmvyKg/OXCvdH7zWdQlql1qIKuVhvTG6eXeqs8dpc/5ErnCJ+s= Received: (qmail 13760 invoked by alias); 23 Nov 2016 14:57:35 -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 13712 invoked by uid 89); 23 Nov 2016 14:57:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=BinChengarmcom, Bin.Cheng@arm.com, richard.guenther@gmail.com, richardguenthergmailcom X-HELO: mail-vk0-f65.google.com Received: from mail-vk0-f65.google.com (HELO mail-vk0-f65.google.com) (209.85.213.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 14:57:26 +0000 Received: by mail-vk0-f65.google.com with SMTP id w194so432136vkw.3 for ; Wed, 23 Nov 2016 06:57:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/o8tUsZdkPgk2M6vBUgQ1KFeI9FcVemRZELdrySvkaY=; b=RqHyTxnTpvWe39MklS2Te34Jt53CQV0ZQOYsLIIAto32nAFFR8Kb3Eldoj3+m4PSL+ 1IT35tt/y5ywJ09qHCe3UoD4Ln37BP/4Ax5f+c5cIzsmvleJAiOafMFd2aZrrzx+mmi9 tXLqHEHiFVSQOSSX+6M/JjrGOt19OXJCYydqdnRSgRLYy2v3TDm66Jud3sK3QtE/SCgk o2BN5/L49ZQ06dAl+lr6OJ08HmLH4NWIdjO/FMy4dZFJXgBArg/NVlIByeFeSCT33F4O hZME5WhMye+TKuECC6uZcEfAJIaxzSHF/lmSeUGbx1ZNuhbVtIdjr0aWmvUa9wmTfkVc fztA== X-Gm-Message-State: AKaTC004eMCHMXuYmIa3K/lKwpz2yWeYmxS5/Lm8OQgf9Z8WtI4FoifUUMBbMLIlU/DqbO85rSWiAS8t8btlUw== X-Received: by 10.31.93.193 with SMTP id r184mr1010747vkb.159.1479913044563; Wed, 23 Nov 2016 06:57:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.127.73 with HTTP; Wed, 23 Nov 2016 06:57:23 -0800 (PST) In-Reply-To: References: From: "Bin.Cheng" Date: Wed, 23 Nov 2016 14:57:23 +0000 Message-ID: Subject: Re: [PATCH GCC]Refine type conversion in result expressions for cond_expr pattern To: Richard Biener Cc: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes On Wed, Nov 23, 2016 at 2:27 PM, Richard Biener wrote: > On Wed, Nov 23, 2016 at 2:54 PM, Bin Cheng wrote: >> Hi, >> This is actually the review suggestion for patch @https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02341.html, but I forgot to incorporate it when committing that patch. Here comes this one doing that, as well as adding a missing convert keyword. Toolchain built successfully, is it OK? > > As said you _do_ need the outermost (convert ...) on the (max .. and > (min ... expressions given @1 may not be of type 'type'. Sorry about the stupid mistake. How about this one? The from_type in the last branch looks like necessary to me. Thanks, bin > >> Thanks, >> bin >> >> 2016-11-23 Bin Cheng >> >> * match.pd: Refine type conversion in result expressions for below >> pattern: >> (cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)). Index: gcc/match.pd =================================================================== --- gcc/match.pd (revision 242751) +++ gcc/match.pd (working copy) @@ -2022,11 +2022,12 @@ } } (if (code == MAX_EXPR) - (convert (max @1 (convert:from_type @2))) + (convert (max @1 (convert @2))) (if (code == MIN_EXPR) - (convert (min @1 (convert:from_type @2))) + (convert (min @1 (convert @2))) (if (code == EQ_EXPR) - (cond (cmp @1 (convert:from_type @3)) (convert:from_type @3) @2))))))) + (convert (cond (cmp @1 (convert @3)) + (convert:from_type @3) (convert:from_type @2))))))))) (for cnd (cond vec_cond) /* A ? B : (A ? X : C) -> A ? B : C. */