From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 976E638930FC for ; Mon, 4 Jan 2021 19:19:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 976E638930FC Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-eygUW9bNPee0OyrnGaJ5JQ-1; Mon, 04 Jan 2021 14:19:25 -0500 X-MC-Unique: eygUW9bNPee0OyrnGaJ5JQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B92E5192CC41; Mon, 4 Jan 2021 19:19:24 +0000 (UTC) Received: from localhost.localdomain (ovpn-114-95.phx2.redhat.com [10.3.114.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A16B1349A; Mon, 4 Jan 2021 19:19:24 +0000 (UTC) Subject: Re: [PATCH] explow, aarch64: Fix force-Pmode-to-mem for ILP32 [PR97269] To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: From: Jeff Law Message-ID: Date: Mon, 4 Jan 2021 12:19:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_STOCKGEN, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, 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-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: Mon, 04 Jan 2021 19:19:28 -0000 On 1/4/21 4:46 AM, Richard Sandiford via Gcc-patches wrote: > This patch fixes a mode/rtx mismatch for ILP32 targets in: > > mem = force_const_mem (ptr_mode, imm); > > where imm can be Pmode rather than ptr_mode. > > The patch uses convert_memory_address to convert the Pmode address > to ptr_mode before the call. However, immediate addresses can in > general contain unspecs, and convert_memory_address wasn't set up > to handle those. > > The patch therefore adds some generic unspec handling to > convert_memory_address_addr_space_1. As the comment says, we can add > a target hook if this behaviour turns out to be wrong for some targets. > But I think what the patch does is a strict improvement over the status > quo: without it, we would try to force the unspec into a register, > but nevertheless wrap the result in a (const ...). That in turn > would be invalid rtl and seems bound to generate an ICE later. > > I tested the explow.c part using -fstack-protector with local hacks > to force SYMBOL_FORCE_TO_MEM for UNSPEC_SALT_ADDR. > > Fixes c-c++-common/torture/pr57945.c and various other tests. > > Tested on aarch64-linux-gnu, aarch64_be-elf and x86_64-linux-gnu. > OK for the explow bits? > > Richard > > > gcc/ > PR target/97269 > * explow.c (convert_memory_address_addr_space_1): Handle UNSPECs > nested in CONSTs. > * config/aarch64/aarch64.c (aarch64_expand_mov_immediate): Use > convert_memory_address to convert symbolic immediates to ptr_mode > before forcing them to memory. OK.    I can't think of a case where the operand-by-operand conversion wouldn't work, but as we both know, targets sometimes to "odd" things.   So a conditional ACK and we'll see how the various targets in the tester respond. jeff