From patchwork Thu Nov 17 13:49:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 696116 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 3tKMvW4lHfz9t0v for ; Fri, 18 Nov 2016 00:50:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="owxwnH6T"; 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:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=QzmD3NRq01QNEQaoLqgiroWpD6viQuW0/Um1uka0/5IKR9mSUJ v13x/QOKYvDpwMuIZZOFKghclG86xCB2nwyvj03Fpv/T0Yi1vI9+4DYJgUrZxk9K mMshVrI3q81D+XGBHVxOMmhA0B7YiJQn+zyErM5UanImowzPcCMp5P+4I= 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:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=VC7HwMeSS2r46Q5hNdvTuTQdhso=; b=owxwnH6TBNxV3rzanaYa lN5V6YqljmKqnvdffWYIOibwEItCu02HTAHih/fiEV/jWwDhRAbpciqcoD8syItz vr1kgw0stCOg2/09whGjXng4o6JE/WozWvAoHdMdrJg2o0dg6jo5cXxNkiRq8pjR yq8LGXurhYri5aPlbv/Rbz0= Received: (qmail 72505 invoked by alias); 17 Nov 2016 13:49:57 -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 72345 invoked by uid 89); 17 Nov 2016 13:49:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*r:521, johann, qimode, QImode X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.221) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Nov 2016 13:49:45 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwTPLBCxG2PQt7BpWLF2I= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (ip5f5871bb.dynamic.kabel-deutschland.de [95.88.113.187]) by smtp.strato.de (RZmta 39.9 DYNA|AUTH) with ESMTPSA id d010ccsAHDngPOS (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 17 Nov 2016 14:49:42 +0100 (CET) To: GCC Patches Cc: Denis Chertykov From: Georg-Johann Lay Subject: [patch,avr,committed] More use of CONST_INT_P, SUBREG_P. Message-ID: <37fe89db-4466-8293-08d0-7f42a1ba6b8e@gjlay.de> Date: Thu, 17 Nov 2016 14:49:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes This is a no-op code clean-up that makes more use of SUBREG_P and CONST_INT_P if possible. Applied as obvious. Johann * config/avr/avr.c (avr_print_operand_address): Use CONST_INT_P if appropriate. (ashlqi3_out, ashlsi3_out, ashrqi3_out, ashrhi3_out): Same. (ashrsi3_out, lshrqi3_out, lshrhi3_out, lshrsi3_out): Same. (avr_rtx_costs_1, extra_constraint_Q): Same. (avr_address_cost): Use SUBREG_P if appropriate. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 242541) +++ config/avr/avr.c (working copy) @@ -2544,7 +2544,7 @@ avr_print_operand_address (FILE *file, m rtx x = addr; if (GET_CODE (x) == CONST) x = XEXP (x, 0); - if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x,1)) == CONST_INT) + if (GET_CODE (x) == PLUS && CONST_INT_P (XEXP (x,1))) { /* Assembler gs() will implant word address. Make offset a byte offset inside gs() for assembler. This is @@ -6083,7 +6083,7 @@ out_shift_with_cnt (const char *templ, r const char * ashlqi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; @@ -6180,7 +6180,7 @@ ashlqi3_out (rtx_insn *insn, rtx operand const char * ashlhi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); @@ -6500,7 +6500,7 @@ avr_out_ashlpsi3 (rtx_insn *insn, rtx *o const char * ashlsi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; int *t = len; @@ -6589,7 +6589,7 @@ ashlsi3_out (rtx_insn *insn, rtx operand const char * ashrqi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; @@ -6661,7 +6661,7 @@ ashrqi3_out (rtx_insn *insn, rtx operand const char * ashrhi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); @@ -6883,7 +6883,7 @@ avr_out_ashrpsi3 (rtx_insn *insn, rtx *o const char * ashrsi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; int *t = len; @@ -6980,7 +6980,7 @@ ashrsi3_out (rtx_insn *insn, rtx operand const char * lshrqi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; @@ -7075,7 +7075,7 @@ lshrqi3_out (rtx_insn *insn, rtx operand const char * lshrhi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int scratch = (GET_CODE (PATTERN (insn)) == PARALLEL); int ldi_ok = test_hard_reg_class (LD_REGS, operands[0]); @@ -7386,7 +7386,7 @@ avr_out_lshrpsi3 (rtx_insn *insn, rtx *o const char * lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) { - if (GET_CODE (operands[2]) == CONST_INT) + if (CONST_INT_P (operands[2])) { int k; int *t = len; @@ -10549,7 +10549,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod return true; } *total = COSTS_N_INSNS (1); - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed); break; @@ -10568,7 +10568,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod *total = COSTS_N_INSNS (1) + *total; return true; } - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (2); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10594,7 +10594,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case SImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (4); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10645,7 +10645,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod case IOR: *total = COSTS_N_INSNS (GET_MODE_SIZE (mode)); *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed); - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed); return true; @@ -10813,7 +10813,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod switch (mode) { case QImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10850,7 +10850,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod return true; } - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10922,7 +10922,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case SImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10965,7 +10965,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod switch (mode) { case QImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -10986,7 +10986,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case HImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -11059,7 +11059,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case SImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -11102,7 +11102,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod switch (mode) { case QImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 4 : 17); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -11121,7 +11121,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case HImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 5 : 41); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -11195,7 +11195,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod break; case SImode: - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) { *total = COSTS_N_INSNS (!speed ? 7 : 113); *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, @@ -11239,14 +11239,14 @@ avr_rtx_costs_1 (rtx x, machine_mode mod { case QImode: *total = COSTS_N_INSNS (1); - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) *total += avr_operand_rtx_cost (XEXP (x, 1), QImode, code, 1, speed); break; case HImode: *total = COSTS_N_INSNS (2); - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) *total += avr_operand_rtx_cost (XEXP (x, 1), HImode, code, 1, speed); else if (INTVAL (XEXP (x, 1)) != 0) @@ -11261,7 +11261,7 @@ avr_rtx_costs_1 (rtx x, machine_mode mod case SImode: *total = COSTS_N_INSNS (4); - if (GET_CODE (XEXP (x, 1)) != CONST_INT) + if (!CONST_INT_P (XEXP (x, 1))) *total += avr_operand_rtx_cost (XEXP (x, 1), SImode, code, 1, speed); else if (INTVAL (XEXP (x, 1)) != 0) @@ -11327,7 +11327,7 @@ avr_address_cost (rtx x, machine_mode mo if (GET_CODE (x) == PLUS && CONST_INT_P (XEXP (x, 1)) && (REG_P (XEXP (x, 0)) - || GET_CODE (XEXP (x, 0)) == SUBREG)) + || SUBREG_P (XEXP (x, 0)))) { if (INTVAL (XEXP (x, 1)) > MAX_LD_OFFSET(mode)) cost = 18; @@ -11356,14 +11356,15 @@ int extra_constraint_Q (rtx x) { int ok = 0; + rtx plus = XEXP (x, 0); - if (GET_CODE (XEXP (x,0)) == PLUS - && REG_P (XEXP (XEXP (x,0), 0)) - && GET_CODE (XEXP (XEXP (x,0), 1)) == CONST_INT - && (INTVAL (XEXP (XEXP (x,0), 1)) + if (GET_CODE (plus) == PLUS + && REG_P (XEXP (plus, 0)) + && CONST_INT_P (XEXP (plus, 1)) + && (INTVAL (XEXP (plus, 1)) <= MAX_LD_OFFSET (GET_MODE (x)))) { - rtx xx = XEXP (XEXP (x,0), 0); + rtx xx = XEXP (plus, 0); int regno = REGNO (xx); ok = (/* allocate pseudos */