xref: /freebsd/contrib/llvm-project/llvm/lib/Target/NVPTX/NVPTX.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric//===- NVPTX.td - Describe the NVPTX Target Machine -----------*- tblgen -*-==//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric// This is the top level entry point for the NVPTX target.
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric// Target-independent interfaces
130b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric
150b57cec5SDimitry Andricinclude "llvm/Target/Target.td"
160b57cec5SDimitry Andric
170b57cec5SDimitry Andricinclude "NVPTXRegisterInfo.td"
180b57cec5SDimitry Andricinclude "NVPTXInstrInfo.td"
190b57cec5SDimitry Andric
200b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
210b57cec5SDimitry Andric// Subtarget Features.
220b57cec5SDimitry Andric// - We use the SM version number instead of explicit feature table.
230b57cec5SDimitry Andric// - Need at least one feature to avoid generating zero sized array by
240b57cec5SDimitry Andric//   TableGen in NVPTXGenSubtarget.inc.
250b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
260b57cec5SDimitry Andric
275f757f3fSDimitry Andricclass FeatureSM<string sm, int value>:
285f757f3fSDimitry Andric   SubtargetFeature<"sm_"# sm, "FullSmVersion",
295f757f3fSDimitry Andric                    "" # value,
305f757f3fSDimitry Andric                    "Target SM " # sm>;
310b57cec5SDimitry Andric
3206c3fb27SDimitry Andricclass FeaturePTX<int version>:
3306c3fb27SDimitry Andric   SubtargetFeature<"ptx"# version, "PTXVersion",
3406c3fb27SDimitry Andric                    "" # version,
3506c3fb27SDimitry Andric                    "Use PTX version " # version>;
3606c3fb27SDimitry Andric
375f757f3fSDimitry Andricforeach sm = [20, 21, 30, 32, 35, 37, 50, 52, 53,
3806c3fb27SDimitry Andric              60, 61, 62, 70, 72, 75, 80, 86, 87, 89, 90] in
395f757f3fSDimitry Andric  def SM#sm: FeatureSM<""#sm, !mul(sm, 10)>;
405f757f3fSDimitry Andric
415f757f3fSDimitry Andricdef SM90a: FeatureSM<"90a", 901>;
4206c3fb27SDimitry Andric
43*0fca6ea1SDimitry Andricforeach version = [32, 40, 41, 42, 43, 50, 60, 61, 62, 63, 64, 65,
44*0fca6ea1SDimitry Andric                   70, 71, 72, 73, 74, 75, 76, 77, 78,
45*0fca6ea1SDimitry Andric                   80, 81, 82, 83, 84, 85] in
4606c3fb27SDimitry Andric  def PTX#version: FeaturePTX<version>;
470b57cec5SDimitry Andric
480b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
490b57cec5SDimitry Andric// NVPTX supported processors.
500b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
510b57cec5SDimitry Andric
520b57cec5SDimitry Andricclass Proc<string Name, list<SubtargetFeature> Features>
530b57cec5SDimitry Andric : Processor<Name, NoItineraries, Features>;
540b57cec5SDimitry Andric
55bdd1243dSDimitry Andricdef : Proc<"sm_20", [SM20, PTX32]>;
56bdd1243dSDimitry Andricdef : Proc<"sm_21", [SM21, PTX32]>;
570b57cec5SDimitry Andricdef : Proc<"sm_30", [SM30]>;
580b57cec5SDimitry Andricdef : Proc<"sm_32", [SM32, PTX40]>;
59bdd1243dSDimitry Andricdef : Proc<"sm_35", [SM35, PTX32]>;
600b57cec5SDimitry Andricdef : Proc<"sm_37", [SM37, PTX41]>;
610b57cec5SDimitry Andricdef : Proc<"sm_50", [SM50, PTX40]>;
620b57cec5SDimitry Andricdef : Proc<"sm_52", [SM52, PTX41]>;
630b57cec5SDimitry Andricdef : Proc<"sm_53", [SM53, PTX42]>;
640b57cec5SDimitry Andricdef : Proc<"sm_60", [SM60, PTX50]>;
650b57cec5SDimitry Andricdef : Proc<"sm_61", [SM61, PTX50]>;
660b57cec5SDimitry Andricdef : Proc<"sm_62", [SM62, PTX50]>;
670b57cec5SDimitry Andricdef : Proc<"sm_70", [SM70, PTX60]>;
680b57cec5SDimitry Andricdef : Proc<"sm_72", [SM72, PTX61]>;
690b57cec5SDimitry Andricdef : Proc<"sm_75", [SM75, PTX63]>;
705ffd83dbSDimitry Andricdef : Proc<"sm_80", [SM80, PTX70]>;
71fe6060f1SDimitry Andricdef : Proc<"sm_86", [SM86, PTX71]>;
72bdd1243dSDimitry Andricdef : Proc<"sm_87", [SM87, PTX74]>;
73bdd1243dSDimitry Andricdef : Proc<"sm_89", [SM89, PTX78]>;
74bdd1243dSDimitry Andricdef : Proc<"sm_90", [SM90, PTX78]>;
7506c3fb27SDimitry Andricdef : Proc<"sm_90a", [SM90a, PTX80]>;
760b57cec5SDimitry Andric
770b57cec5SDimitry Andricdef NVPTXInstrInfo : InstrInfo {
780b57cec5SDimitry Andric}
790b57cec5SDimitry Andric
800b57cec5SDimitry Andricdef NVPTX : Target {
810b57cec5SDimitry Andric  let InstructionSet = NVPTXInstrInfo;
820b57cec5SDimitry Andric}
83