From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 9EB893858D34; Wed, 8 Jul 2020 22:43:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9EB893858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 068MhZfo008919; Wed, 8 Jul 2020 17:43:35 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 068MhYlm008911; Wed, 8 Jul 2020 17:43:34 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 8 Jul 2020 17:43:34 -0500 From: Segher Boessenkool To: luoxhu Cc: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, wschmidt@linux.ibm.com, guojiufu@linux.ibm.com, linkw@gcc.gnu.org Subject: Re: [PATCH] rs6000: Split movsf_from_si from high word before reload[PR89310] Message-ID: <20200708224334.GY3598@gate.crashing.org> References: <20200706021757.1118129-1-luoxhu@linux.ibm.com> <20200707001803.GR3598@gate.crashing.org> <66c7b5d6-afa6-53d7-704d-44834ff00311@linux.ibm.com> <20200707213116.GU3598@gate.crashing.org> <66faac54-0620-5ee0-ff48-5609ad9e3fa7@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66faac54-0620-5ee0-ff48-5609ad9e3fa7@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2020 22:43:39 -0000 Hi! On Wed, Jul 08, 2020 at 11:19:21AM +0800, luoxhu wrote: > For extracting high part element from DImode register like: > > {%1:SF=unspec[r122:DI>>0x20#0] 86;clobber scratch;} > > split it before reload with "and mask" to avoid generating shift right > 32 bit then shift left 32 bit. This pattern also exists in PR42475 and > PR67741, etc. > 2020-07-08 Xionghu Luo > > PR rtl-optimization/89310 > * config/rs6000/rs6000.md (movsf_from_si2): New > define_insn_and_split. > > gcc/testsuite/ChangeLog: > > 2020-07-08 Xionghu Luo > > PR rtl-optimization/89310 > * gcc.target/powerpc/pr89310.c: New test. > +;; For extracting high part element from DImode register like: > +;; {%1:SF=unspec[r122:DI>>0x20#0] 86;clobber scratch;} > +;; split it before reload with "and mask" to avoid generating shift right > +;; 32 bit then shift left 32 bit. > +(define_insn_and_split "movsf_from_si2" > + [(set (match_operand:SF 0 "gpc_reg_operand" "=wa") > + (unspec:SF [ > + (subreg:SI (ashiftrt:DI Put the (ashiftrt:DI on a separate line as well? With indent changes, etc. > + (match_operand:DI 1 "input_operand" "r") > + (const_int 32)) > + 0)] > + UNSPEC_SF_FROM_SI)) > + (clobber (match_scratch:DI 2 "=r"))] > + "TARGET_NO_SF_SUBREG" > + "@ > + #" @ with only one alternative doesn't do anything; so just write "#" please. > + And no empty line here. > + "&& !reload_completed Why this? Why will this not work after reload? In the very few cases where you do need this, you usually also need to check for lra_in_progress. > + && vsx_reg_sfsubreg_ok (operands[0], SFmode)" > + [(const_int 0)] > +{ > + if (GET_CODE (operands[2]) == SCRATCH) > + operands[2] = gen_reg_rtx (DImode); > + > + rtx mask = GEN_INT (HOST_WIDE_INT_M1U << 32); The mask should be different for QI and HI. > + emit_insn (gen_anddi3 (operands[2], operands[1], mask)); > + emit_insn (gen_p8_mtvsrd_sf (operands[0], operands[2])); > + emit_insn (gen_vsx_xscvspdpn_directmove (operands[0], operands[0])); > + DONE; > +} > + [(set_attr "length" "12") > + (set_attr "type" "vecfloat") > + (set_attr "isa" "p8v")]) > + No extra whiteline please. Maybe change it back to just SI? It won't match often at all for QI or HI anyway, it seems. Sorry for that detour. Should be good with the above nits fixed :-) Segher