================
@@ -897,6 +897,52 @@ TSTToUnaryTransformType(DeclSpec::TST SwitchTST) {
}
}
+bool Sema::checkFloatingPointTypeSupport(QualType Ty, SourceLocation Loc,
+ bool DiagnoseTarget) {
+ if (Ty->isFloat16Type()) {
+ if (!Context.getTargetInfo().hasFloat16Type()) {
+ if (!getLangOpts().CUDA &&
+ !(getLangOpts().OpenMP && getLangOpts().OpenMPIsTargetDevice)) {
+ Diag(Loc, diag::err_type_unsupported) << "_Float16";
+ return true;
+ }
+ if (DiagnoseTarget)
+ return targetDiag(Loc, diag::err_type_unsupported) << "_Float16";
+ }
+ return false;
+ }
+
+ if (Ty->isBFloat16Type()) {
+ if (!Context.getTargetInfo().hasBFloat16Type()) {
+ if (!(getLangOpts().OpenMP && getLangOpts().OpenMPIsTargetDevice) &&
+ !getLangOpts().SYCLIsDevice) {
+ Diag(Loc, diag::err_type_unsupported) << "__bf16";
+ return true;
+ }
+ if (DiagnoseTarget)
+ return targetDiag(Loc, diag::err_type_unsupported) << "__bf16";
+ }
+ return false;
+ }
+
+ if (!getLangOpts().OpenCL ||
+ (Ty != Context.DoubleTy && Ty != Context.LongDoubleTy))
+ return false;
+
+ if (!getOpenCLOptions().isSupported("cl_khr_fp64", getLangOpts())) {
+ Diag(Loc, diag::err_opencl_requires_extension)
+ << 0 << Ty
+ << (getLangOpts().getOpenCLCompatibleVersion() >= 300
+ ? "cl_khr_fp64 and __opencl_c_fp64"
+ : "cl_khr_fp64");
+ return true;
+ }
+
+ if (!getOpenCLOptions().isAvailableOption("cl_khr_fp64", getLangOpts()))
+ Diag(Loc, diag::ext_opencl_double_without_pragma);
----------------
MrSidims wrote:
This looks redundant.
https://github.com/llvm/llvm-project/pull/212647
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits