From patchwork Wed Aug 12 01:11:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 506295 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 4FE1C1401CD for ; Wed, 12 Aug 2015 11:13:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=U2xVQC+T; 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:in-reply-to:references; q=dns; s= default; b=V/c0ui+oDBIjjc0lTn2G4vr9Zcy6yzr/bCodxcr/PDrE6HAAHBwQ/ dGzIJrxbxUXBlvEEuFoyh8npiz1Py/7vVQ+Lc0rDVL8UFUQLsFuDsRLPU7TnGaqJ EP4dn+jZ+8WDaGjLWWM/oAJl6newI8QPW5Ops8erujpp7R1GJJZt7w= 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:in-reply-to:references; s= default; bh=eSIyMnTy0ng+4NK5kQzr0ClIvIs=; b=U2xVQC+TEdgovt+uYh0+ BKdn0bkTGZONhDBmzteIDFp0gqz0jyIIGwpXx+AtDOL3Mtbfa4Om44W3grfphy+e Fn+/r4p93UZzvgLif9V0iDJ4ZOmhyAOA2yXcSL55NuIz7+EsQ7NKEUnHgj2Hwo4g JjWNUWChNV4zvcgibt2oRGM= Received: (qmail 76516 invoked by alias); 12 Aug 2015 01:11:58 -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 76480 invoked by uid 89); 12 Aug 2015 01:11:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 12 Aug 2015 01:11:56 +0000 Received: by pacrr5 with SMTP id rr5so2213075pac.3 for ; Tue, 11 Aug 2015 18:11:54 -0700 (PDT) X-Received: by 10.68.103.132 with SMTP id fw4mr62492100pbb.62.1439341914809; Tue, 11 Aug 2015 18:11:54 -0700 (PDT) Received: from bigtime.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id kv10sm4167810pbc.2.2015.08.11.18.11.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 18:11:54 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: [PATCH 09/15] rs6000: Use xoris in constant construction Date: Tue, 11 Aug 2015 18:11:38 -0700 Message-Id: <1439341904-9345-10-git-send-email-rth@redhat.com> In-Reply-To: <1439341904-9345-1-git-send-email-rth@redhat.com> References: <1439341904-9345-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes Helps for constants like 0xfffff70008000ul, 0xffffffff55555555ul, 0xffffffff550ffffful. There doesn't appear to be any benefit to using xori; every test that I expected to use it found an alternate solution of the same cost. Cc: David Edelsohn --- * config/rs6000/rs6000.c (genimm_ppc::exam_search): Test for inverting the second half-word. (genimm_ppc::generate): Handle XOR. --- gcc/config/rs6000/rs6000.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 9c08cca..40b29b0 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -8169,6 +8169,11 @@ genimm_ppc::exam_search (HOST_WIDE_INT c, int budget) return true; } } + if (exam_sub (c | 0xffff0000u, sub_budget)) + { + opN (XOR, ~c & 0xffff0000u); /* XORIS */ + return true; + } /* If C is a mask itself, apply it to all ones. */ if (exam_mask (-1, c, sub_budget)) @@ -8253,6 +8258,7 @@ genimm_ppc::generate (rtx dest, machine_mode mode) const case PLUS: case AND: case IOR: + case XOR: case ASHIFT: x = gen_rtx_fmt_ee (r, mode, op1, op2); break;