@@ -146,6 +146,7 @@ def True : Predicate<"true">;
146
146
147
147
def hasPTX31 : Predicate<"Subtarget->getPTXVersion() >= 31">;
148
148
def hasPTX42 : Predicate<"Subtarget->getPTXVersion() >= 42">;
149
+ def hasPTX43 : Predicate<"Subtarget->getPTXVersion() >= 43">;
149
150
def hasPTX60 : Predicate<"Subtarget->getPTXVersion() >= 60">;
150
151
def hasPTX61 : Predicate<"Subtarget->getPTXVersion() >= 61">;
151
152
def hasPTX63 : Predicate<"Subtarget->getPTXVersion() >= 63">;
@@ -204,17 +205,29 @@ multiclass I3<string OpcStr, SDNode OpNode> {
204
205
[(set Int16Regs:$dst, (OpNode Int16Regs:$a, (imm):$b))]>;
205
206
}
206
207
207
- // Template for instructions which take 3 int32 args. The instructions are
208
+ // Template for instructions which take 3 int args. The instructions are
208
209
// named "<OpcStr>.s32" (e.g. "addc.cc.s32").
209
- multiclass ADD_SUB_INT_32<string OpcStr, SDNode OpNode> {
210
- def i32rr :
211
- NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$a, Int32Regs:$b),
212
- !strconcat(OpcStr, ".s32 \t$dst, $a, $b;"),
213
- [(set Int32Regs:$dst, (OpNode Int32Regs:$a, Int32Regs:$b))]>;
214
- def i32ri :
215
- NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$a, i32imm:$b),
216
- !strconcat(OpcStr, ".s32 \t$dst, $a, $b;"),
217
- [(set Int32Regs:$dst, (OpNode Int32Regs:$a, imm:$b))]>;
210
+ multiclass ADD_SUB_INT_CARRY<string OpcStr, SDNode OpNode> {
211
+ let hasSideEffects = 1 in {
212
+ def i32rr :
213
+ NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$a, Int32Regs:$b),
214
+ !strconcat(OpcStr, ".s32 \t$dst, $a, $b;"),
215
+ [(set Int32Regs:$dst, (OpNode Int32Regs:$a, Int32Regs:$b))]>;
216
+ def i32ri :
217
+ NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$a, i32imm:$b),
218
+ !strconcat(OpcStr, ".s32 \t$dst, $a, $b;"),
219
+ [(set Int32Regs:$dst, (OpNode Int32Regs:$a, imm:$b))]>;
220
+ def i64rr :
221
+ NVPTXInst<(outs Int64Regs:$dst), (ins Int64Regs:$a, Int64Regs:$b),
222
+ !strconcat(OpcStr, ".s64 \t$dst, $a, $b;"),
223
+ [(set Int64Regs:$dst, (OpNode Int64Regs:$a, Int64Regs:$b))]>,
224
+ Requires<[hasPTX43]>;
225
+ def i64ri :
226
+ NVPTXInst<(outs Int64Regs:$dst), (ins Int64Regs:$a, i64imm:$b),
227
+ !strconcat(OpcStr, ".s64 \t$dst, $a, $b;"),
228
+ [(set Int64Regs:$dst, (OpNode Int64Regs:$a, imm:$b))]>,
229
+ Requires<[hasPTX43]>;
230
+ }
218
231
}
219
232
220
233
// Template for instructions which take three fp64 or fp32 args. The
@@ -584,14 +597,13 @@ defm SUB_i1 : ADD_SUB_i1<sub>;
584
597
defm ADD : I3<"add.s", add>;
585
598
defm SUB : I3<"sub.s", sub>;
586
599
587
- // int32 addition and subtraction with carry-out.
588
- // FIXME: PTX 4.3 adds a 64-bit add.cc (and maybe also 64-bit addc.cc?).
589
- defm ADDCC : ADD_SUB_INT_32<"add.cc", addc>;
590
- defm SUBCC : ADD_SUB_INT_32<"sub.cc", subc>;
600
+ // in32 and int64 addition and subtraction with carry-out.
601
+ defm ADDCC : ADD_SUB_INT_CARRY<"add.cc", addc>;
602
+ defm SUBCC : ADD_SUB_INT_CARRY<"sub.cc", subc>;
591
603
592
- // int32 addition and subtraction with carry-in and carry-out.
593
- defm ADDCCC : ADD_SUB_INT_32 <"addc.cc", adde>;
594
- defm SUBCCC : ADD_SUB_INT_32 <"subc.cc", sube>;
604
+ // int32 and int64 addition and subtraction with carry-in and carry-out.
605
+ defm ADDCCC : ADD_SUB_INT_CARRY <"addc.cc", adde>;
606
+ defm SUBCCC : ADD_SUB_INT_CARRY <"subc.cc", sube>;
595
607
596
608
defm MULT : I3<"mul.lo.s", mul>;
597
609
0 commit comments