[PATCH] D37380: Triple: Add AMDPAL operating system type
Tim Renouf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 07:13:10 PDT 2017
tpr updated this revision to Diff 114600.
tpr added a comment.
Added real test (thanks for pointer Nicolai).
https://reviews.llvm.org/D37380
Files:
include/llvm/ADT/Triple.h
lib/Support/Triple.cpp
lib/Target/AMDGPU/AMDGPUSubtarget.h
test/CodeGen/AMDGPU/amdpal.ll
unittests/ADT/TripleTest.cpp
Index: unittests/ADT/TripleTest.cpp
===================================================================
--- unittests/ADT/TripleTest.cpp
+++ unittests/ADT/TripleTest.cpp
@@ -272,6 +272,12 @@
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());
Index: test/CodeGen/AMDGPU/amdpal.ll
===================================================================
--- /dev/null
+++ 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
+}
+
Index: lib/Target/AMDGPU/AMDGPUSubtarget.h
===================================================================
--- lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -214,6 +214,10 @@
TargetTriple.getEnvironmentName() == "amdgizcl";
}
+ bool isAmdPalOS() const {
+ return TargetTriple.getOS() == Triple::AMDPAL;
+ }
+
Generation getGeneration() const {
return Gen;
}
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -207,6 +207,7 @@
case WatchOS: return "watchos";
case Mesa3D: return "mesa3d";
case Contiki: return "contiki";
+ case AMDPAL: return "amdpal";
}
llvm_unreachable("Invalid OSType");
@@ -498,6 +499,7 @@
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
.StartsWith("contiki", Triple::Contiki)
+ .StartsWith("amdpal", Triple::AMDPAL)
.Default(Triple::UnknownOS);
}
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -179,7 +179,8 @@
WatchOS, // Apple watchOS
Mesa3D,
Contiki,
- LastOSType = Contiki
+ AMDPAL, // AMD PAL Runtime
+ LastOSType = AMDPAL
};
enum EnvironmentType {
UnknownEnvironment,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37380.114600.patch
Type: text/x-patch
Size: 2461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170911/306f69f9/attachment.bin>
More information about the llvm-commits
mailing list