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 367563858430 for ; Mon, 27 Feb 2023 22:22:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 367563858430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=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 31RMLVYo008598; Mon, 27 Feb 2023 16:21:31 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 31RMLUaw008591; Mon, 27 Feb 2023 16:21:30 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 27 Feb 2023 16:21:30 -0600 From: Segher Boessenkool To: Jakub Jelinek Cc: Richard Biener , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [PATCH] optabs: Fix up expand_doubleword_shift_condmove for shift_mask == 0 [PR108803] Message-ID: <20230227222130.GE25951@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Mon, Feb 27, 2023 at 08:11:09PM +0100, Jakub Jelinek wrote: > (insn 52 48 53 2 (set (reg:CC 66 cc) > (compare:CC (reg:SI 130) > (const_int 0 [0]))) "pr108803.c":12:25 437 {cmpsi} > (expr_list:REG_DEAD (reg:SI 130) > (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0]) > (const_int 0 [0])) > (nil)))) > (insn 53 52 57 2 (set (reg:DI 152 [ _6+8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 132) > (const_int 0 [0]))) "pr108803.c":12:25 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 132) > (nil))) > (insn 57 53 59 2 (set (reg:DI 151 [ _6 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:DI 126))) "pr108803.c":12:25 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:CC 66 cc) > (nil))) > ... > (insn 71 68 72 2 (set (reg:CC 66 cc) > (compare:CC (reg:SI 137) > (const_int 0 [0]))) "pr108803.c":12:42 437 {cmpsi} > (expr_list:REG_DEAD (reg:SI 137) > (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0]) > (const_int 0 [0])) > (nil)))) > (insn 72 71 76 2 (set (reg:DI 153 [ _8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 139) > (reg:DI 153 [ _8 ]))) "pr108803.c":12:42 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 139) > (nil))) > (insn 76 72 77 2 (set (reg:DI 154 [ _8+8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 138) > (reg:DI 127))) "pr108803.c":12:42 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 138) > (expr_list:REG_DEAD (reg:DI 127) > (expr_list:REG_DEAD (reg:CC 66 cc) > (nil))))) > (insn 77 76 78 2 (set (reg:DI 159 [ b ]) > (ior:DI (reg:DI 151 [ _6 ]) > (reg:DI 126))) "pr108803.c":12:12 537 {iordi3} > (expr_list:REG_DEAD (reg:DI 126) > (expr_list:REG_DEAD (reg:DI 151 [ _6 ]) > (nil)))) > (insn 78 77 80 2 (set (reg:DI 160 [ b+8 ]) > (reg:DI 152 [ _6+8 ])) "pr108803.c":12:12 65 {*movdi_aarch64} > (expr_list:REG_DEAD (reg:DI 152 [ _6+8 ]) > (nil))) Both CC's are used twice, in if_then_else all times, a situation that does not happen frequently at all, and that combine is apparently not prepared for at all. It is the same (hard!) register in all cases as well. > but as you can see, because cc reg has been REG_DEAD before on insn 57 > rather than on insn 53, nothing really removed REG_DEAD note from there > and just adds it on insn 78 (note, besides this REG_DEAD issue the > IL is otherwise still sane, the previous cc setter 71 and its previous > uses 72 and 76 in between the move have been optimized away already in > an earlier successful combination). > And things go wild with the next successful combination: Yup. Segher