From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796137115; b=fPicOE3eUKtsz3rjiSP8el4CTaSIlk68fj7nXhY7/M53XOYC8vwZsffVcn+Pc66OVS9i G1XrYfs0XZD9ONBnHLSkzWKwwHl7g9oO/Uiq10z39KyRbZmMYX0wJ+aqGNgm6jNBm2TTW u+jntNvyY1aaZdp8m0SA4R7P8bGpmwgSZSTbNclkUYZmTZO1Lx8iiMEd+I9hDjsEkhS5c 69Vsc4E/PMvWC8gUSvuxDDk++a+ws22olyK5S+XDjyJJgzuLdrJ6sNuKHq0l2x9XvIn7j szYw8eEWM5F6k36KzvWhj7Qn921Q8tKa7YUKh7wIEEpcpfLK/v5qj63k2lpQzNxT0zQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137115; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=EC0ehaQVn4VUcvXcOWBfss86TQ5nCPEQxdfoepXA5Vo=; b=U+TbqQK+lNdfT6Gltae5wqBWuiGuGdissin+gMQRVihL2GKluoVAnBHAMdr1rzmDvojg aJGkKPlDl+0mEs7JWLKPN/h5CFRQ0xECN6VJ6xuyJSF/4mtZdmbCjgKtldpBKWhgfTI8B jjdD6IORueXJN6ikK4RLDPwNtTCCPzwMhi2hgoCcxFxCCwgxMRLkEPOCWbgbRozkEH71e RTx2HZ+UHFFiQifdTLJUGMEmaM+bT+C0uGDEZ82Ek96Xjp1tbSthQAbhwhp5OadgZs2Fn WuJk14loGQjG9rsPNG3QlCdfNMS27B3cPh35C72kjNmy3JjQ8Z1trp43s/A1NIFd18A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0OjAWpeL; arc=none smtp.remote-ip=209.85.221.49 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 148F5606A332 for ; Tue, 1 Dec 2026 14:58:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 148F5606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0OjAWpeL Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-48e3b22e971so6142129f8f.0 for ; Tue, 01 Dec 2026 06:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796137113; x=1796741913; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=EC0ehaQVn4VUcvXcOWBfss86TQ5nCPEQxdfoepXA5Vo=; b=0OjAWpeLFBumxXv1+wNgCbnODB+2U+psGGJq3GDNVdIa1cm0MqgZKGgcU+bg4CP9Kz p5w7OSPeJ/SguoEx3VIo7ypgOT9XQnB+dut/AsU03CjsGzoyXdQekQqNVipkquo6ATsl NcYF8koP/XrFWTEAG8I15Lyzkqwf9mRVxsCw5k+sKcOYqvoMW0CAntQ+u8sEHvd+k/YJ dgQYI5Q8YDc15LUkTvKph1tQE68sH5pSJLS/P+idr1aw6fEgJCsyKM/8XD8ew6jvWXng Ehi49lxJi43ydAyV+v7TEZ3BhWV9UCUAzBD4GXdRQS+PKSTbsgRbNWwKWMD0DcxAo30U 8qkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796137113; x=1796741913; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EC0ehaQVn4VUcvXcOWBfss86TQ5nCPEQxdfoepXA5Vo=; b=sPzQSKeLKTAll1TtP8sOIbo1zWugjxmiGmG7sFDh+TWOQURrDkZnthWh9hSMyJKSIw 5fCj/IDSQQI4kbvG7vJjGkbaJGA+G12rwxbxScpSBmrpjiGz+tSDCltQElmnBypIRw1R 7MjnJzE37IGzojfvmOLaTcRRBVhpgUZsf2UIq08YH1Rhne2WvwKXK88OFJH+MqD7a6fO KIEsPLos4aciLXHt9CWdS4mvLt2QQP1vEHfF3bpQBrJYbCx52iYdNJ03QRECWIFqx0Ju 0OVZUDTkNKwG9glEdOcloloPb3bo7SaTI7vzAhDtTjZ2FYekdK8BbBAHY4+8njonRDNr lbug== X-Forwarded-Encrypted: i=1; AL+hErHEVZhgNH/91lWRk6OmZHgPXCRUP4lIn52NvCnquBlNH+UWDW0gq+l2BEUisR7y+qrZ+PFcRWnsZiplods=@vger.kernel.org X-Gm-Message-State: APuU4Z8ksW9KqWttMb/3fJvkhHPRDNUVCKWlUQF+pRvOHHKPs5oKB9go ziWOiRLlK8RfY5kaiXcRdEPgn+lI2mTw4k77WyMFm7rxh8rH7CdYbnGm X-Gm-Gg: AZFdTZdSplAUesB0VoTI7Vmzm6B2QcXHWv/SDeGPZgqZ/YGAJKB4ImX47+CqZNCTIuT p4Mj9LPt5S3xhHC2xZmvD/KBAjoNUw7TcPn6zxoRgBrRLro0jxa+IkNtANfQSM5AtJJRVmaoeTg 4O1DN3osbOwfPMf4H3puT76c5wwkDTpLF62bTYmMEhAO709tHZAv5mbMWqnV5ZNvtmBds/Kcn4l pG0cQ58GZTKiLulRInoGhFk7d1DTPKnluyn5i2qn2XId+ehUTOaAGDi+kNaT8mrvZT6oyHN3Y6v FpvGXw+W8YlPAym6XD7exzve6/oo+siM7SIrH5aL7HDVfGl6aHIOWbDiEFWp2wvpLV9NLaaygh1 dziG0d69RuV4hyYUuRqPNQS52Ggi9shYWivdOAvXX7xXQkzx07WMkEdC5+jObYz2va7u9MTTPWx KdFwqGUopKdO9j7ziCLCMyU7gS8CF9XOpVCb6hsM0Q9mtsyBQ4EVc2SsxdLjj/sO9Swog1bVWZD KSZKP/yx0uNNaGEVaXtNNK9Y1Da3QdI8MdckSskORy0OFyNQ+uDNNbxJ0gD3qrOv68hU+WBE5iQ YOYZLJN9leAB5RUD68oz9s3nwLT/gzXntOF7m21e+iaMBpakxjv6RawFWD+TMGU6 X-Received: by 2002:a05:6000:2c13:b0:48d:f95e:6e8 with SMTP id ffacd0b85a97d-4abab02d26emr68917770f8f.1.1796137113311; Tue, 01 Dec 2026 06:58:33 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab658e2d60sm72096675f8f.3.2026.12.01.06.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 06:58:33 -0800 (PST) Date: Tue, 1 Dec 2026 14:58:31 +0000 From: David Laight To: "Nysal Jan K.A." Cc: linuxppc-dev@lists.ozlabs.org, Jeevitha Palanisamy , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , Shrikanth Hegde , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , "David Hildenbrand (Arm)" , Ryan Roberts , Andreas Larsson , Usama Arif , Kevin Brodsky , "Kiryl Shutsemau (Meta)" , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 1/3] powerpc: Add support for 128-bit cmpxchg Message-ID: <20261201145831.7d897df2@pumpkin> In-Reply-To: <20261201144804.6a0270d5@pumpkin> References: <20261125174035.1412724-1-nysal@linux.ibm.com> <20261125174035.1412724-2-nysal@linux.ibm.com> <20261126112714.021a3e66@pumpkin> <20261201144804.6a0270d5@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 1 Dec 2026 14:48:04 +0000 David Laight wrote: > On Tue, 1 Dec 2026 19:22:06 +0530 > "Nysal Jan K.A." wrote: > > > On Thu, Nov 26, 2026 at 11:27:14AM +0000, David Laight wrote: > > > On Wed, 25 Nov 2026 23:10:22 +0530 > > > "Nysal Jan K.A." wrote: > > > > > > > > > > > +#ifdef CONFIG_HAVE_CMPXCHG_DOUBLE > > > > +union __u128_halves { > > > > + u128 full __mode(PTI); > > > > + struct { > > > > + u64 low, high; > > > > > > There seems to be a mismatch between the register order that PTI > > > assigns and the one that C uses. > > > It might be less confusing to swap low and high in the above > > > and only use 'full' (probably renamed) in the asm statement. > > > > > > > I can swap high and low here to indicate that it maps to the big-endian > > register layout if that makes it less confusing. > > But AFICT it doesn't (if I believe the AI from google for "ppc64le lq word order". > The high bits (from EA + 8) end up in the even register and the low bits > (from EA) in the odd register. But that doesn't match a test I just did on godbolt. If the order is backwards then you do need to swap low and high and only use 'full' (aka full_partially_be) for the asm constraint. David > > I suspect (as in the other email I just sent) that when you do: > u128 x; > > asm(... : "=r" (x)) > you are getting the register that holds the low bits of 'x'. > But you want the one containing the high bits so that you can use L[] > to reference the low bits. > The code might appear to work because on a function call the lower > register contains the low bits; so, if the register isn't reused, > L[x] will be the high bits. > > You might be able to tell which registers gcc thinks are 'live' > by adding one to the clobber list. > You can't add one that is in use; so it should force an alternative > register allocation. > > David > > >