]> granicus.if.org Git - llvm/commitdiff
[Triple] Add AMDPAL operating system type
authorTim Renouf <tim.renouf@amd.com>
Fri, 29 Sep 2017 09:48:12 +0000 (09:48 +0000)
committerTim Renouf <tim.renouf@amd.com>
Fri, 29 Sep 2017 09:48:12 +0000 (09:48 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314500 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/Triple.h
lib/Support/Triple.cpp
lib/Target/AMDGPU/AMDGPUSubtarget.h
test/CodeGen/AMDGPU/amdpal.ll [new file with mode: 0644]
unittests/ADT/TripleTest.cpp

index 4e1e218da78d828cf171f0f0a8e60fc13c330108..f8fec5d0da708710b527890608a91b0621016fbc 100644 (file)
@@ -179,7 +179,8 @@ public:
     WatchOS,    // Apple watchOS
     Mesa3D,
     Contiki,
-    LastOSType = Contiki
+    AMDPAL,     // AMD PAL Runtime
+    LastOSType = AMDPAL
   };
   enum EnvironmentType {
     UnknownEnvironment,
index 8dc582ab95aae759f1e351136f7ca074cdb7d52c..69c99ac907a59743d104288fbf33e62f7aa1e6c8 100644 (file)
@@ -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);
 }
 
index 7e7a09648ed114c9e20c1c39f9a9ce998268ff7b..0f725c181b7b2ab0c4b5306840a74edb7ac9df89 100644 (file)
@@ -214,6 +214,10 @@ public:
            TargetTriple.getEnvironmentName() == "amdgizcl";
   }
 
+  bool isAmdPalOS() const {
+    return TargetTriple.getOS() == Triple::AMDPAL;
+  }
+
   Generation getGeneration() const {
     return Gen;
   }
diff --git a/test/CodeGen/AMDGPU/amdpal.ll b/test/CodeGen/AMDGPU/amdpal.ll
new file mode 100644 (file)
index 0000000..61205d0
--- /dev/null
@@ -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
+}
+
index db11f42649016b00ec87e6352cfdd0f123983319..b78aee4f33d768df537a999f6b4bcd838e20a98e 100644 (file)
@@ -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());