From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgGhC-00035K-F3 for qemu-devel@nongnu.org; Fri, 11 Aug 2017 16:38:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dgGh9-0004tx-91 for qemu-devel@nongnu.org; Fri, 11 Aug 2017 16:38:14 -0400 Received: from mail-pg0-x22b.google.com ([2607:f8b0:400e:c05::22b]:38519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dgGh8-0004tY-Vc for qemu-devel@nongnu.org; Fri, 11 Aug 2017 16:38:11 -0400 Received: by mail-pg0-x22b.google.com with SMTP id l64so19498734pge.5 for ; Fri, 11 Aug 2017 13:38:10 -0700 (PDT) References: <2fbcf76e4ff63d8527edd3662342948276e2cd37.1502474835.git.alistair.francis@xilinx.com> From: Richard Henderson Message-ID: Date: Fri, 11 Aug 2017 13:38:06 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v1 3/3] target/arm: Correct exclusive store return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis Cc: Edgar Iglesias , Peter Maydell , qemu-arm , "qemu-devel@nongnu.org Developers" , Edgar Iglesias On 08/11/2017 01:29 PM, Alistair Francis wrote: > On Fri, Aug 11, 2017 at 1:24 PM, Richard Henderson > wrote: >> On 08/11/2017 01:13 PM, Alistair Francis wrote: >>>>> + tcg_gen_ext_i64(val, val, memop); >>>> >>>> What is this addition intended to accomplish? Because of the position within >>>> the code, you know that memop contains MO_64, so that this is a no-op. >>> >>> This is when size == 2 so it's a 32bit operation so memop contains MO_32. >> >> It's a paired 32-bit operation, so we're operating on a 64-bit quantity. So >> extending from 32-bits would be actively wrong. > > From what I can see though, the 32bit memop is carried into the > tcg_gen_atomic_cmpxchg_i64() call so the value returned to tmp is > masked by the 32bit operation. > > Is passing down MO_32 into tcg_gen_atomic_cmpxchg_i64() wrong then as > it ends up as a 64-bit operation? If we're passing MO_32 down to cmpxchg_i64 for this case, you have indeed found a bug. I'll investigate this further on Monday. r~