Skip to content

Commit cead73d

Browse files
Revert "Revert "[NVPTX] Emit prmt selection value in hex" (#115204)"
This reverts commit 375d192.
1 parent 5b6f9b4 commit cead73d

File tree

5 files changed

+109
-90
lines changed

5 files changed

+109
-90
lines changed

llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ void NVPTXInstPrinter::printOffseti32imm(const MCInst *MI, int OpNum,
373373
}
374374
}
375375

376+
void NVPTXInstPrinter::printHexu32imm(const MCInst *MI, int OpNum,
377+
raw_ostream &O, const char *Modifier) {
378+
int64_t Imm = MI->getOperand(OpNum).getImm();
379+
O << formatHex(Imm) << "U";
380+
}
381+
376382
void NVPTXInstPrinter::printProtoIdent(const MCInst *MI, int OpNum,
377383
raw_ostream &O, const char *Modifier) {
378384
const MCOperand &Op = MI->getOperand(OpNum);

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,10 @@ multiclass BFI<string Instr, ValueType T, RegisterClass RC, Operand ImmCls> {
17401740
[(set (T RC:$f), (bfi (T imm:$a), (T RC:$b), (i32 imm:$c), (i32 imm:$d)))]>;
17411741
}
17421742

1743+
def Hexu32imm : Operand<i32> {
1744+
let PrintMethod = "printHexu32imm";
1745+
}
1746+
17431747
multiclass PRMT<ValueType T, RegisterClass RC> {
17441748
def rrr
17451749
: NVPTXInst<(outs RC:$d),
@@ -1748,12 +1752,12 @@ multiclass PRMT<ValueType T, RegisterClass RC> {
17481752
[(set (T RC:$d), (prmt (T RC:$a), (T RC:$b), (i32 Int32Regs:$c), imm:$mode))]>;
17491753
def rri
17501754
: NVPTXInst<(outs RC:$d),
1751-
(ins RC:$a, Int32Regs:$b, i32imm:$c, PrmtMode:$mode),
1755+
(ins RC:$a, Int32Regs:$b, Hexu32imm:$c, PrmtMode:$mode),
17521756
!strconcat("prmt.b32${mode}", " \t$d, $a, $b, $c;"),
17531757
[(set (T RC:$d), (prmt (T RC:$a), (T RC:$b), (i32 imm:$c), imm:$mode))]>;
17541758
def rii
17551759
: NVPTXInst<(outs RC:$d),
1756-
(ins RC:$a, i32imm:$b, i32imm:$c, PrmtMode:$mode),
1760+
(ins RC:$a, i32imm:$b, Hexu32imm:$c, PrmtMode:$mode),
17571761
!strconcat("prmt.b32${mode}", " \t$d, $a, $b, $c;"),
17581762
[(set (T RC:$d), (prmt (T RC:$a), (T imm:$b), (i32 imm:$c), imm:$mode))]>;
17591763
}

0 commit comments

Comments
 (0)