@@ -660,15 +660,23 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
let Prototype = "int(unsigned T)";
}
-// FIXME: Add int clzimax(uintmax_t)
+def Clzg : Builtin {
+ let Spellings = ["__builtin_clzg"];
+ let Attributes = [NoThrow, Const, CustomTypeChecking];
---
@@ -660,15 +660,23 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
let Prototype = "int(unsigned T)";
}
-// FIXME: Add int clzimax(uintmax_t)
+def Clzg : Builtin {
+ let Spellings = ["__builtin_clzg"];
+ let Attributes = [NoThrow, Const, CustomTypeChecking];
---
@@ -660,15 +660,23 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
let Prototype = "int(unsigned T)";
}
-// FIXME: Add int clzimax(uintmax_t)
+def Clzg : Builtin {
+ let Spellings = ["__builtin_clzg"];
+ let Attributes = [NoThrow, Const, CustomTypeChecking];
---
overmighty wrote:
I do need one of you to commit this for me. You're welcome. :)
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/nickdesaulniers closed
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
nickdesaulniers wrote:
@overmighty do you need one of us to commit this for you? Thanks for working on
it!
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/l
https://github.com/overmighty updated
https://github.com/llvm/llvm-project/pull/83431
>From 5e37b3b2f57c7683686b8ac64aa1566855826a9f Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Thu, 29 Feb 2024 14:23:40 +
Subject: [PATCH 1/3] [clang] Implement __builtin_{clzg,ctzg}
Fixes #83075, fixes
https://github.com/efriedma-quic approved this pull request.
LGTM with one minor comment
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/efriedma-quic edited
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3504,6 +3504,47 @@ argument can be of any unsigned integer type.
``__builtin_popcount{,l,ll}`` builtins, with support for other integer types,
such as ``unsigned __int128`` and C23 ``unsigned _BitInt(N)``.
+``__builtin_clzg`` and ``__builtin_ctzg``
+---
nickdesaulniers wrote:
@efriedma-quic parting thoughts here?
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
overmighty wrote:
cc @nickdesaulniers
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3157,7 +3177,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
if (Result->getType() != ResultType)
overmighty wrote:
Right. Is it worth making tests for this with a target where
`isCLZForZeroUndef()` is false?
htt
@@ -2212,6 +2212,54 @@ static bool SemaBuiltinPopcountg(Sema &S, CallExpr
*TheCall) {
return false;
}
+/// Checks that __builtin_{clzg,ctzg} was called with a first argument, which
is
+/// an unsigned integer, and an optional second argument, which is promoted to
+/// an '
https://github.com/overmighty updated
https://github.com/llvm/llvm-project/pull/83431
>From 5e37b3b2f57c7683686b8ac64aa1566855826a9f Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Thu, 29 Feb 2024 14:23:40 +
Subject: [PATCH 1/2] [clang] Implement __builtin_{clzg,ctzg}
Fixes #83075, fixes
@@ -3157,7 +3177,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
if (Result->getType() != ResultType)
efriedma-quic wrote:
I was more thinking of the opposite: we don't need to make the result of the
clz defined if we
@@ -3157,7 +3177,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
if (Result->getType() != ResultType)
overmighty wrote:
Since in the additions below I check if the argument itself is zero instead of
checking the resul
@@ -3157,7 +3177,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
if (Result->getType() != ResultType)
efriedma-quic wrote:
Not sure if the way this is handling isCLZForZeroUndef() is what you want?
https://github.com/
@@ -2212,6 +2212,54 @@ static bool SemaBuiltinPopcountg(Sema &S, CallExpr
*TheCall) {
return false;
}
+/// Checks that __builtin_{clzg,ctzg} was called with a first argument, which
is
+/// an unsigned integer, and an optional second argument, which is promoted to
+/// an '
@@ -662,6 +662,12 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
// FIXME: Add int clzimax(uintmax_t)
efriedma-quic wrote:
Probably; it's unlikely we're going to add them at this point.
https://github.com/llvm/llvm-project/pull/83431
_
@@ -662,6 +662,12 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
// FIXME: Add int clzimax(uintmax_t)
overmighty wrote:
Should this FIXME and the `ctzimax(uintmax_t)` one below be removed?
https://github.com/llvm/llvm-project/pull/83431
__
https://github.com/overmighty edited
https://github.com/llvm/llvm-project/pull/83431
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/overmighty updated
https://github.com/llvm/llvm-project/pull/83431
>From 580ee1d6f9807e02762a4d5e25fc9306aab9ddde Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Thu, 29 Feb 2024 14:23:40 +
Subject: [PATCH] [clang] Implement __builtin_{clzg,ctzg}
Fixes #83075, fixes #830
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: OverMighty (overmighty)
Changes
Fixes #83075, #83076.
---
Patch is 26.95 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/83431.diff
9 Files Affected:
- (modified) clang/docs/LanguageExtensio
llvmbot wrote:
@llvm/pr-subscribers-clang-codegen
Author: OverMighty (overmighty)
Changes
Fixes #83075, #83076.
---
Patch is 26.95 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/83431.diff
9 Files Affected:
- (modified) clang/docs/Language
https://github.com/overmighty created
https://github.com/llvm/llvm-project/pull/83431
Fixes #83075, #83076.
>From 3dbfd1fb21ef0ddccef27e1ceffce16dc298e1cf Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Thu, 29 Feb 2024 14:23:40 +
Subject: [PATCH] [clang] Implement __builtin_{clzg,ctzg}
26 matches
Mail list logo