xref: /freebsd/contrib/llvm-project/llvm/lib/Target/NVPTX/NVPTX.td (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1//===- NVPTX.td - Describe the NVPTX Target Machine -----------*- tblgen -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8// This is the top level entry point for the NVPTX target.
9//===----------------------------------------------------------------------===//
10
11//===----------------------------------------------------------------------===//
12// Target-independent interfaces
13//===----------------------------------------------------------------------===//
14
15include "llvm/Target/Target.td"
16
17include "NVPTXRegisterInfo.td"
18include "NVPTXInstrInfo.td"
19
20//===----------------------------------------------------------------------===//
21// Subtarget Features.
22// - We use the SM version number instead of explicit feature table.
23// - Need at least one feature to avoid generating zero sized array by
24//   TableGen in NVPTXGenSubtarget.inc.
25//===----------------------------------------------------------------------===//
26
27class FeatureSM<string sm, int value>:
28   SubtargetFeature<"sm_"# sm, "FullSmVersion",
29                    "" # value,
30                    "Target SM " # sm>;
31
32class FeaturePTX<int version>:
33   SubtargetFeature<"ptx"# version, "PTXVersion",
34                    "" # version,
35                    "Use PTX version " # version>;
36
37foreach sm = [20, 21, 30, 32, 35, 37, 50, 52, 53,
38              60, 61, 62, 70, 72, 75, 80, 86, 87, 89, 90] in
39  def SM#sm: FeatureSM<""#sm, !mul(sm, 10)>;
40
41def SM90a: FeatureSM<"90a", 901>;
42
43foreach version = [32, 40, 41, 42, 43, 50, 60, 61, 62, 63, 64, 65,
44                   70, 71, 72, 73, 74, 75, 76, 77, 78,
45                   80, 81, 82, 83, 84, 85] in
46  def PTX#version: FeaturePTX<version>;
47
48//===----------------------------------------------------------------------===//
49// NVPTX supported processors.
50//===----------------------------------------------------------------------===//
51
52class Proc<string Name, list<SubtargetFeature> Features>
53 : Processor<Name, NoItineraries, Features>;
54
55def : Proc<"sm_20", [SM20, PTX32]>;
56def : Proc<"sm_21", [SM21, PTX32]>;
57def : Proc<"sm_30", [SM30]>;
58def : Proc<"sm_32", [SM32, PTX40]>;
59def : Proc<"sm_35", [SM35, PTX32]>;
60def : Proc<"sm_37", [SM37, PTX41]>;
61def : Proc<"sm_50", [SM50, PTX40]>;
62def : Proc<"sm_52", [SM52, PTX41]>;
63def : Proc<"sm_53", [SM53, PTX42]>;
64def : Proc<"sm_60", [SM60, PTX50]>;
65def : Proc<"sm_61", [SM61, PTX50]>;
66def : Proc<"sm_62", [SM62, PTX50]>;
67def : Proc<"sm_70", [SM70, PTX60]>;
68def : Proc<"sm_72", [SM72, PTX61]>;
69def : Proc<"sm_75", [SM75, PTX63]>;
70def : Proc<"sm_80", [SM80, PTX70]>;
71def : Proc<"sm_86", [SM86, PTX71]>;
72def : Proc<"sm_87", [SM87, PTX74]>;
73def : Proc<"sm_89", [SM89, PTX78]>;
74def : Proc<"sm_90", [SM90, PTX78]>;
75def : Proc<"sm_90a", [SM90a, PTX80]>;
76
77def NVPTXInstrInfo : InstrInfo {
78}
79
80def NVPTX : Target {
81  let InstructionSet = NVPTXInstrInfo;
82}
83