diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def index 1b060a509232..84b28811728e 100644 --- a/clang/include/clang/Basic/Builtins.def +++ b/clang/include/clang/Basic/Builtins.def @@ -376,9 +376,9 @@ BUILTIN(__builtin_ctz , "iUi" , "nc") BUILTIN(__builtin_ctzl , "iULi" , "nc") BUILTIN(__builtin_ctzll, "iULLi", "nc") // TODO: int ctzimax(uintmax_t) -BUILTIN(__builtin_ffs , "iUi" , "nc") -BUILTIN(__builtin_ffsl , "iULi" , "nc") -BUILTIN(__builtin_ffsll, "iULLi", "nc") +BUILTIN(__builtin_ffs , "ii" , "nc") +BUILTIN(__builtin_ffsl , "iLi" , "nc") +BUILTIN(__builtin_ffsll, "iLLi", "nc") BUILTIN(__builtin_parity , "iUi" , "nc") BUILTIN(__builtin_parityl , "iULi" , "nc") BUILTIN(__builtin_parityll, "iULLi", "nc") diff --git a/clang/test/Sema/builtins-decl.c b/clang/test/Sema/builtins-decl.c index 19bdb840ccfb..d6b004aa8820 100644 --- a/clang/test/Sema/builtins-decl.c +++ b/clang/test/Sema/builtins-decl.c @@ -6,3 +6,8 @@ extern unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char); extern unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short); extern unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int); + +// GCC documents these as unsigned, but they are defined with a signed argument. +extern int __builtin_ffs(int); +extern int __builtin_ffsl(long); +extern int __builtin_ffsll(long long);