From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id A6EBE385C660 for ; Mon, 12 Dec 2022 23:53:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A6EBE385C660 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 2BCNqeqb016158; Mon, 12 Dec 2022 17:52:41 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 2BCNqeUd016157; Mon, 12 Dec 2022 17:52:40 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 12 Dec 2022 17:52:40 -0600 From: Segher Boessenkool To: Adhemerval Zanella Netto Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] longlong.h: Do no use asm input cast for clang Message-ID: <20221212235240.GF25951@gate.crashing.org> References: <20221130181625.2011166-1-adhemerval.zanella@linaro.org> <20221130232456.GT25951@gate.crashing.org> <3e4bc189-7d73-f875-b425-61dde1a86e34@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e4bc189-7d73-f875-b425-61dde1a86e34@linaro.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Dec 12, 2022 at 02:10:16PM -0300, Adhemerval Zanella Netto wrote: > On 30/11/22 20:24, Segher Boessenkool wrote: > > I understand that the casts should be no-ops on the asm side (maybe they > > change the sign) and they are present as type-checking. Can we implement > > this type-checking in a different (portable) way? I think the macro you use > > should be named like __asm_output_check_type (..) or so to indicate the > > intended purpose. I didn't write that. Please quote correctly. Thanks! > I do not think trying to leverage it on clang side would yield much, it > seems that it really does not want to support this extension. I am not > sure we can really make it portable, best option I can think of would to > add a mix of __builtin_classify_type and typeof prior asm call (we do > something similar to powerp64 syscall code on glibc), although it would > still require some gcc specific builtins. > > I am open for ideas, since to get this header to be clang-compatible on > glibc it requires to get it first on gcc. How do you intend to modify all the existing copies of the header that haven't been updated for over a decade already? If you think changing all user code that uses longlong.h is a good idea, please change it to not use inline asm, use builtins in some cases but mostly just rewrite things in plain C. But GCC cannot rewrite user code (not preemptively anyway ;-) ) -- and longlong.h as encountered in the wild (not the one in our libgcc source code) is user code. If you think changing the copy in libgcc is a good idea, please change the original in glibc first? Segher