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 CEA953857030 for ; Tue, 19 Sep 2023 08:49:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEA953857030 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com 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 C2CB01FB; Tue, 19 Sep 2023 01:50:13 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD4233F59C; Tue, 19 Sep 2023 01:49:35 -0700 (PDT) From: Richard Sandiford To: Wilco Dijkstra Mail-Followup-To: Wilco Dijkstra ,GCC Patches , Kyrylo Tkachov , richard.sandiford@arm.com Cc: GCC Patches , Kyrylo Tkachov Subject: Re: [PATCH] AArch64: Improve immediate expansion [PR105928] References: Date: Tue, 19 Sep 2023 09:49:34 +0100 In-Reply-To: (Wilco Dijkstra's message of "Mon, 18 Sep 2023 18:41:56 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: Wilco Dijkstra writes: > Hi Richard, > >> I was worried that reusing "dest" for intermediate results would >> prevent CSE for cases like: >> >> void g (long long, long long); >> void >> f (long long *ptr) >> { >> g (0xee11ee22ee11ee22LL, 0xdc23dc44ee11ee22LL); >> } > > Note that aarch64_internal_mov_immediate may be called after reload, > so it would end up even more complex. The sequence I quoted was supposed to work before and after reload. The: rtx tmp = aarch64_target_reg (dest, DImode); would create a fresh temporary before reload and reuse dest otherwise. So the sequence after reload would be the same as in your patch, but the sequence before reload would use a temporary. > This should be done as a > dedicated mid-end optimization similar to TARGET_CONST_ANCHOR. > However the number of 3/4-instruction immediates is so small that > sharable cases would be very rare, so I don't believe it is worth it. Yeah. If, with a few tweaks, we could easily reuse the existing pass flow to optimise the split forms, then it might have been worth it. But I agree it's not worth doing something special that only works for multi-insn immediates. I think there are other cases where CSE after split would help though. Thanks, Richard