From patchwork Fri Dec 30 16:44:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Melnik X-Patchwork-Id: 133682 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]) by ozlabs.org (Postfix) with SMTP id ADC3EB6FBD for ; Sat, 31 Dec 2011 03:44:47 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1325868288; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=nLAFtAEOJIIcH5dhM0JgD5Uq77Y=; b=WgJLoFABoT6f3OD CqbMFDEzq5EUT9HRArSsHV5e9c2uv3YmZwnxR45v0zix+jC84WUnA+GtyYMwjjEe 4sJ6awW59COREPbeSd7gFd6bb62HMFKbnTgrXcpP7YsiZVcKN/PCp0zZAlAsEKdD 7xuM3DUS5JHc1T66KryDdWmd3ZBI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NDQwyc/QZ7twxajXGYWIYqV68W8I4tckm+ezfG0sz3rvf7EBWAtHqw4kJ57PCP lRARdotrnF3FRbjyP5a5OowXY/tVEI+vYWr29iLZrsCexl5jwQLm4RV1Mw3T9/B7 nC9I1VGMTgyxiNabf/kOM76AchWI+X19VSGK1KznTWass=; Received: (qmail 28591 invoked by alias); 30 Dec 2011 16:44:42 -0000 Received: (qmail 28557 invoked by uid 22791); 30 Dec 2011 16:44:35 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.198.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Dec 2011 16:44:23 +0000 Received: from ispserv.ispras.ru (ispserv.ispras.ru [83.149.198.72]) by smtp.ispras.ru (Postfix) with ESMTP id 647EC5D4046; Fri, 30 Dec 2011 19:24:52 +0300 (MSK) Received: from [10.10.3.58] (winnie.ispras.ru [83.149.198.236]) by ispserv.ispras.ru (Postfix) with ESMTP id BA91B3FC48; Fri, 30 Dec 2011 19:44:21 +0300 (MSK) Message-ID: <4EFDEA53.3000307@ispras.ru> Date: Fri, 30 Dec 2011 20:44:03 +0400 From: Dmitry Melnik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org, Andrey Belevantsev , Alexander Monakov , Ramana Radhakrishnan Subject: [RFC, ARM][PATCH 1/5] Split if_then_else into cond_execs References: <4EFDE957.6010104@ispras.ru> In-Reply-To: <4EFDE957.6010104@ispras.ru> X-IsSubscribed: yes 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 This patch adds splits for if_then_else into cond_execs. This helps generating the minimum number of IT-blocks for two consequent if_then_elses, e.g. one ITETE insn instead of two ITE insns, if if_then_else were expanded directly into assembly code. There are three splitters for the cases when both IF and THEN branches are present, and when there's only one of them (the last two splitters are required to prevent generation of code like "(cc) r0 = r0"). On SPEC2K INT with -O2 this reduces code size by 76 bytes (no regressions). 2011-12-08 Sevak Sargsyan gcc/ * config/arm/thumb2.md (new splitters for if_then_else): Turn them into cond_execs. diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md index 05585da..662f995 100644 --- a/gcc/config/arm/thumb2.md +++ b/gcc/config/arm/thumb2.md @@ -299,6 +299,57 @@ (set_attr "conds" "use")] ) +(define_split + [(set (match_operand:SI 0 "s_register_operand" "") + (if_then_else:SI + (match_operator 3 "arm_comparison_operator" + [(match_operand 4 "cc_register" "") (const_int 0)]) + (match_operand:SI 1 "arm_not_operand" "") + (match_operand:SI 2 "arm_not_operand" "")))] + "TARGET_THUMB2 && reload_completed + && (!REG_P (operands[1]) || REGNO (operands[0]) != REGNO (operands[1])) + && (!REG_P (operands[2]) || REGNO (operands[0]) != REGNO (operands[2]))" +[(cond_exec (match_dup 5) (set (match_dup 0) (match_dup 1))) + (cond_exec (match_dup 6) (set (match_dup 0) (match_dup 2)))] +{ + operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), VOIDmode, + operands[4], const0_rtx); + operands[6] = gen_rtx_fmt_ee (reversed_comparison_code (operands[3], NULL_RTX), + VOIDmode, operands[4], const0_rtx); +}) + +(define_split + [(set (match_operand:SI 0 "s_register_operand" "") + (if_then_else:SI + (match_operator 3 "arm_comparison_operator" + [(match_operand 4 "cc_register" "") (const_int 0)]) + (match_operand:SI 1 "arm_not_operand" "") + (match_operand:SI 2 "arm_not_operand" "")))] + "TARGET_THUMB2 && reload_completed + && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1]) + && (!REG_P (operands[2]) || REGNO (operands[0]) != REGNO (operands[2]))" +[(cond_exec (match_dup 5) (set (match_dup 0) (match_dup 2)))] +{ + operands[5] = gen_rtx_fmt_ee (reversed_comparison_code (operands[3], NULL_RTX), + VOIDmode, operands[4], const0_rtx); +}) + +(define_split + [(set (match_operand:SI 0 "s_register_operand" "") + (if_then_else:SI + (match_operator 3 "arm_comparison_operator" + [(match_operand 4 "cc_register" "") (const_int 0)]) + (match_operand:SI 1 "arm_not_operand" "") + (match_operand:SI 2 "arm_not_operand" "")))] + "TARGET_THUMB2 && reload_completed + && (!REG_P (operands[1]) || REGNO (operands[0]) != REGNO (operands[1])) + && REG_P (operands[2]) && REGNO (operands[0]) == REGNO (operands[2])" +[(cond_exec (match_dup 5) (set (match_dup 0) (match_dup 1)))] +{ + operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), VOIDmode, operands[4], + const0_rtx); +}) + (define_insn "*call_reg_thumb2" [(call (mem:SI (match_operand:SI 0 "s_register_operand" "r")) (match_operand 1 "" ""))