| // RUN: rm -rf %t && split-file %s %t | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/bad-alias.td 2>&1 \ | |
| // RUN: | FileCheck %t/bad-alias.td -DFILE=%t/bad-alias.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/dup-processor.td 2>&1 \ | |
| // RUN: | FileCheck %t/dup-processor.td -DFILE=%t/dup-processor.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/alias-shadows-processor.td 2>&1 \ | |
| // RUN: | FileCheck %t/alias-shadows-processor.td -DFILE=%t/alias-shadows-processor.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/bad-isa-version.td 2>&1 \ | |
| // RUN: | FileCheck %t/bad-isa-version.td -DFILE=%t/bad-isa-version.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/oversized-major.td 2>&1 \ | |
| // RUN: | FileCheck %t/oversized-major.td -DFILE=%t/oversized-major.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/oversized-minor.td 2>&1 \ | |
| // RUN: | FileCheck %t/oversized-minor.td -DFILE=%t/oversized-minor.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/oversized-stepping.td 2>&1 \ | |
| // RUN: | FileCheck %t/oversized-stepping.td -DFILE=%t/oversized-stepping.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/negative-component.td 2>&1 \ | |
| // RUN: | FileCheck %t/negative-component.td -DFILE=%t/negative-component.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/bad-stepping.td 2>&1 \ | |
| // RUN: | FileCheck %t/bad-stepping.td -DFILE=%t/bad-stepping.td --implicit-check-not="error:" | |
| // RUN: not llvm-tblgen -gen-amdgpu-target-def -I %p/../../include %t/generic-feature-superset.td 2>&1 \ | |
| // RUN: | FileCheck %t/generic-feature-superset.td -DFILE=%t/generic-feature-superset.td --implicit-check-not="error:" | |
| // Verify the validation performed by the -gen-amdgpu-target-def backend. | |
| //--- bad-alias.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 0]>; | |
| // An alias must resolve to a canonical AMDGPU GPU. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: ProcessorAlias 'foo' aliases 'gfx-missing' which is not a canonical AMDGPU GPU | |
| def : ProcessorAlias<"foo", "gfx-missing">; | |
| //--- dup-processor.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| def DupA : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 0]>; | |
| // A canonical GPU name must be unique. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:5: error: duplicate AMDGPU processor name 'gfx900' | |
| def DupB : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 0]>; | |
| //--- alias-shadows-processor.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 0]>; | |
| // An alias name must not collide with a canonical GPU name. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: duplicate AMDGPU processor name 'gfx900' | |
| def : ProcessorAlias<"gfx900", "gfx900">; | |
| //--- bad-isa-version.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // A malformed IsaVersion is reported (not asserted), so this stays a clean | |
| // diagnostic in release builds. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' must have a 3-element [major, minor, stepping] IsaVersion | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0]>; | |
| //--- oversized-major.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // A major that does not fit in the uint8_t table field is rejected rather than | |
| // silently truncated. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' IsaVersion components must each fit in a byte | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[256, 0, 0]>; | |
| //--- oversized-minor.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // A minor that does not fit in the uint8_t table field is likewise rejected. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' IsaVersion components must each fit in a byte | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 256, 0]>; | |
| //--- oversized-stepping.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // A stepping that does not fit in the uint8_t table field is likewise rejected. | |
| // The byte check fires before the single-hex-digit check. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' IsaVersion components must each fit in a byte | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 256]>; | |
| //--- negative-component.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // A negative component is likewise rejected (it does not fit an unsigned byte). | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' IsaVersion components must each fit in a byte | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, -1]>; | |
| //--- bad-stepping.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| // The stepping is spelled as one hex digit in the device/subarch names, so it | |
| // must fit in a nibble even though the table field is a full byte. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: GPU 'gfx900' stepping must be a single hex digit | |
| def : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 16]>; | |
| //--- generic-feature-superset.td | |
| include "llvm/Target/TargetSubtarget.td" | |
| class AMDGPUGPUInfo<list<int> isa = []> { | |
| list<int> IsaVersion = isa; | |
| list<Processor> CoveredGPUs = []; | |
| bit IsPseudoTarget = false; | |
| } | |
| def FeatureFoo : SubtargetFeature<"foo", "HasFoo", "true", "Foo">; | |
| // Ordinary frontend-visible features require support from every covered GPU. | |
| def AMDGPUFrontendVisibleFeatures { | |
| list<SubtargetFeature> Features = [FeatureFoo]; | |
| } | |
| def GFX900 : ProcessorModel<"gfx900", NoSchedModel, []>, AMDGPUGPUInfo<[9, 0, 0]>; | |
| // A generic target must not expose a feature a covered GPU lacks: gfx900 does | |
| // not have 'foo'. | |
| // CHECK: [[FILE]]:[[#@LINE+1]]:1: error: generic target 'gfx9-generic' exposes feature 'foo' not supported by covered GPU 'gfx900' | |
| def : ProcessorModel<"gfx9-generic", NoSchedModel, [FeatureFoo]>, | |
| AMDGPUGPUInfo<[9, 0, 0]> { | |
| let CoveredGPUs = [GFX900]; | |
| } |