-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Fix __builtin_popcountg not matching GCC (#83313)
Our implementation previously accepted signed arguments and performed integer promotion on the argument. GCC's implementation requires an unsigned argument and does not perform integer promotion on it.
- Loading branch information
1 parent
e3b93a1
commit fc8d481
Showing
6 changed files
with
43 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -Wpedantic %s | ||
// RUN: %clang_cc1 -std=c23 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -Wpedantic %s | ||
|
||
typedef int int2 __attribute__((ext_vector_type(2))); | ||
|
||
void test_builtin_popcountg(int i, double d, int2 i2) { | ||
void test_builtin_popcountg(short s, int i, __int128 i128, _BitInt(128) bi128, | ||
double d, int2 i2) { | ||
__builtin_popcountg(); | ||
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
__builtin_popcountg(i, i); | ||
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
__builtin_popcountg(s); | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was 'short')}} | ||
__builtin_popcountg(i); | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was 'int')}} | ||
__builtin_popcountg(i128); | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was '__int128')}} | ||
__builtin_popcountg(bi128); | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was '_BitInt(128)')}} | ||
__builtin_popcountg(d); | ||
// expected-error@-1 {{1st argument must be a type of integer (was 'double')}} | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was 'double')}} | ||
__builtin_popcountg(i2); | ||
// expected-error@-1 {{1st argument must be a type of integer (was 'int2' (vector of 2 'int' values))}} | ||
// expected-error@-1 {{1st argument must be a type of unsigned integer (was 'int2' (vector of 2 'int' values))}} | ||
} |