[clang] [PPC] Disable vsx and altivec when -msoft-float is used (PR #100450)

Chen Zheng via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 22:57:13 PDT 2024


================
@@ -690,6 +698,19 @@ bool PPCTargetInfo::initFeatureMap(
     return false;
   }
 
+  if (llvm::is_contained(FeaturesVec, "-hard-float")) {
----------------
chenzheng1030 wrote:

After another look, I still think this should be done in https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/PPC.cpp#L783-L789, with changes like:
```diff
@@ -802,11 +803,15 @@ void PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
       Features["efpu2"] = false;
     // If we're disabling altivec or vsx go ahead and disable all of the vsx
     // features.
-    if ((Name == "altivec") || (Name == "vsx"))
+    if ((Name == "altivec") || (Name == "vsx") || (Name == "hard-float")) {
+      if (Name != "vsx")
+        Features["altivec"] = Features["crypto"] = false;
```

What do you think?

https://github.com/llvm/llvm-project/pull/100450


More information about the cfe-commits mailing list