mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[clang] Mark __builtin_convertvector and __builtin_shufflevector as constexpr. (#112129)
Closes #107985. LanguageExtensions.rst states that `__builtin_shufflevector` and `__builtin_convertvector` can be evaluated as constants, but this is not reflected in Butiltins.td. This patch aligns these two.
This commit is contained in:
@@ -1198,13 +1198,13 @@ def AllowRuntimeCheck : Builtin {
|
||||
|
||||
def ShuffleVector : Builtin {
|
||||
let Spellings = ["__builtin_shufflevector"];
|
||||
let Attributes = [NoThrow, Const, CustomTypeChecking];
|
||||
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
|
||||
let Prototype = "void(...)";
|
||||
}
|
||||
|
||||
def ConvertVector : Builtin {
|
||||
let Spellings = ["__builtin_convertvector"];
|
||||
let Attributes = [NoThrow, Const, CustomTypeChecking];
|
||||
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
|
||||
let Prototype = "void(...)";
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,14 @@
|
||||
#error Clang should have these constexpr builtins
|
||||
#endif
|
||||
|
||||
#if !__has_constexpr_builtin(__builtin_convertvector)
|
||||
#error Clang should have these constexpr builtins
|
||||
#endif
|
||||
|
||||
#if !__has_constexpr_builtin(__builtin_shufflevector)
|
||||
#error Clang should have these constexpr builtins
|
||||
#endif
|
||||
|
||||
#if __has_constexpr_builtin(__builtin_cbrt)
|
||||
#error This builtin should not be constexpr in Clang
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user