From patchwork Tue Mar 26 06:53:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Lee X-Patchwork-Id: 231094 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C0CE12C00C0 for ; Tue, 26 Mar 2013 17:54:19 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject:reply-to:mime-version:content-type; q=dns; s=default; b=qhAmeObo3meTbTQPITMzql42LJIpP3q7VahfBZJzeY8 IPihIXIehkKFsiw43Cjz1+dqedohWe0i1fSxffeU5cXIi2C52mNTkwu+Tnsrf/es 3yhPvTvwyD2EhJkkdkYX1ZXhd/3HSIaiGuIQDij5YbCDo1ELQHHZeCg2SjUU3cbI = 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:date :message-id:from:to:subject:reply-to:mime-version:content-type; s=default; bh=jPHWQk69HXnpgOZf3GCmNd3bhKw=; b=wJCLhf+rt7fQi9i9/ 4tIsWe9BngUlZ5m5R9MuGmNF7/7DAx2Z78fjIfld7SsPc2cnf2KmiVparoYta9Hm 6/aTj+nOzFIytvPjNkZ9hxupKXKr4CD+0hg+D9PT4nCREH8FHevcTiGnX1k5XGa9 JRErt8QW83wAP3ZWdN557kbDQw= Received: (qmail 30190 invoked by alias); 26 Mar 2013 06:54:07 -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 30171 invoked by uid 89); 26 Mar 2013 06:53:56 -0000 X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (12.216.194.151) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 26 Mar 2013 06:53:54 +0000 Received: from farm-0001.internal.tilera.com (10.2.0.31) by USMAEXCH2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.722.0; Tue, 26 Mar 2013 02:53:52 -0400 Received: (from walt@localhost) by farm-0001.internal.tilera.com (8.14.4/8.12.11/Submit) id r2Q6rpZB016993; Tue, 26 Mar 2013 02:53:51 -0400 Date: Tue, 26 Mar 2013 02:53:51 -0400 Message-ID: <201303260653.r2Q6rpZB016993@farm-0001.internal.tilera.com> From: Walter Lee To: Subject: [committed] TILE-Gx: speed up code to synthesize a constant Reply-To: Walter Lee MIME-Version: 1.0 This patch inlines some tests while searching for the best way to synthesize a constant, to avoid the need to generate an rtx. This became expensive for code that generates a lot of constants. Backported to 4.7 and 4.8. * config/tilegx/tilegx.c (expand_set_cint64_one_inst): Inline tests for constraint J, K, N, P. Index: gcc/config/tilegx/tilegx.c =================================================================== --- gcc/config/tilegx/tilegx.c (revision 197073) +++ gcc/config/tilegx/tilegx.c (working copy) @@ -1429,14 +1429,16 @@ expand_set_cint64_one_inst (rtx dest_reg } else if (!three_wide_only) { - rtx imm_op = GEN_INT (val); - - if (satisfies_constraint_J (imm_op) - || satisfies_constraint_K (imm_op) - || satisfies_constraint_N (imm_op) - || satisfies_constraint_P (imm_op)) + /* Test for the following constraints: J, K, N, P. We avoid + generating an rtx and using existing predicates because we + can be testing and rejecting a lot of constants, and GEN_INT + is O(N). */ + if ((val >= -32768 && val <= 65535) + || ((val == (val & 0xFF) * 0x0101010101010101LL)) + || (val == ((trunc_int_for_mode (val, QImode) & 0xFFFF) + * 0x0001000100010001LL))) { - emit_move_insn (dest_reg, imm_op); + emit_move_insn (dest_reg, GEN_INT (val)); return true; } }