Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -3257,8 +3257,7 @@ def err_attribute_too_few_arguments : Error<
"%0 attribute takes at least %1 argument%s1">;
def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
def err_attribute_invalid_bitint_vector_type : Error<
"'_BitInt' %select{vector|matrix}0 element width must be %select{a power of 2|"
"at least as wide as 'CHAR_BIT'}1">;
"'_BitInt' %select{vector|matrix}0 element width must be a power of 2">;
def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
def err_attribute_bad_neon_vector_size : Error<
"Neon vector size must be 64 or 128 bits">;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2321,9 +2321,9 @@ static bool CheckBitIntElementType(Sema &S, SourceLocation AttrLoc,
bool ForMatrixType = false) {
// Only support _BitInt elements with byte-sized power of 2 NumBits.
unsigned NumBits = BIT->getNumBits();
if (!llvm::isPowerOf2_32(NumBits) || NumBits < 8)
if (!llvm::isPowerOf2_32(NumBits))
return S.Diag(AttrLoc, diag::err_attribute_invalid_bitint_vector_type)
<< ForMatrixType << (NumBits < 8);
<< ForMatrixType;
return false;
}

Expand Down
12 changes: 2 additions & 10 deletions clang/test/SemaCXX/ext-int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,9 @@ struct is_same<T,T> {
};

// Reject vector types:
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
typedef _BitInt(2) __attribute__((vector_size(16))) VecTy;
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
typedef _BitInt(2) __attribute__((ext_vector_type(32))) OtherVecTy;
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
typedef _BitInt(4) __attribute__((vector_size(16))) VecTy2;
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
typedef _BitInt(4) __attribute__((ext_vector_type(32))) OtherVecTy2;
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
// expected-error@+1{{'_BitInt' vector element width must be a power of 2}}
typedef _BitInt(5) __attribute__((vector_size(16))) VecTy3;
// expected-error@+1{{'_BitInt' vector element width must be at least as wide as 'CHAR_BIT'}}
// expected-error@+1{{'_BitInt' vector element width must be a power of 2}}
typedef _BitInt(5) __attribute__((ext_vector_type(32))) OtherVecTy3;
// expected-error@+1{{'_BitInt' vector element width must be a power of 2}}
typedef _BitInt(37) __attribute__((vector_size(16))) VecTy4;
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaCXX/matrix-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ void matrix_unsupported_element_type() {
}

void matrix_unsupported_bit_int() {
using m1 = _BitInt(2) __attribute__((matrix_type(4, 4))); // expected-error{{'_BitInt' matrix element width must be at least as wide as 'CHAR_BIT'}}
using m2 = _BitInt(7) __attribute__((matrix_type(4, 4))); // expected-error{{'_BitInt' matrix element width must be at least as wide as 'CHAR_BIT'}}
using m2 = _BitInt(7) __attribute__((matrix_type(4, 4))); // expected-error{{'_BitInt' matrix element width must be a power of 2}}
using m3 = _BitInt(9) __attribute__((matrix_type(4, 4))); // expected-error{{'_BitInt' matrix element width must be a power of 2}}
using m4 = _BitInt(12) __attribute__((matrix_type(4, 4))); // expected-error{{'_BitInt' matrix element width must be a power of 2}}
using m5 = _BitInt(8) __attribute__((matrix_type(4, 4)));
Expand Down
Loading