Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1335540pxf; Fri, 9 Apr 2021 06:07:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDKVUjEUzfW0TTvvuQmFYtvOS7RKgOWg7CivegBCWekbZmV+tPUbqKeOMpYByoirzSYbgT X-Received: by 2002:a17:902:bd41:b029:e6:933a:f3ef with SMTP id b1-20020a170902bd41b02900e6933af3efmr12772507plx.19.1617973647120; Fri, 09 Apr 2021 06:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617973647; cv=none; d=google.com; s=arc-20160816; b=zYzMtwCkuY6eTF4RiT4vIFifwLNwFPHaZmKIJZuh1NU2VYT7YXJf49rYlHW5kqfXuK DL4sW8ahAIZkVXyWYMQhCAyXgqzFlwH5jp/bL7ybrLvf73yc3xTbHvZ0IH59fzhwcq8H gpn27Intm6le6OdSQzw1zZqF/lpuITpF9jb2L2PvazLE4Dkj0z9OH/p5qWDacm3gkQkM aAEpafUcA7Z4ZzUnpEqYBLudnkpNvYd5dTMS6PWEhI9xt+FGgTxsFXMQ/TRSXphv4P9x K2nK0FY+x+8GfIhnzvH7wJTmzzylO9Dd8YbNJ3Vuv9mgZsyxkJKhk8i9AS34mAeQMgAp N1MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4rMCjSUjSUHHj67qaMQr5/GLAzeU/2+Mtn3XXlV2Kes=; b=sgRtAFcai8IRAmEP4v/L/2hJkJY+wo09WKdV7z7dnOLHKsmIHDkQO9aAW12ULJJr9B lK9Y/Ea/P7HYq6dkBBpV1mDJsnH64+eXBEDoww3otAa32b5+sTKOZOJdd3s7KhGDt7EN 1R+64sVHxDaKlrvXY/8PrtWflO+ETQM9T8m0/KfhniT3x1UKWvQV/ddqoNhEds3SyuCv W/IGBCR0dok1hIEIRffwMbSkXNlQzd5g+d5b+ISvuJ/hHGjS835E+YOe3QRZnOMt+0xL I1aGOP7T/Dq9KqLyq9MgHCJeTd3YvYPTaGwXf3BUYHVKoGPhRj0WhrrufV2Kw+7tOYJb o3ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt14si3393065pjb.146.2021.04.09.06.07.11; Fri, 09 Apr 2021 06:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbhDINGj (ORCPT + 99 others); Fri, 9 Apr 2021 09:06:39 -0400 Received: from gate.crashing.org ([63.228.1.57]:48023 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbhDINGi (ORCPT ); Fri, 9 Apr 2021 09:06:38 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 139D3gVC014409; Fri, 9 Apr 2021 08:03:42 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 139D3gug014404; Fri, 9 Apr 2021 08:03:42 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 9 Apr 2021 08:03:42 -0500 From: Segher Boessenkool To: Peter Zijlstra Cc: linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org Subject: Re: static_branch/jump_label vs branch merging Message-ID: <20210409130342.GF26583@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 08, 2021 at 06:52:18PM +0200, Peter Zijlstra wrote: > Is there *any* way in which we can have the compiler recognise that the > asm_goto only depends on its arguments and have it merge the branches > itself? > > I do realize that asm-goto being volatile this is a fairly huge ask, but > I figured I should at least raise the issue, if only to raise awareness. "volatile" should not be an impediment to this at all, volatile means there is an unspecified side effect, nothing more, nothing less. But yes this currently does not work with GCC: void f(int x) { if (x) asm volatile("ojee %0" :: "r"(x)); else asm volatile("ojee %0" :: "r"(x)); } or even static inline void h(int x) { asm volatile("ojee %0" :: "r"(x)); } void f1(int x) { if (x) h(x); else h(x); } which both emit silly machine code. Segher