Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp472087lqe; Sat, 6 Apr 2024 08:40:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLCdk30J4oKVAz86ai8aBB9ec1MGCFCLJZ4koVpzWbjq9xs2xb6sWChYPJWoCXG88vDyU35Ns8Q65ihXMGNueAElM6IshytpcMpYVS5g== X-Google-Smtp-Source: AGHT+IG05eoaSg5Z0rHZPuTfTaN+Vnb8KJRJ1JQDYfTZSf2x5+J7veLCSdGy88uENPaW4PZjlHd8 X-Received: by 2002:a17:902:fe0c:b0:1e2:b4ce:4f8a with SMTP id g12-20020a170902fe0c00b001e2b4ce4f8amr4589355plj.53.1712418020449; Sat, 06 Apr 2024 08:40:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712418020; cv=pass; d=google.com; s=arc-20160816; b=elme9EeTVL5h98JH6eiHh0Cp8eK29TLFxlkdDScmy/MG2V552/S7MEFKYG3q+XhFu/ 3n2gc8mDafwB+2B+42fpW8Gop2jcOjDVIAYqN8Q6PRTpj0dmxmx8DVjyr9j06E5hWA2k At4bylru/KEwL55jYx+OZwlQtBUtlq0aM069bnE+0T+6CwaK+oSTQVtEDH56VSGJ5Zpj igSe/8NvL/CFfAzUs9DJoAiCE7AK1JLnRFRvtfF3xANxYgMf9G3txMLRSFNNg6qLVVEe y6AbLAPR6X/RrutpswicZ/0nz2bMvdHiPsCONPYnc/OIeFnqTdd6atZd9oLiOxG8EoMu 28dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=5uKe1Oc3INaUQyL3mPJmBXZ1VVEoPKZ2R4vtagmXnyE=; fh=mFYpyhnJfSQpLHFGiKMjLKOOO/hunnFBdQvYzHQHLyI=; b=oOn02fCxlJTt5c9qg85GcrYnBIpjBk8QTS8Nlg9Bo3qotYtMb7Ga+VRXksw/aSPajK KZ4hhEKqgNLIuM/cMRwc+/xzMNStH/B6G9cpIChp1FqzBAz9dVhTCt8IgHwpjDjoyXRw B+lZ6YKWRVjjgbH+WAGBRiDM7LtYkCp5tI+dGdakjPaVM77duMKLK+WTR7x2RWl5ci/d 3EB64R4AgaKA7mkdaS6jswGZxLLKgpSK8lRlL9uzD3fobc2ovWWjAg0Ix54OX7YFNQcX 9XKj8kd2R9ARoPinA7DL/C+WAJWtsosgI9EZhWLpDqALEa2FjuiBl9YPjmV1Ep07ZkHd 5x/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RYbExPCD; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-133981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133981-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t9-20020a170902e84900b001e26b7e5dd4si3336406plg.70.2024.04.06.08.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 08:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RYbExPCD; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-133981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133981-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id ED10AB21877 for ; Sat, 6 Apr 2024 15:40:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AA133BBDE; Sat, 6 Apr 2024 15:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="RYbExPCD" Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60A9F3BBC1 for ; Sat, 6 Apr 2024 15:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712418010; cv=none; b=iwztenyjOlLMgzpxPNzFMevVPNESr5TSrQG5400Qwt/KkzTL0SFqY5JSnefvOsFZIrB3+WCoqzHVRvWTsbMumE2Q0ATlipYe+WjnuyOibzNpmy+taW+2362tqkLLtXVDp8Q6lYSHCUHjGvz0F90Xu7TdmrPmLzmXWfaKsezL89E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712418010; c=relaxed/simple; bh=g4WUAhon2OZw1+PQFctQN5UzkWQs6940GrC8r15MZCM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=DY6BZ8Tbd5+Y9GVQVCA+HXL4uev3RV2qxQo2Qj2HEjS+ZLeVSYMgV1xr+lRx+ylEucyVGDdkY8h8lx/0ZfHamWgbqP/DzoCIlcvP22P8jFXEWQPZehPo6L/9nq+ogsXaKcpGDeukAtqOlrJnRk1Zk7FdRAjN4ymMn47i1WpM6RM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=RYbExPCD; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-56e2b41187aso3041947a12.1 for ; Sat, 06 Apr 2024 08:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1712418006; x=1713022806; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5uKe1Oc3INaUQyL3mPJmBXZ1VVEoPKZ2R4vtagmXnyE=; b=RYbExPCD0Ssmzgl6YUAkeo4emb2VHVCRCyN7WsZsM1VFBRvrDi16RWm2AgTzeSHx2M OF93MmIFgN0QpG525Zo7Hb9i7x/K+vdRjhelMf/GV/V3BRGMucHalecGKNl+uSLP3N1N a4EvC4dNfBDNtZq1Pmu8ALPNslhpcKkLsnJg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712418006; x=1713022806; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5uKe1Oc3INaUQyL3mPJmBXZ1VVEoPKZ2R4vtagmXnyE=; b=Ybbaq6w1LhRlaZ50shha2HtLaEA1OWT9wPQaJfmUhPcgnY4wQ8Ao8T1OK4284Fsks3 UeDxFjvBNv7jE9Md02V/YszJBeM6+tijDBIdC0+8mkBo51fbiIlX7thfjkC5xlSp6k3W GV03VBVNR2CwtlpYcHDbRFpqjLsmeJnj4tZ5fcTOhyEWHcPvLA4hZmgs+1Ac9DE6zQHu /eEbj5MTSUg1aDz8sObP9+M/kyeiql9ECVAsfxRbLEIAX5EdqblOigL/T2133skMhIPu hqZ080/0ZqcVFeNQzQJkqIwcpbjeKR7SgXeJxEHNbHgqx4MKaQwKCaE5YTzQa75OPDnh lWLw== X-Forwarded-Encrypted: i=1; AJvYcCW7J4dSEJ1uGotFkoEKBmt26NSwv87q3BiHUIK9ZakOqcPlWd5Ir6fCswsCGRhKVQ3juPfXjPtcWXi09GEu7x32QydZTF6RbX8bWoYV X-Gm-Message-State: AOJu0YwxsJvnpXMhVHnOI620qJ8RrDFvfOU+9qBaO06k0sOJ20tydJpy 9jXZqNhdoThhu6sgi2RToYAWS61GXDxUgni2YAYydYJsakjwL1M9NX0gHl8ZrBkIiSKMZY04QyN ILCaHFg== X-Received: by 2002:a50:9e44:0:b0:56e:2a6a:8d3a with SMTP id z62-20020a509e44000000b0056e2a6a8d3amr4416449ede.15.1712418006693; Sat, 06 Apr 2024 08:40:06 -0700 (PDT) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com. [209.85.218.52]) by smtp.gmail.com with ESMTPSA id et6-20020a056402378600b0056b8dcdaca5sm1983145edb.73.2024.04.06.08.40.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Apr 2024 08:40:06 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a51be56961bso58833166b.1 for ; Sat, 06 Apr 2024 08:40:05 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWdA4vZIl6fytYgvE3zXyEKXfSaK2wxHcdUr66ndGQdOxOzVq4NIk028AIJ34pdyRsL/CwAdKsu3NBlZpl6v7QsSjZA8Y3kqGyL93pW X-Received: by 2002:a17:906:6a17:b0:a51:c1f7:93 with SMTP id qw23-20020a1709066a1700b00a51c1f70093mr1161774ejc.13.1712418005170; Sat, 06 Apr 2024 08:40:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sat, 6 Apr 2024 08:39:48 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: More annoying code generation by clang To: Uros Bizjak Cc: Ingo Molnar , Nick Desaulniers , Nathan Chancellor , Thomas Gleixner , Peter Anvin , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" On Sat, 6 Apr 2024 at 05:30, Uros Bizjak wrote: > > FYI, please note that gcc-12 is able to synthesize carry-flag compares > on its own: Oh, gcc has been able to do that for much longer than that. It's a idiomatic i386 pattern, and gcc has generated it for as long as I can remember. HOWEVER. There's a big difference between "able to" and "GUARANTEED to". Because this code actually requires a data-depencency and not a control dependency as a correctness issue because of Spectre-v1. So while I know very well that gcc _can_ do it, I also know very well that there are absolutely no guarantees that gcc won't use a conditional branch instead. So this code is needs to generate good code because it's actually important code that shows up in benchmarks, but this code also needs to generate a very _particular_ pattern of code, and it's not good enough that gcc may "happen" to generate that pattern of code. Thus the inline asm. Linus