diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -866,6 +866,12 @@ "Flat Scratch register is a readonly SPI initialized architected register" >; +def FeatureArchitectedSGPRs : SubtargetFeature<"architected-sgprs", + "HasArchitectedSGPRs", + "true", + "Enable the architected SGPRs" +>; + // Dummy feature used to disable assembler instructions. def FeatureDisable : SubtargetFeature<"", "FeatureDisable","true", diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h --- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h +++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h @@ -175,6 +175,7 @@ bool ScalarFlatScratchInsts = false; bool HasArchitectedFlatScratch = false; bool EnableFlatScratch = false; + bool HasArchitectedSGPRs = false; bool AddNoCarryInsts = false; bool HasUnpackedD16VMem = false; bool LDSMisalignedBug = false; @@ -1132,6 +1133,9 @@ /// In this case it is readonly. bool flatScratchIsArchitected() const { return HasArchitectedFlatScratch; } + /// \returns true if the architected SGPRs are enabled. + bool hasArchitectedSGPRs() const { return HasArchitectedSGPRs; } + /// \returns true if the machine has merged shaders in which s0-s7 are /// reserved by the hardware and user SGPRs start at s8 bool hasMergedShaders() const {