1//===-- PTX.td - Describe the PTX Target Machine -----------*- tablegen -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// This is the top level entry point for the PTX target. 10//===----------------------------------------------------------------------===// 11 12//===----------------------------------------------------------------------===// 13// Target-independent interfaces 14//===----------------------------------------------------------------------===// 15 16include "llvm/Target/Target.td" 17 18//===----------------------------------------------------------------------===// 19// Subtarget Features 20//===----------------------------------------------------------------------===// 21 22//===- Architectural Features ---------------------------------------------===// 23 24def FeatureDouble : SubtargetFeature<"double", "SupportsDouble", "true", 25 "Do not demote .f64 to .f32">; 26 27def FeatureNoFMA : SubtargetFeature<"no-fma","SupportsFMA", "false", 28 "Disable Fused-Multiply Add">; 29 30//===- PTX Version --------------------------------------------------------===// 31 32def FeaturePTX20 : SubtargetFeature<"ptx20", "PTXVersion", "PTX_VERSION_2_0", 33 "Use PTX Language Version 2.0">; 34 35def FeaturePTX21 : SubtargetFeature<"ptx21", "PTXVersion", "PTX_VERSION_2_1", 36 "Use PTX Language Version 2.1">; 37 38def FeaturePTX22 : SubtargetFeature<"ptx22", "PTXVersion", "PTX_VERSION_2_2", 39 "Use PTX Language Version 2.2">; 40 41def FeaturePTX23 : SubtargetFeature<"ptx23", "PTXVersion", "PTX_VERSION_2_3", 42 "Use PTX Language Version 2.3">; 43 44//===- PTX Target ---------------------------------------------------------===// 45 46def FeatureSM10 : SubtargetFeature<"sm10", "PTXTarget", "PTX_SM_1_0", 47 "Use Shader Model 1.0">; 48def FeatureSM11 : SubtargetFeature<"sm11", "PTXTarget", "PTX_SM_1_1", 49 "Use Shader Model 1.1">; 50def FeatureSM12 : SubtargetFeature<"sm12", "PTXTarget", "PTX_SM_1_2", 51 "Use Shader Model 1.2">; 52def FeatureSM13 : SubtargetFeature<"sm13", "PTXTarget", "PTX_SM_1_3", 53 "Use Shader Model 1.3">; 54def FeatureSM20 : SubtargetFeature<"sm20", "PTXTarget", "PTX_SM_2_0", 55 "Use Shader Model 2.0", [FeatureDouble]>; 56def FeatureSM21 : SubtargetFeature<"sm21", "PTXTarget", "PTX_SM_2_1", 57 "Use Shader Model 2.1", [FeatureDouble]>; 58def FeatureSM22 : SubtargetFeature<"sm22", "PTXTarget", "PTX_SM_2_2", 59 "Use Shader Model 2.2", [FeatureDouble]>; 60def FeatureSM23 : SubtargetFeature<"sm23", "PTXTarget", "PTX_SM_2_3", 61 "Use Shader Model 2.3", [FeatureDouble]>; 62 63def FeatureCOMPUTE10 : SubtargetFeature<"compute10", "PTXTarget", 64 "PTX_COMPUTE_1_0", 65 "Use Compute Compatibility 1.0">; 66def FeatureCOMPUTE11 : SubtargetFeature<"compute11", "PTXTarget", 67 "PTX_COMPUTE_1_1", 68 "Use Compute Compatibility 1.1">; 69def FeatureCOMPUTE12 : SubtargetFeature<"compute12", "PTXTarget", 70 "PTX_COMPUTE_1_2", 71 "Use Compute Compatibility 1.2">; 72def FeatureCOMPUTE13 : SubtargetFeature<"compute13", "PTXTarget", 73 "PTX_COMPUTE_1_3", 74 "Use Compute Compatibility 1.3">; 75def FeatureCOMPUTE20 : SubtargetFeature<"compute20", "PTXTarget", 76 "PTX_COMPUTE_2_0", 77 "Use Compute Compatibility 2.0", 78 [FeatureDouble]>; 79 80//===----------------------------------------------------------------------===// 81// PTX supported processors 82//===----------------------------------------------------------------------===// 83 84class Proc<string Name, list<SubtargetFeature> Features> 85 : Processor<Name, NoItineraries, Features>; 86 87def : Proc<"generic", []>; 88 89// Processor definitions for compute/shader models 90def : Proc<"compute_10", [FeatureCOMPUTE10]>; 91def : Proc<"compute_11", [FeatureCOMPUTE11]>; 92def : Proc<"compute_12", [FeatureCOMPUTE12]>; 93def : Proc<"compute_13", [FeatureCOMPUTE13]>; 94def : Proc<"compute_20", [FeatureCOMPUTE20]>; 95def : Proc<"sm_10", [FeatureSM10]>; 96def : Proc<"sm_11", [FeatureSM11]>; 97def : Proc<"sm_12", [FeatureSM12]>; 98def : Proc<"sm_13", [FeatureSM13]>; 99def : Proc<"sm_20", [FeatureSM20]>; 100def : Proc<"sm_21", [FeatureSM21]>; 101def : Proc<"sm_22", [FeatureSM22]>; 102def : Proc<"sm_23", [FeatureSM23]>; 103 104// Processor definitions for common GPU architectures 105def : Proc<"g80", [FeatureSM10]>; 106def : Proc<"gt200", [FeatureSM13]>; 107def : Proc<"gf100", [FeatureSM20, FeatureDouble]>; 108def : Proc<"fermi", [FeatureSM20, FeatureDouble]>; 109 110//===----------------------------------------------------------------------===// 111// Register File Description 112//===----------------------------------------------------------------------===// 113 114include "PTXRegisterInfo.td" 115 116//===----------------------------------------------------------------------===// 117// Instruction Descriptions 118//===----------------------------------------------------------------------===// 119 120include "PTXInstrInfo.td" 121 122def PTXInstrInfo : InstrInfo; 123 124//===----------------------------------------------------------------------===// 125// Assembly printer 126//===----------------------------------------------------------------------===// 127// PTX uses the MC printer for asm output, so make sure the TableGen 128// AsmWriter bits get associated with the correct class. 129def PTXAsmWriter : AsmWriter { 130 string AsmWriterClassName = "InstPrinter"; 131 bit isMCAsmWriter = 1; 132} 133 134//===----------------------------------------------------------------------===// 135// Target Declaration 136//===----------------------------------------------------------------------===// 137 138def PTX : Target { 139 let InstructionSet = PTXInstrInfo; 140 let AssemblyWriters = [PTXAsmWriter]; 141} 142