[llvm] r314500 - [Triple] Add AMDPAL operating system type
Tim Renouf via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 02:48:12 PDT 2017
Author: tpr
Date: Fri Sep 29 02:48:12 2017
New Revision: 314500
URL: http://llvm.org/viewvc/llvm-project?rev=314500&view=rev
Log:
[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
Added:
llvm/trunk/test/CodeGen/AMDGPU/amdpal.ll
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
llvm/trunk/unittests/ADT/TripleTest.cpp
Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=314500&r1=314499&r2=314500&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Fri Sep 29 02:48:12 2017
@@ -179,7 +179,8 @@ public:
WatchOS, // Apple watchOS
Mesa3D,
Contiki,
- LastOSType = Contiki
+ AMDPAL, // AMD PAL Runtime
+ LastOSType = AMDPAL
};
enum EnvironmentType {
UnknownEnvironment,
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=314500&r1=314499&r2=314500&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Fri Sep 29 02:48:12 2017
@@ -207,6 +207,7 @@ StringRef Triple::getOSTypeName(OSType K
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
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
.StartsWith("contiki", Triple::Contiki)
+ .StartsWith("amdpal", Triple::AMDPAL)
.Default(Triple::UnknownOS);
}
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h?rev=314500&r1=314499&r2=314500&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h Fri Sep 29 02:48:12 2017
@@ -214,6 +214,10 @@ public:
TargetTriple.getEnvironmentName() == "amdgizcl";
}
+ bool isAmdPalOS() const {
+ return TargetTriple.getOS() == Triple::AMDPAL;
+ }
+
Generation getGeneration() const {
return Gen;
}
Added: llvm/trunk/test/CodeGen/AMDGPU/amdpal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/amdpal.ll?rev=314500&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/amdpal.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/amdpal.ll Fri Sep 29 02:48:12 2017
@@ -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
+}
+
Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=314500&r1=314499&r2=314500&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Fri Sep 29 02:48:12 2017
@@ -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());
More information about the llvm-commits
mailing list