From patchwork Tue Jul 21 09:15:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hurugalawadi, Naveen" X-Patchwork-Id: 498116 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 73B0D140D23 for ; Tue, 21 Jul 2015 19:15:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kFB/CFEB; 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:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=MGsGQMlSeGAegBm25kxfIDes/fkVjaeXnjicLwFb4P+J5TQzP3 yArM13RLGZLnAOz678FAteRCjl1KoZXB9cdcgh2yoOIYj54X21TvdLo4fW5eORrm DxbfvE9G9YUipXctGco6426P52Sfg0ShDAwa8SXvAanwcd8n/Q1UlChD0= 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:cc:subject:date:message-id:content-type:mime-version; s= default; bh=NDcja4GSOPEQBEaG7hrH2Hw0des=; b=kFB/CFEBK99I4Ff6a1Ua ME4X6B8Wrcgn8JuGgZybG/eFmZcV5utZGiXIbvagcnTSOdlqqGSlqyC+az+b518v bpKZluKhjUFmPexn2KQv+UfPBvFKkXLMNIsSTHUjrDVPPlG2j5GGGe+BaCbJ8OKa DHSSkr0uIpCwXnzQoqs2Mio= Received: (qmail 92662 invoked by alias); 21 Jul 2015 09:15:37 -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 92652 invoked by uid 89); 21 Jul 2015 09:15:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: na01-by2-obe.outbound.protection.outlook.com Received: from mail-by2on0080.outbound.protection.outlook.com (HELO na01-by2-obe.outbound.protection.outlook.com) (207.46.100.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Tue, 21 Jul 2015 09:15:34 +0000 Received: from SN2PR0701MB1024.namprd07.prod.outlook.com (10.160.57.150) by BY1PR0701MB1237.namprd07.prod.outlook.com (10.160.105.156) with Microsoft SMTP Server (TLS) id 15.1.213.14; Tue, 21 Jul 2015 09:15:32 +0000 Received: from SN2PR0701MB1024.namprd07.prod.outlook.com ([10.160.57.150]) by SN2PR0701MB1024.namprd07.prod.outlook.com ([10.160.57.150]) with mapi id 15.01.0213.021; Tue, 21 Jul 2015 09:15:31 +0000 From: "Hurugalawadi, Naveen" To: "gcc-patches@gcc.gnu.org" CC: "Pinski, Andrew" Subject: Fold some equal to and not equal to patterns in match.pd Date: Tue, 21 Jul 2015 09:15:31 +0000 Message-ID: authentication-results: caviumnetworks.com; dkim=none (message not signed) header.d=none; x-microsoft-exchange-diagnostics: 1; BY1PR0701MB1237; 5:i2zCYFsFj1/GDav6EVW/+jC8UaV3VAdJdRMTXNSzZqL7j6SqJVuZpVn4T0sr4FmyjUMPkf8zHBnPFZ0SCRzW1icAo79SeSYd6LK06Dx47Og6COCjVRenapy7/8LT6KlK8THbprZxNjxA1R9px03KJA==; 24:GqdRoYHSpCxMPJm/r+9itoGWjHtaM4dG1Y2YMDdYpHFwsequu9lEVN+qjJjF5ZixSIGq9hLWHwkTzStK5i78+XcT/PAGmbfSOKGgj+FazzI=; 20:IDAxby8S0vwDIjmjHfLtcBUlMvvimTlOrcnHG9ZNBnGYlZglN+q1fX9BMydp7/I9clNJYJxDmxxrFDeTiA4DLw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1237; by1pr0701mb1237: X-MS-Exchange-Organization-RulesExecuted x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY1PR0701MB1237; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1237; x-forefront-prvs: 0644578634 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(377424004)(54534003)(99286002)(2900100001)(92566002)(107886002)(102836002)(46102003)(110136002)(5001960100002)(122556002)(77096005)(2501003)(5002640100001)(450100001)(62966003)(77156002)(106116001)(5890100001)(189998001)(40100003)(229853001)(19580395003)(19580405001)(99936001)(2351001)(2656002)(87936001)(76576001)(86362001)(5001920100001)(33656002)(50986999)(54356999)(66066001)(74316001)(4001430100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1237; H:SN2PR0701MB1024.namprd07.prod.outlook.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2015 09:15:31.1848 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1237 Hi, Please find attached the patch which performs following patterns folding in match.pd:- a ==/!= a p+ b to b ==/!= 0. a << N ==/!= 0 to a&(-1>>N) ==/!= 0. a * N ==/!= 0 where N is a power of 2 to a & (-1< * testsuite/gcc.dg/tree-ssa/compare-shiftmult-1.c: New testcase. * testsuite/gcc.dg/tree-ssa/compare_pointers-1.c: New testcase. gcc/ChangeLog: 2015-01-21 Andrew Pinski * match.pd (define_predicates): Add integer_pow2p. Add pattern for folding of a ==/!= a p+ b to b ==/!= 0. (unsigned_integral_valued_p): New match. Add pattern for folding of a<>N) ==/!= 0. Add pattern for folding of a*N ==/!= 0 where N is a power of 2 to a&(-1<>N) ==/!= 0. */ +(for op (ne eq) + (simplify + (op (lshift unsigned_integral_valued_p@0 INTEGER_CST@1) integer_zerop@2) + (op (bit_and @0 (rshift { build_minus_one_cst (TREE_TYPE (@0)); } + @1)) + @2))) + +/* a * N ==/!= 0 where N is a power of 2 to a & (-1<