From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796137115; b=G+xTnVT/7sm6kwW7YZRYffc7Xj9Cr1cuFlhfOZX8fkqNsyqTUqkt2XGcTYssr2BGOAym R2WwTmwmQf4C8Mp/4/Dyd2xuIBSy+0gNxaCijLprFi0SnUhPJmaz8cQ6fHjsI/vmVa0kQ F16RS9iv482EJ5iJY2JEm9/DRrXGikb+nz6yVeF6iY8UIVLfjN1QjjZUqGknk9V2OULJJ bXMVJ+hBQ9MJR0KYvCyCKjCiqbE/K9MU6Js5BD8dlQZnniMwu3z1zftJan7n2ip3RgoRd ijruFCtLjIZTY2kphRhOrjuY9csBUnQwYA5juLsgn6EhlKgYrukPZhdJp9JLhWncFdg== 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=as3UB14fEouXIyvHLXsmn8k70w7O9FhdL6tZ26jyaJICL8Eh8s2PnlVJv49eJ9hdmAHm +XPW/1ElVJ0e5LKhbLfp+oeiap8Qp37NK5+k24hO1FmBbhoASnfK33wHJVH0RJHK/9hjB zKJXxORwgszqTWrh1hUSj6WBX8gNCniUxeaOssdyZTLWIhZ3GPuAmixHVegljMNKKRi6h VGsAsRos/iy4VholhriciVACeZ1IPFgftMVZOmxpp+dQ6UhOnAoD2DNyw19FbZaavl4/7 i8iF6jrBTzITWu9Dl2asFH9jh6gRtiHzc4vv/4DXCgcwLyyYRnxLRmS8GG5ysgW2V7g== 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=vJuP42zi; arc=none smtp.remote-ip=209.85.221.48 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 07F5F606A32C for ; Tue, 1 Dec 2026 14:58:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 07F5F606A32C 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=vJuP42zi Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-491f34b4e0fso5299528f8f.2 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=lists.linux.dev; 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=vJuP42zi0lM1eSYi7+W6W1Wn6rrqhQIhIPbtaVFC1Dw6XQvn9aEyWe65Mdx7lEaRDt a+YUeYiWQgoOA8BvxCId2ljJrnUFy+DPTPYtBga9qDymt5WRW0Z9VtZQKEgZA6u0WNDI ChqW4c7e0G6uBRBCmAz0kIKyK+W2o/lcHPg2NhGjO9/1k1/RLRXEtq89ld2yzk1ck53T sj63hHhj9PmNm1uthclqsdlBqI/wscca6f3uq3HGTQulb41zDSdrGdgNVBjIUJ14l/Uz AKL3SEo7rjNfmqQnJxREmz1wYT4mLvZhL+FufBfFL+ObKdTcV+ljdvoBKDhbxLMPhIpe 6wow== 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=yWQAu+gwMofsnnhvjahIROYxkiGMM237KFT3hvnrqfSSgAznyMEqgVgTSUOD6rj/ng TzG3Gin+6woDzvxRMR2c078AsEAKKJMxUdxXjDO5F304Jypu9Akws9+6e8j8oOyQQyzW VVaG+oES0VSSV/1ZTyzc3GFTQZnEDeZOPeu5SMllSb0SzvW7T924Wu/etQayhAOF6q+3 FqFATcjLMN6Pr29T06AYwjm0E3A1UOqxZZTW+CaCerlI7A+Eoqlzrd0DTG1+KOld4X48 /BNRSwvKjezsRJdF9IAaJh8o5fUyNiDB0fvIEzvPyH48RCSc5sxzn3WAvQ7oquJCkRgC HG2Q== X-Forwarded-Encrypted: i=1; AL+hErFsNZydLE83euzeKMEoHImadOMr8gjNqRB0pmJpr3ExkeJNRp+u3cR3IOtnFRdlhPkHPFLF@lists.linux.dev X-Gm-Message-State: APuU4Z9/kJScD3vZji6YpSixsXmAD5FLfrDdF8ScHS4Vs8aepgY0I1GA yTVRcVaKGx/GEOrhHDXx/ayVpWSeYk5DizRAGBNV+p+nXdqFWv/xuQCK X-Gm-Gg: AZFdTZd/g2f0CSY0GLSo07FUJPuzELdj/LTNBS0GYYY3TGMdgL6buYY6lalv8qlxR7n QgUa+JgG2lPqGxk8k+7VnP3f+9DdVRu85olvoKi8NXWiqR9sERgBlggoMkSsuCMDWY+VRWaV2ny h2exeYqIFy/FfNqOVYUMufDQAP0XXUzh2mBPQE/X7rfcmjwEpd2y4xym6UXZlCLYDhjTLPP+aHf rjPPA8u8VA6nnYAfJzaG1KhA5Oj5TE7Nd2W57p1fyMO+JGp0FZ5B/+VSc/8cUpVK/nKlJrEZJyK IhxD6aM4VmI96AcYkhqZHtAtmfnUEB5M95WuqBbXfXis9URHBKi68RjPYRHXMrEE8EfI4JI9395 5SLky07YgL5lbLO7hdwzYpC6pRJ6sVwDvKhXo3lrIQDP5YdNHuOMVOxAV7jyNvunazV0cZQEPim FV/CbzX46o1ZPKKBefL8/+uFHXNCCkWOZlije+yLfRwKvgINeDPBESZavlNOen90W5DcX2RUXZM 0AkkwCdZS2zxbDsp70Ro0U+MujxPtuZuNeYfDWymwzBLaeEgbjtc0lk5hMudag4vYE7/i/G2nhc Uy8hGu1m5Z+2hKVK0BNjusH+y3URlKqG1C41FLv21B/x8U5+aGDoEPZnjD1WL9wi 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: llvm@lists.linux.dev 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 > > >