Skip to content

Commit a94d627

Browse files
committed
Addressed review comments
1. Moved tablegen check to Subtarget and using callSubtarget to access it. 2. Removed AnyPred, we don't need it as of now.
1 parent 3c61d59 commit a94d627

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ def PrmtMode : Operand<i32> {
101101
// NVPTX Instruction Predicate Definitions
102102
//===----------------------------------------------------------------------===//
103103

104-
// Helper predicate to compose multiple predicates.
105-
class AnyPred<list<Predicate> Preds>
106-
: Predicate<"(" #
107-
!interleave(!foreach(pred, Preds, pred.CondString),
108-
") || (") #
109-
")">;
110-
111104
// Checks PTX version and family-specific and architecture-specific SM versions.
112105
// For example, sm_100{f/a} and any future variants in the same family will match
113106
// for any PTX version greater than or equal to `PTXVersion`.
@@ -125,14 +118,6 @@ class PTXWithAccelSMs<int PTXVersion, list<int> SMVersions> :
125118
// Helper predicate to call a subtarget method.
126119
class callSubtarget<string SubtargetMethod> : Predicate<"Subtarget->" # SubtargetMethod # "()">;
127120

128-
// Composed predicate to check tcgen05.shift instructions support.
129-
def hasTcgen05ShiftSupport : AnyPred<[
130-
// sm_101 renamed to sm_110 in PTX 9.0
131-
PTXWithAccelSMs<90, [100, 110, 103]>,
132-
PTXWithAccelSMs<88, [100, 101, 103]>,
133-
PTXWithAccelSMs<86, [100, 101]>
134-
]>;
135-
136121
def hasAtomAddF64 : Predicate<"Subtarget->hasAtomAddF64()">;
137122
def hasAtomScope : Predicate<"Subtarget->hasAtomScope()">;
138123
def hasAtomBitwise64 : Predicate<"Subtarget->hasAtomBitwise64()">;

llvm/lib/Target/NVPTX/NVPTXIntrinsics.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5176,7 +5176,7 @@ foreach src_fmt = ["", "b6x16_p32", "b4x16_p64"] in {
51765176
}
51775177
} // Predicates
51785178

5179-
let Predicates = [hasTcgen05ShiftSupport] in {
5179+
let Predicates = [callSubtarget<"hasTcgen05ShiftSupport">] in {
51805180
multiclass TCGEN05_SHIFT_INTR<string num, Intrinsic Intr> {
51815181
def "" : BasicNVPTXInst<(outs),
51825182
(ins ADDR:$tmem_addr),

llvm/lib/Target/NVPTX/NVPTXSubtarget.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,20 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
146146
// - tcgen05.fence/wait
147147
// - tcgen05.commit
148148
bool hasTcgen05InstSupport() const {
149+
// sm_101 renamed to sm_110 in PTX 9.0
149150
return hasPTXWithFamilySMs(90, {100, 110}) ||
150151
hasPTXWithFamilySMs(88, {100, 101}) ||
151152
hasPTXWithAccelSMs(86, {100, 101});
152153
}
153154

155+
// Checks tcgen05.shift instruction support.
156+
bool hasTcgen05ShiftSupport() const {
157+
// sm_101 renamed to sm_110 in PTX 9.0
158+
return hasPTXWithAccelSMs(90, {100, 110, 103}) ||
159+
hasPTXWithAccelSMs(88, {100, 101, 103}) ||
160+
hasPTXWithAccelSMs(86, {100, 101});
161+
}
162+
154163
bool hasTcgen05MMAScaleInputDImm() const {
155164
return FullSmVersion == 1003 && PTXVersion >= 86;
156165
}

0 commit comments

Comments
 (0)