From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B0473858C53; Sat, 27 May 2023 17:54:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B0473858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685210047; bh=Xwm693dB0Id656aAlNdo8eHuu9I5Oj9s+vBmGA4YjwM=; h=From:To:Subject:Date:From; b=Nvigj/5EVbbAqOnpx0xHziXnaYCzSbWzxdKY30wgd/MH8Y65gAfB97fMVRkp/wkGg iF4nfzYP7E34XNqyCRAb4XWfRi24m0wWuByQiFlr8LNbPPq00THqaeoDTJUjcWMXoL 4s2drWax/ueYeGT7nXj+kSgo/uJt5x2r/q64HrPM= From: "richard.yao at alumni dot stonybrook.edu" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjLzExMDAwN10gTmV3OiBJbXBsZW1lbnQgc3VwcG9ydCBm?= =?UTF-8?B?b3IgQ2xhbmfigJlzIF9fYnVpbHRpbl91bnByZWRpY3RhYmxlKCk=?= Date: Sat, 27 May 2023 17:54:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: richard.yao at alumni dot stonybrook.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110007 Bug ID: 110007 Summary: Implement support for Clang=E2=80=99s __builtin_unpredictable() Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: richard.yao at alumni dot stonybrook.edu Target Milestone: --- Having the ability to specify __builtin_unpredictable() as a hint to encour= age the compiler to use cmov would be useful for implementing algorithms like binary search that have unpredictable branches. __builtin_expect_with_probability() looks like a possible substitute, but C= lang does not support it and it does not always work as described in #110001. Combining this with C=E2=80=99s ternary operator should make the proposed c= mov builtin from #98801 unnecessary. Note that while clang implements __builtin_unpredictable(), it does not currently pass that information to the backend: https://github.com/llvm/llvm-project/issues/62790#issuecomment-1552671099=