================
@@ -110,6 +110,22 @@ void SPIRV64TargetInfo::getTargetDefines(const LangOptions
&Opts,
DefineStd(Builder, "SPIRV64", Opts);
}
+bool BaseSPIRTargetInfo::initFeatureMap(
+ llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
+ const std::vector<std::string> &FeaturesVec) const {
+ // When the host predefines _M_X64, MSVC STL headers use always_inline _mm_*
+ // intrinsics, which require sse/sse2 in the device feature set.
+ if (const TargetInfo *Host = getHostTarget()) {
+ const llvm::Triple &HT = Host->getTriple();
+ if (HT.isWindowsMSVCEnvironment() &&
+ (HT.getArch() == llvm::Triple::x86_64 || HT.isWindowsArm64EC())) {
+ Features["sse"] = true;
+ Features["sse2"] = true;
+ }
+ }
+ return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
----------------
tahonermann wrote:
Ah, interesting. I wonder if we should be using `setAuxTarget()` to receive the
auxiliary host (and `copyAuxTarget()` to steal from it) rather than creating it
ourselves (with arguably the wrong target options). I see that is what
`SPIRV64AMDGCNTargetInfo` and `AMDGPUTargetInfo` are doing. Regardless, such a
change seems out of scope for this PR. Thank you for looking into it; maybe
we'll come back to this sometime later.
https://github.com/llvm/llvm-project/pull/227665
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits