summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Renouf <tim.renouf@amd.com>2017-09-29 09:48:12 +0000
committerTim Renouf <tim.renouf@amd.com>2017-09-29 09:48:12 +0000
commit9f7ead33344baf87f546e6f90d13b97e291cee4b (patch)
tree0a867dca9847e05295da4bbca9543cfd83115230
parent817a3bfcdd0bbac8d74fdfdb83a08484d8f63a30 (diff)
downloadbcm5719-llvm-9f7ead33344baf87f546e6f90d13b97e291cee4b.tar.gz
bcm5719-llvm-9f7ead33344baf87f546e6f90d13b97e291cee4b.zip
[Triple] Add AMDPAL operating system type
Summary: This operating system type represents the AMDGPU PAL runtime, and will be required by the AMDGPU backend in order to generate correct code for this runtime. Currently it generates the same code as not specifying an OS at all. That will change in future commits. Patch from Tim Corringham. Subscribers: arsenm, nhaehnle Differential Revision: https://reviews.llvm.org/D37380 llvm-svn: 314500
-rw-r--r--llvm/include/llvm/ADT/Triple.h3
-rw-r--r--llvm/lib/Support/Triple.cpp2
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h4
-rw-r--r--llvm/test/CodeGen/AMDGPU/amdpal.ll10
-rw-r--r--llvm/unittests/ADT/TripleTest.cpp6
5 files changed, 24 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 4e1e218da78..f8fec5d0da7 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -179,7 +179,8 @@ public:
WatchOS, // Apple watchOS
Mesa3D,
Contiki,
- LastOSType = Contiki
+ AMDPAL, // AMD PAL Runtime
+ LastOSType = AMDPAL
};
enum EnvironmentType {
UnknownEnvironment,
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 8dc582ab95a..69c99ac907a 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -207,6 +207,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
case WatchOS: return "watchos";
case Mesa3D: return "mesa3d";
case Contiki: return "contiki";
+ case AMDPAL: return "amdpal";
}
llvm_unreachable("Invalid OSType");
@@ -499,6 +500,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
.StartsWith("contiki", Triple::Contiki)
+ .StartsWith("amdpal", Triple::AMDPAL)
.Default(Triple::UnknownOS);
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
index 7e7a09648ed..0f725c181b7 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -214,6 +214,10 @@ public:
TargetTriple.getEnvironmentName() == "amdgizcl";
}
+ bool isAmdPalOS() const {
+ return TargetTriple.getOS() == Triple::AMDPAL;
+ }
+
Generation getGeneration() const {
return Gen;
}
diff --git a/llvm/test/CodeGen/AMDGPU/amdpal.ll b/llvm/test/CodeGen/AMDGPU/amdpal.ll
new file mode 100644
index 00000000000..61205d0cdb8
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/amdpal.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -mtriple=amdgcn--amdpal -mcpu=tahiti | FileCheck --check-prefix=PAL %s
+
+; PAL: .AMDGPU.config
+
+define amdgpu_kernel void @simple(i32 addrspace(1)* %out) {
+entry:
+ store i32 0, i32 addrspace(1)* %out
+ ret void
+}
+
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
index db11f426490..b78aee4f33d 100644
--- a/llvm/unittests/ADT/TripleTest.cpp
+++ b/llvm/unittests/ADT/TripleTest.cpp
@@ -272,6 +272,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::AMDHSA, T.getOS());
EXPECT_EQ(Triple::OpenCL, T.getEnvironment());
+ T = Triple("amdgcn-amd-amdpal");
+ EXPECT_EQ(Triple::amdgcn, T.getArch());
+ EXPECT_EQ(Triple::AMD, T.getVendor());
+ EXPECT_EQ(Triple::AMDPAL, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
T = Triple("riscv32-unknown-unknown");
EXPECT_EQ(Triple::riscv32, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
OpenPOWER on IntegriCloud