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, 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: 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: 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: 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());