Author: Erich Keane Date: 2021-01-20T11:35:52-08:00 New Revision: 8776e3f289c19ee2e85c593792806e6503408d59
URL: https://github.com/llvm/llvm-project/commit/8776e3f289c19ee2e85c593792806e6503408d59 DIFF: https://github.com/llvm/llvm-project/commit/8776e3f289c19ee2e85c593792806e6503408d59.diff LOG: [EXTINT][OMP] Fix _ExtInt type checking in device code _ExtInt gets stuck in the device-type-checking for __int128 if it is between 65 and 128 bits inclusive. Anything larger or smaller was permitted despite this, so this is simply enabling 65-128 bit _ExtInts. _ExtInt is supported on all our current ABIs, but we stil use the hasExtIntType in the target info to differentiate here so that it can be disabled. Added: Modified: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/Sema.cpp clang/test/OpenMP/nvptx_unsupported_type_messages.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index e93657898f58..758b2ed3e90b 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -10468,8 +10468,9 @@ def err_omp_invariant_or_linear_dependency : Error< "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">; def err_omp_wrong_dependency_iterator_type : Error< "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">; -def err_device_unsupported_type : Error < - "%0 requires %1 bit size %2 type support, but device '%3' does not support it">; +def err_device_unsupported_type + : Error<"%0 requires %select{|%2 bit size}1 %3 type support, but device " + "'%4' does not support it">; def err_omp_lambda_capture_in_declare_target_not_to : Error< "variable captured in declare target region must appear in a to clause">; def err_omp_device_type_mismatch : Error< diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index cca82fb3bf48..23dba75f03c6 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1795,6 +1795,15 @@ void Sema::checkDeviceDecl(const ValueDecl *D, SourceLocation Loc) { if (Ty->isDependentType()) return; + if (Ty->isExtIntType()) { + if (!Context.getTargetInfo().hasExtIntType()) { + targetDiag(Loc, diag::err_device_unsupported_type) + << D << false /*show bit size*/ << 0 /*bitsize*/ + << Ty << Context.getTargetInfo().getTriple().str(); + } + return; + } + if ((Ty->isFloat16Type() && !Context.getTargetInfo().hasFloat16Type()) || ((Ty->isFloat128Type() || (Ty->isRealFloatingType() && Context.getTypeSize(Ty) == 128)) && @@ -1802,7 +1811,8 @@ void Sema::checkDeviceDecl(const ValueDecl *D, SourceLocation Loc) { (Ty->isIntegerType() && Context.getTypeSize(Ty) == 128 && !Context.getTargetInfo().hasInt128Type())) { targetDiag(Loc, diag::err_device_unsupported_type) - << D << static_cast<unsigned>(Context.getTypeSize(Ty)) << Ty + << D << true /*show bit size*/ + << static_cast<unsigned>(Context.getTypeSize(Ty)) << Ty << Context.getTargetInfo().getTriple().str(); targetDiag(D->getLocation(), diag::note_defined_here) << D; } diff --git a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp index e56105adeb83..814a4756c01b 100644 --- a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp +++ b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp @@ -131,3 +131,7 @@ struct B { enum { value = bool(Sp::value) || bool(Tp::value) }; typedef typename A_type<value>::type type; }; + +void bar(_ExtInt(66) a) { + auto b = a; +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits