From patchwork Sun Jan 24 10:54:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 572228 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 B2498140BAB for ; Sun, 24 Jan 2016 21:54:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XPFm+V9u; 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:to :from:subject:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=aqhCbaHUFPg+2dLG/ucBkmyx+L/jTuCj3sW6IT5oKBffoo 1rUAZ147/WLpgua7Z0XBiXIcRxFpaBl5+T0QWwcqmKNEp5vjg4jybIvADqagQpel arB6V8FmhUugsdztTxOy4Q5SURT7a6CIgjGo7kvPq8k60BysnMnlX6xzldGgc= 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 :from:subject:cc:message-id:date:mime-version:content-type; s= default; bh=FxU2RJ63SU9IgE/+sxhcIDasOYI=; b=XPFm+V9uXH9EEh7TSQq6 xcO3E/42kVasNpvBZS91ZrOlreOEv0bvKK7U5UvuISEtHUBYmMGzqnc/PfAQ7hSS iaUXGHlHLygJJkfH7uO8o74vQgUYEAKtD5AsI2JyHFjX7XLSwkJW35f0BRrRxYVB Y5FHeG50GB689EgHSTVHIUE= Received: (qmail 19030 invoked by alias); 24 Jan 2016 10:54:38 -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 19013 invoked by uid 89); 24 Jan 2016 10:54:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2483, xexp, *cost, XEXP X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 24 Jan 2016 10:54:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 8BBE4C00357A; Sun, 24 Jan 2016 10:54:34 +0000 (UTC) Received: from bigtime.twiddle.net (ovpn-113-117.phx2.redhat.com [10.3.113.117]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0OAsXvZ012878; Sun, 24 Jan 2016 05:54:34 -0500 To: gcc-patches@gcc.gnu.org From: Richard Henderson Subject: [aarch64] Improve TImode constant moves Cc: Marcus Shawcroft , Richard Earnshaw Message-ID: <56A4AD68.5090703@redhat.com> Date: Sun, 24 Jan 2016 02:54:32 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 X-IsSubscribed: yes This looks to be an incomplete transition of the aarch64 backend to CONST_WIDE_INT. I haven't checked to see if it's a regression from gcc5, but I suspect not, since there should have been similar checks for CONST_DOUBLE. This is probably gcc7 fodder, but it helped me debug another TImode PR. r~ * config/aarch64/aarch64.c (aarch64_rtx_costs): Handle CONST_WIDE_INT. (aarch64_legitimate_constant_p): Accept CONST_SCALAR_INT_P. * config/aarch64/predicates.md (aarch64_movti_operand): Accept const_wide_int and const_scalar_int_operand. (aarch64_reg_or_imm): Likewise. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index df3dec0..38c7443 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6227,6 +6227,17 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED, } return true; + case CONST_WIDE_INT: + *cost = 0; + for (unsigned int n = CONST_WIDE_INT_NUNITS(x), i = 0; i < n; ++i) + { + unsigned HOST_WIDE_INT e = CONST_WIDE_INT_ELT(x, i); + if (e != 0) + *cost += COSTS_N_INSNS (aarch64_internal_mov_immediate + (NULL_RTX, GEN_INT (e), false, DImode)); + } + return true; + case CONST_DOUBLE: if (speed) { @@ -9400,6 +9411,9 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx x) && aarch64_valid_symref (XEXP (x, 0), GET_MODE (XEXP (x, 0)))) return true; + if (CONST_SCALAR_INT_P (x)) + return true; + return aarch64_constant_address_p (x); } diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md index e96dc00..3eb33fa 100644 --- a/gcc/config/aarch64/predicates.md +++ b/gcc/config/aarch64/predicates.md @@ -217,15 +217,15 @@ (match_test "aarch64_mov_operand_p (op, mode)"))))) (define_predicate "aarch64_movti_operand" - (and (match_code "reg,subreg,mem,const_int") + (and (match_code "reg,subreg,mem,const_int,const_wide_int") (ior (match_operand 0 "register_operand") (ior (match_operand 0 "memory_operand") - (match_operand 0 "const_int_operand"))))) + (match_operand 0 "const_scalar_int_operand"))))) (define_predicate "aarch64_reg_or_imm" - (and (match_code "reg,subreg,const_int") + (and (match_code "reg,subreg,const_int,const_wide_int") (ior (match_operand 0 "register_operand") - (match_operand 0 "const_int_operand")))) + (match_operand 0 "const_scalar_int_operand")))) ;; True for integer comparisons and for FP comparisons other than LTGT or UNEQ. (define_special_predicate "aarch64_comparison_operator"