Skip to content

Commit 6b6453b

Browse files
committed
address comments
1 parent 5ff5a25 commit 6b6453b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6209,16 +6209,20 @@ PerformBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
62096209
if (Op->getOpcode() == ISD::BITCAST)
62106210
*Op = Op->getOperand(0);
62116211

6212-
if (Op->getValueType() != MVT::i16 || Op->getOpcode() != ISD::TRUNCATE ||
6213-
Op->getOperand(0).getValueType() != MVT::i32)
6212+
if (!(Op->getValueType() == MVT::i16 && Op->getOpcode() == ISD::TRUNCATE &&
6213+
Op->getOperand(0).getValueType() == MVT::i32))
62146214
return SDValue();
62156215

62166216
*Op = Op->getOperand(0);
62176217

6218-
// Optionally, fold in a shift-right of the original operand and permute
6219-
// the two higher bytes from the shifted operand
6218+
// Optionally, fold in a shift-right of the original operand and let permute
6219+
// pick the two higher bytes of the original value directly.
62206220
if (Op->getOpcode() == ISD::SRL && isa<ConstantSDNode>(Op->getOperand(1))) {
62216221
if (cast<ConstantSDNode>(Op->getOperand(1))->getZExtValue() == 16) {
6222+
// Shift the PRMT byte selector to pick upper bytes from each respective
6223+
// value, instead of the lower ones: 0x10 -> 0x32, 0x54 -> 0x76
6224+
assert((*OpBytes == 0x10 || *OpBytes == 0x54) &&
6225+
"PRMT selector values out of range");
62226226
*OpBytes += 0x22;
62236227
*Op = Op->getOperand(0);
62246228
}

0 commit comments

Comments
 (0)