From patchwork Sat Sep 20 18:23:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 391542 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 3B5A414011E for ; Sun, 21 Sep 2014 04:47:14 +1000 (EST) 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 :in-reply-to:references; q=dns; s=default; b=bwmOnvl+R0gZRZ6cLrI Omuf4CXqxDC79R8zjORty77omXZnjB9mlpqeGWnypTNIdVLmokDON1a6yNek7lmA STcdQ+47sGpfeAqNFeOU4e9pWwQGicmmoOYl1vtPejlQBf6JY75nRfbMRTq105X6 MT6vpFZjNXvnyHfS4D+ZSIr8= 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 :in-reply-to:references; s=default; bh=zVLTgB9wcYQVfME7k/6np9b5S mk=; b=k50RK2eg38HvRfVa7XSp0VdNuVHVKJdAS5VWfO24tLuyOLF+4adm8Ctiq iAkDEtO6OUwtSEzJy+SgAOWiqLNp3ToDlSn7xzBHacopPI2ed0JXt1TdpYdXuc4z 2Ik/+vQGX4aDJlEdJUwbJOyQ+DtoPmsQyrI6ayrKDa4lhwqmm0= Received: (qmail 22270 invoked by alias); 20 Sep 2014 18:47: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 22261 invoked by uid 89); 20 Sep 2014 18:47:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 20 Sep 2014 18:47:06 +0000 Received: from gcc1-power7.osuosl.org (localhost [127.0.0.1]) by gcc1-power7.osuosl.org (8.14.6/8.14.6) with ESMTP id s8KIO971014988; Sat, 20 Sep 2014 11:24:09 -0700 Received: (from segher@localhost) by gcc1-power7.osuosl.org (8.14.6/8.14.6/Submit) id s8KIO9ji014969; Sat, 20 Sep 2014 11:24:09 -0700 From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH 7/9] rs6000: Clean up ctz, ffs, popcount, parity Date: Sat, 20 Sep 2014 11:23:46 -0700 Message-Id: In-Reply-To: <8ab893d5c8a1ae9a4558be48e14b0e605ee90d67.1411216924.git.segher@kernel.crashing.org> References: <8ab893d5c8a1ae9a4558be48e14b0e605ee90d67.1411216924.git.segher@kernel.crashing.org> In-Reply-To: <8ab893d5c8a1ae9a4558be48e14b0e605ee90d67.1411216924.git.segher@kernel.crashing.org> References: <8ab893d5c8a1ae9a4558be48e14b0e605ee90d67.1411216924.git.segher@kernel.crashing.org> X-IsSubscribed: yes 2014-09-20 Segher Boessenkool * config/rs6000/rs6000.md (ctz2, ffs2, popcount2, popcntb2, popcntd2, parity2, parity2_cmpb): Tidy. --- gcc/config/rs6000/rs6000.md | 70 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 5f5edaa..b03c6c1 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1796,12 +1796,12 @@ (define_expand "ctz2" (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] "" - { - operands[2] = gen_reg_rtx (mode); - operands[3] = gen_reg_rtx (mode); - operands[4] = gen_reg_rtx (mode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (mode) - 1); - }) +{ + operands[2] = gen_reg_rtx (mode); + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (mode) - 1); +}) (define_expand "ffs2" [(set (match_dup 2) @@ -1816,55 +1816,55 @@ (define_expand "ffs2" (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] "" - { - operands[2] = gen_reg_rtx (mode); - operands[3] = gen_reg_rtx (mode); - operands[4] = gen_reg_rtx (mode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (mode)); - }) +{ + operands[2] = gen_reg_rtx (mode); + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (mode)); +}) + + +(define_expand "popcount2" + [(set (match_operand:GPR 0 "gpc_reg_operand" "") + (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] + "TARGET_POPCNTB || TARGET_POPCNTD" +{ + rs6000_emit_popcount (operands[0], operands[1]); + DONE; +}) (define_insn "popcntb2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") - (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] - UNSPEC_POPCNTB))] + (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] + UNSPEC_POPCNTB))] "TARGET_POPCNTB" "popcntb %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) (define_insn "popcntd2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))] "TARGET_POPCNTD" "popcnt %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) -(define_expand "popcount2" + +(define_expand "parity2" [(set (match_operand:GPR 0 "gpc_reg_operand" "") - (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] - "TARGET_POPCNTB || TARGET_POPCNTD" - { - rs6000_emit_popcount (operands[0], operands[1]); - DONE; - }) + (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] + "TARGET_POPCNTB" +{ + rs6000_emit_parity (operands[0], operands[1]); + DONE; +}) (define_insn "parity2_cmpb" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))] "TARGET_CMPB && TARGET_POPCNTB" "prty %0,%1" - [(set_attr "length" "4") - (set_attr "type" "popcnt")]) + [(set_attr "type" "popcnt")]) -(define_expand "parity2" - [(set (match_operand:GPR 0 "gpc_reg_operand" "") - (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))] - "TARGET_POPCNTB" - { - rs6000_emit_parity (operands[0], operands[1]); - DONE; - }) ;; Since the hardware zeros the upper part of the register, save generating the ;; AND immediate if we are converting to unsigned