From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 21EC238540B7 for ; Mon, 12 Dec 2022 17:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 21EC238540B7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x231.google.com with SMTP id n205so11839604oib.1 for ; Mon, 12 Dec 2022 09:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=LsJYqUOvPpSDJubIHtrVNe2iBUuxYY5pZCrzrMyBmZ8=; b=TnjBzI4danwGmJ+gfjDy+1/xX25Aqhq+UJAK/2Nqh+HK1l84wV/Soc87vpF5Nfcw8s 3IQ9VKiDn4x0tFjMExpi/gI6HuDmvqG0ZvPSZXULK3QIAZ2QaLx6DSqg2+j6C4KDqasu HEq+sEi8mYstoOEPTtWyQ7nPQZXjMmAZ/Vi/3zesvSI+Pc1ccyzHiiW88R0c9CdKNt80 clEioWrANMQQi14+yu0il/BeGy0Oz2FdeSDsE391grMas3pECdVbCiaMmU/J6bu8+l3w P4670kJL9calgViS69IhW077uGipsqaDvTRfQmV73p93mrlIIBcXa1Td2mNyHj3fU2oo cUow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LsJYqUOvPpSDJubIHtrVNe2iBUuxYY5pZCrzrMyBmZ8=; b=2KFSJljiTFCXS4e08xpmgT6McCNlfYPOths7CIpZmQnArUTqYokeOxucjEi5bl1acc WuTGQhAi9VaWCvNTT7A81fX7becr3INa+/85uJmRSOeqm5M13XGz4/6E/BT4U752Rn6t XEQSlLaYtT//o0AnrdcZq58vRB76Kd+qw9fv2DAbzWthASTXnf91HxHc4TSC9HPudET4 ByT/3m59GbBIJjjK+RCsHxBctNRAZZBzidCsBsXr5iix+Wo1Ti+ugQcro5yJ35LlqDrD YJc2EEO5/chtdINTh1e5QDryaf+JLfgFZTrshDIUc8H0Do+P/elJJv+ZPEJDggBLjL8u 1SKw== X-Gm-Message-State: ANoB5pm3qPkBpw0w3o0pOTO9RzNa/pWyAXbXM+1di1HjhL1XYH7ufFBw wFdV8kmYyGDS46BsCUxhoM8tvw== X-Google-Smtp-Source: AA0mqf6bBgTtTjSMHLU/lWZAu9FocHgSRfuje+NXfdLcenuzUEu6ah/UNwPJs5/A8/GTRVW9j2Udig== X-Received: by 2002:a05:6808:51:b0:35a:a7d:941b with SMTP id v17-20020a056808005100b0035a0a7d941bmr8223673oic.10.1670865095254; Mon, 12 Dec 2022 09:11:35 -0800 (PST) Received: from [192.168.15.31] (201-92-181-161.dsl.telesp.net.br. [201.92.181.161]) by smtp.gmail.com with ESMTPSA id v19-20020a056808005300b00359ad661d3csm3718229oic.30.2022.12.12.09.11.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Dec 2022 09:11:34 -0800 (PST) Message-ID: <3e4bc189-7d73-f875-b425-61dde1a86e34@linaro.org> Date: Mon, 12 Dec 2022 14:10:16 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] longlong.h: Do no use asm input cast for clang Content-Language: en-US To: Segher Boessenkool , Richard Biener Cc: gcc-patches@gcc.gnu.org References: <20221130181625.2011166-1-adhemerval.zanella@linaro.org> <20221130232456.GT25951@gate.crashing.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20221130232456.GT25951@gate.crashing.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 30/11/22 20:24, Segher Boessenkool wrote: > Hi! > > On Wed, Nov 30, 2022 at 03:16:25PM -0300, Adhemerval Zanella via Gcc-patches wrote: >> clang by default rejects the input casts with: >> >> error: invalid use of a cast in a inline asm context requiring an >> lvalue: remove the cast or build with -fheinous-gnu-extensions >> >> And even with -fheinous-gnu-extensions clang still throws an warning >> and also states that this option might be removed in the future. >> For gcc the cast are still useful somewhat [1], so just remove it >> clang is used. > > This is one of the things in inline asm that is tightly tied to GCC > internals. You should emulate GCC's behaviour faithfully if you want > to claim you implement the inline asm GNU C extension. Agree, that's why I just make it a no-op for clang which indicates that it does not seem much use of this extension. > 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 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. > >> --- a/include/ChangeLog >> +++ b/include/ChangeLog > > That should not be part of the patch? Changelog entries should be > verbatim in the message you send. > > The size of this patch already makes clear this is a bad idea, imo. > This code is already hard enough to read. Indeed, I forgot that CL entries were not part of the commit.