From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6w8-0003Zg-NM for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:37:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WS6vw-0002Tn-HD for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:37:16 -0400 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:47407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6vw-0002Tb-5n for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:37:04 -0400 Received: by mail-qg0-f45.google.com with SMTP id j5so17158589qga.4 for ; Mon, 24 Mar 2014 08:37:03 -0700 (PDT) Sender: Richard Henderson Message-ID: <5330511B.3050501@twiddle.net> Date: Mon, 24 Mar 2014 08:36:59 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1394851732-25692-1-git-send-email-rth@twiddle.net> <1394851732-25692-8-git-send-email-rth@twiddle.net> <53303B93.2090206@huawei.com> In-Reply-To: <53303B93.2090206@huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/26] tcg-aarch64: Use adrp in tcg_out_movi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Claudio Fontana , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, claudio.fontana@gmail.com On 03/24/2014 07:05 AM, Claudio Fontana wrote: >> > + /* Look for host pointer values within 4G of the PC. This happens >> > + often when loading pointers to QEMU's own data structures. */ >> > + disp = (value >> 12) - ((intptr_t)s->code_ptr >> 12); >> > + if (disp == sextract64(disp, 0, 21)) { > > nit.. for the check to be correct in all cases, the assumption here is that > intptr_t is the same size as a signed target long; would a cast to > tcg_target_long instead of intptr_t be "safer"? > I don't think so. Gcc 4.9 supports an -m32 abi for aarch64. Suppose we were to compile qemu this way. In that case tcg_target_long would be larger than intptr_t, and the cast here would Werror. But leaving it intptr_t, we get a proper sign-extension with type promotion to tcg_target_long, and the arithmetic will in fact work like expected. r~