1 //===-- AMDGPUSubtarget.cpp - AMDGPU Subtarget Information ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Implements the AMDGPU specific subclass of TargetSubtarget.
13 //===----------------------------------------------------------------------===//
15 #include "AMDGPUSubtarget.h"
16 #include "R600InstrInfo.h"
17 #include "SIInstrInfo.h"
18 #include "llvm/ADT/SmallString.h"
20 #include "llvm/ADT/SmallString.h"
24 #define DEBUG_TYPE "amdgpu-subtarget"
26 #define GET_SUBTARGETINFO_ENUM
27 #define GET_SUBTARGETINFO_TARGET_DESC
28 #define GET_SUBTARGETINFO_CTOR
29 #include "AMDGPUGenSubtargetInfo.inc"
31 AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS) :
32 AMDGPUGenSubtargetInfo(TT, GPU, FS),
37 HasVertexCache(false),
39 Gen(AMDGPUSubtarget::R600),
44 EnableIRStructurizer(true),
45 EnablePromoteAlloca(false),
50 InstrItins(getInstrItineraryForCPU(GPU)) {
51 // On SI+, we want FP64 denormals to be on by default. FP32 denormals can be
52 // enabled, but some instructions do not respect them and they run at the
53 // double precision rate, so don't enable by default.
55 // We want to be able to turn these off, but making this a subtarget feature
56 // for SI has the unhelpful behavior that it unsets everything else if you
59 SmallString<256> FullFS("+promote-alloca,+fp64-denormals,");
62 ParseSubtargetFeatures(GPU, FullFS);
64 if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
65 InstrInfo.reset(new R600InstrInfo(*this));
67 // FIXME: I don't think think Evergreen has any useful support for
68 // denormals, but should be checked. Should we issue a warning somewhere if
69 // someone tries to enable these?
70 FP32Denormals = false;
71 FP64Denormals = false;
73 InstrInfo.reset(new SIInstrInfo(*this));
77 unsigned AMDGPUSubtarget::getStackEntrySize() const {
78 assert(getGeneration() <= NORTHERN_ISLANDS);
79 switch(getWavefrontSize()) {
83 return hasCaymanISA() ? 4 : 8;
87 llvm_unreachable("Illegal wavefront size.");