From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 3B0B03857C7B for ; Tue, 20 Oct 2020 13:19:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B0B03857C7B Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D29DA31B; Tue, 20 Oct 2020 06:19:45 -0700 (PDT) Received: from [192.168.1.19] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E82B3F719; Tue, 20 Oct 2020 06:19:45 -0700 (PDT) Subject: Re: Issue during combine. To: Henri Cloetens , gcc-help References: From: Richard Earnshaw Message-ID: Date: Tue, 20 Oct 2020 14:19:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3491.6 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, TXREP 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 13:19:47 -0000 On 19/10/2020 13:53, Henri Cloetens wrote: > Hello all, > > I am building a gcc 9.2.0 custom compiler, and I am running in an issue > during step 263, combine. > > Before combine: > > /(insn 2354 2352 1743 175 (set (reg/v:SI 197 [ dig ])// > //        (if_then_else (eq (subreg:QI (reg:SI 632) 1)// Your problem is likely here, on the input. The SET_SRC (the if_then_else) of the pattern should have the same mode as the SET_DEST, unless the SET_SRC is a CONST_INT. R. > //                (const_int 1 [0x1]))// > //            (reg:SI 708)// > //            (reg/v:SI 197 [ dig ]))) > "/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":771:6 35 > {select_internal3}// > //     (expr_list:REG_DEAD (reg:SI 708)// > //        (expr_list:REG_DEAD (reg:SI 632)// > //            (nil))))// > //(insn 1743 2354 124 175 (set (mem:QI (reg:SI 316 [ ivtmp.118 ]) [0 > *s_304+0 S1 A8])// > //        (subreg:QI (reg/v:SI 197 [ dig ]) 0)) > "/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":772:13 6 > {movqi_internal}// > //     (expr_list:REG_DEAD (reg:SI 316 [ ivtmp.118 ])// > //        (expr_list:REG_DEAD (reg/v:SI 197 [ dig ])// > //            (nil))))/ > > This is during the combine-step transformed into: > > /(insn 1743 2354 124 175 (set (mem:QI (reg:SI 316 [ ivtmp.118 ]) [0 > *s_304+0 S1 A8])// > //        (subreg:QI (if_then_else (eq (subreg:QI (reg:SI 632) 1)// > //                    (const_int 1 [0x1]))// > //                (reg:SI 708)// > //                (reg/v:SI 197 [ dig ])) 0)) > "/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":772:13 6 > {movqi_internal}// > //     (expr_list:REG_DEAD (reg:SI 316 [ ivtmp.118 ])// > //        (expr_list:REG_DEAD (reg/v:SI 197 [ dig ])// > //            (nil))))/ > > This, of course, is not correct any more. Now, how should I prevent this > ?, the pattern is defined in the .md-file as: > > /(define_insn "movqi_internal" // > //[(set (match_operand:QI 0 "movqi_operand_0" > "=r,r,r,r,r,r,u,u,W,t,r,c,*c*l,*h,*h,y")// > //(match_operand:QI 1 "movqi_operand_1" "O,k,i,r,W,t,W,t,r,r,*h,u, r,   > r, 0,y"))]/ > > /.../ > and /movqi_operand_1/ is defined as: > > /(define_predicate "movqi_operand_1"// > //  (ior (match_operand 0 "gpc_reg_operand")// > //       (ior (match_operand 0 > "quarterword_offset21_memref_operand_or_indirect")// > //            (match_operand 0 "immediate_operand"))))/ > > > and /gpc_reg_operand/ as: > > /(define_predicate "gpc_reg_operand"// > //   (and (match_operand 0 "register_operand")// > //        (match_test "(GET_CODE (op) != REG && GET_CODE(op) != SUBREG// > //                      || (REGNO (op) >= ARG_POINTER_REGNUM// > //                          && !CA_REGNO_P (REGNO (op)))// > //                      || REGNO (op) == SFP_REGNO// > //                      || REGNO (op) == ARG_POINTER_REGNUM// > //                      || REGNO (op) <= MAX_REGFILE_REGNO)")))/ > > Any of you any idea why the combine succeeds ?. I mean, it should fail > !. After combine, it does not match /movqi_internal/ pattern > any more, but the compiler seems to think otherwise !. > > Best Regards, > > Henri. > >