================
@@ -73,15 +77,22 @@ int main(int argc, char *argv[]) {
                     sys::path::stem(argv[0]).starts_with("amdgpu-arch");
   bool NVIDIAOnly = Only == VendorName::nvptx ||
                     sys::path::stem(argv[0]).starts_with("nvptx-arch");
+  bool IntelOnly = Only == VendorName::intel ||
+                   sys::path::stem(argv[0]).starts_with("intelgpu-arch");
+  bool All = !AMDGPUOnly && !NVIDIAOnly && !IntelOnly;
 
   int NVIDIAResult = 0;
-  if (!AMDGPUOnly)
+  if (NVIDIAOnly || All)
     NVIDIAResult = printNVIDIA();
 
   int AMDResult = 0;
-  if (!NVIDIAOnly)
+  if (AMDGPUOnly || All)
     AMDResult = printAMD();
 
+  int IntelResult = 0;
+  if (IntelOnly || All)
+    IntelResult = printIntel();
+
   // We only failed if all cases returned an error.
-  return AMDResult && NVIDIAResult;
+  return AMDResult && NVIDIAResult && IntelResult;
----------------
jhuber6 wrote:

Now that we have more than two this should probably be refactored into a more 
`all_of` type loop. Something like this maybe?
```c++
auto fns = {printNVIDIA, printAMD, PrintIntel};
llvm::all_of(fns, [](auto fn) { return enabled() ? fn() : 0 }; 
```

https://github.com/llvm/llvm-project/pull/160570
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to