llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Dmitry Sidorov (MrSidims) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/140253.diff 4 Files Affected: - (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+1-2) - (modified) clang/lib/Sema/SemaType.cpp (+2-2) - (modified) clang/test/SemaCXX/ext-int.cpp (+2-10) - (modified) clang/test/SemaCXX/matrix-type.cpp (+1-2) ``````````diff diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index f0bd5a1174020..9f20c07882901 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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">; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 9ed2326f151a3..28d441234262b 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -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; } diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp index d974221e774a7..5c566dafed931 100644 --- a/clang/test/SemaCXX/ext-int.cpp +++ b/clang/test/SemaCXX/ext-int.cpp @@ -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; diff --git a/clang/test/SemaCXX/matrix-type.cpp b/clang/test/SemaCXX/matrix-type.cpp index bb7a8421ca9e3..186d3b6b35208 100644 --- a/clang/test/SemaCXX/matrix-type.cpp +++ b/clang/test/SemaCXX/matrix-type.cpp @@ -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))); `````````` </details> https://github.com/llvm/llvm-project/pull/140253 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits