[PATCH] D16909: Add AMDGPU related triple vendors/OSes
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 4 17:00:41 PST 2016
arsenm created this revision.
arsenm added reviewers: tstellarAMD, mareko, michel.daenzer, nhaehnle, echristo.
arsenm added a subscriber: llvm-commits.
As support expands to more runtimes, we'll need to
distinguish between more than just HSA and unknown.
This also lets us stop using unknown everywhere.
http://reviews.llvm.org/D16909
Files:
include/llvm/ADT/Triple.h
lib/Support/Triple.cpp
unittests/ADT/TripleTest.cpp
Index: unittests/ADT/TripleTest.cpp
===================================================================
--- unittests/ADT/TripleTest.cpp
+++ unittests/ADT/TripleTest.cpp
@@ -212,6 +212,24 @@
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("amdgcn-mesa-clover");
+ EXPECT_EQ(Triple::amdgcn, T.getArch());
+ EXPECT_EQ(Triple::Mesa, T.getVendor());
+ EXPECT_EQ(Triple::Clover, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
+ T = Triple("amdgcn-mesa-radeonsi");
+ EXPECT_EQ(Triple::amdgcn, T.getArch());
+ EXPECT_EQ(Triple::Mesa, T.getVendor());
+ EXPECT_EQ(Triple::RadeonSI, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
+ T = Triple("amdgcn-amd-amdhsa");
+ EXPECT_EQ(Triple::amdgcn, T.getArch());
+ EXPECT_EQ(Triple::AMD, T.getVendor());
+ EXPECT_EQ(Triple::AMDHSA, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -148,6 +148,8 @@
case NVIDIA: return "nvidia";
case CSR: return "csr";
case Myriad: return "myriad";
+ case AMD: return "amd";
+ case Mesa: return "mesa";
}
llvm_unreachable("Invalid VendorType!");
@@ -184,6 +186,8 @@
case ELFIAMCU: return "elfiamcu";
case TvOS: return "tvos";
case WatchOS: return "watchos";
+ case Clover: return "clover";
+ case RadeonSI: return "radeonsi";
}
llvm_unreachable("Invalid OSType");
@@ -408,6 +412,8 @@
.Case("nvidia", Triple::NVIDIA)
.Case("csr", Triple::CSR)
.Case("myriad", Triple::Myriad)
+ .Case("amd", Triple::AMD)
+ .Case("mesa", Triple::Mesa)
.Default(Triple::UnknownVendor);
}
@@ -441,6 +447,8 @@
.StartsWith("elfiamcu", Triple::ELFIAMCU)
.StartsWith("tvos", Triple::TvOS)
.StartsWith("watchos", Triple::WatchOS)
+ .StartsWith("clover", Triple::Clover)
+ .StartsWith("radeonsi", Triple::RadeonSI)
.Default(Triple::UnknownOS);
}
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -130,7 +130,9 @@
NVIDIA,
CSR,
Myriad,
- LastVendorType = Myriad
+ AMD,
+ Mesa,
+ LastVendorType = Mesa
};
enum OSType {
UnknownOS,
@@ -162,6 +164,8 @@
ELFIAMCU,
TvOS, // Apple tvOS
WatchOS, // Apple watchOS
+ Clover, // Mesa's OpenCL runtime.
+ RadeonSI, // Mesa's OpenGL runtime.
LastOSType = WatchOS
};
enum EnvironmentType {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16909.46979.patch
Type: text/x-patch
Size: 2756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160205/19def8b3/attachment.bin>
More information about the llvm-commits
mailing list