@@ -20,6 +20,7 @@ Copyright (c) Intel Corporation (2009-2017).
20
20
#include " options.h"
21
21
22
22
#include " clang/Driver/Options.h"
23
+ #include " llvm/ADT/StringExtras.h"
23
24
#include " llvm/Option/Arg.h"
24
25
#include " llvm/Option/ArgList.h"
25
26
#include " llvm/Support/ManagedStatic.h"
@@ -237,10 +238,30 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
237
238
238
239
for (auto it = effectiveArgs.begin (), end = effectiveArgs.end (); it != end;
239
240
++it) {
240
- if (it->compare (" -Dcl_khr_fp64" ) == 0 )
241
+ if (it->compare (" -Dcl_khr_fp64" ) == 0 || it-> compare ( " -D cl_khr_fp64=1 " ) == 0 )
241
242
fp64Enabled = true ;
243
+ else if (it->compare (" -U cl_khr_fp64" ) == 0 )
244
+ fp64Enabled = false ;
245
+ // Find last position that enables or disables cl_khr_fp64
246
+ else if (it->find (" cl_khr_fp64" ) != std::string::npos) {
247
+ auto NegFp64 = it->rfind (" -cl_khr_fp64" );
248
+ auto PosFp64 = it->rfind (" +cl_khr_fp64" );
249
+ if (NegFp64 != std::string::npos && PosFp64 != std::string::npos)
250
+ fp64Enabled = PosFp64 > NegFp64;
251
+ else if (NegFp64 != std::string::npos)
252
+ fp64Enabled = false ;
253
+ else
254
+ fp64Enabled = true ;
255
+ }
242
256
}
243
257
258
+ #ifdef PCH_EXTENSION
259
+ std::map<std::string, bool > extMap;
260
+ llvm::SmallVector<llvm::StringRef> extVec;
261
+ llvm::SplitString (PCH_EXTENSION, extVec, " ," );
262
+ for (auto ext : extVec)
263
+ extMap.insert ({ext.str (), true });
264
+ #else
244
265
std::map<std::string, bool > extMap{
245
266
{" cl_khr_3d_image_writes" , true },
246
267
{" cl_khr_depth_images" , true },
@@ -262,6 +283,7 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
262
283
{" cl_intel_planar_yuv" , true },
263
284
{" cl_intel_subgroups" , true },
264
285
{" cl_intel_subgroups_short" , true }};
286
+ #endif
265
287
266
288
auto parseClExt = [&](const std::string &clExtStr) {
267
289
llvm::StringRef clExtRef (clExtStr);
0 commit comments