[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-25 Thread Nick Desaulniers via cfe-commits
@@ -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];

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-25 Thread via cfe-commits
@@ -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];

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-25 Thread Nick Desaulniers via cfe-commits
@@ -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];

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-21 Thread via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-21 Thread Nick Desaulniers via 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-21 Thread Nick Desaulniers via 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-20 Thread via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-19 Thread Eli Friedman via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-19 Thread Eli Friedman via 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-19 Thread Eli Friedman via 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``

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-13 Thread Nick Desaulniers via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-05 Thread via 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-04 Thread via 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?

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-04 Thread via cfe-commits
@@ -2212,6 +2212,54 @@ static bool SemaBuiltinPopcountg(Sema , 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-03-04 Thread via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread Eli Friedman via cfe-commits
@@ -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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
@@ -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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread Eli Friedman via cfe-commits
@@ -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?

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread Eli Friedman via cfe-commits
@@ -2212,6 +2212,54 @@ static bool SemaBuiltinPopcountg(Sema , 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread Eli Friedman via cfe-commits
@@ -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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
@@ -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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via 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

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
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] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
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] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
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}